Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit merge xinit 1.4.2, xprop 1.2.6, xrandr 1.5.2,...



details:   https://anonhg.NetBSD.org/xsrc/rev/baba34a3cd3a
branches:  trunk
changeset: 7340:baba34a3cd3a
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Jan 08 09:59:51 2023 +0000

description:
merge xinit 1.4.2, xprop 1.2.6, xrandr 1.5.2, xset 1.2.5, and xstdcmap 1.0.5

diffstat:

 external/mit/xinit/dist/compile                    |   17 +-
 external/mit/xinit/dist/launchd/console_redirect.c |  418 ---------------------
 external/mit/xinit/dist/launchd/console_redirect.h |   44 --
 external/mit/xinit/dist/man/startx.man             |   24 +-
 external/mit/xinit/dist/startx.cpp                 |   41 +-
 external/mit/xinit/dist/xinit.c                    |    2 +-
 external/mit/xprop/include/config.h                |    8 +-
 external/mit/xrandr/dist/README                    |   26 -
 external/mit/xrandr/dist/compile                   |   17 +-
 external/mit/xrandr/dist/xrandr.c                  |  384 +++++++++----------
 external/mit/xset/dist/README                      |   24 -
 external/mit/xstdcmap/dist/compile                 |   17 +-
 12 files changed, 251 insertions(+), 771 deletions(-)

diffs (truncated from 2062 to 300 lines):

diff -r a47c79587484 -r baba34a3cd3a external/mit/xinit/dist/compile
--- a/external/mit/xinit/dist/compile   Sun Jan 08 09:55:08 2023 +0000
+++ b/external/mit/xinit/dist/compile   Sun Jan 08 09:59:51 2023 +0000
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2012-10-14.11; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey%cygnus.com@localhost>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -53,7 +53,7 @@
          MINGW*)
            file_conv=mingw
            ;;
-         CYGWIN*)
+         CYGWIN* | MSYS*)
            file_conv=cygwin
            ;;
          *)
@@ -67,7 +67,7 @@
        mingw/*)
          file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
          ;;
-       cygwin/*)
+       cygwin/* | msys/*)
          file=`cygpath -m "$file" || echo "$file"`
          ;;
        wine/*)
@@ -255,7 +255,8 @@
     echo "compile $scriptversion"
     exit $?
     ;;
-  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
+  icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
     func_cl_wrapper "$@"      # Doesn't return...
     ;;
 esac
@@ -339,9 +340,9 @@
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff -r a47c79587484 -r baba34a3cd3a external/mit/xinit/dist/launchd/console_redirect.c
--- a/external/mit/xinit/dist/launchd/console_redirect.c        Sun Jan 08 09:55:08 2023 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,418 +0,0 @@
-/* Copyright (c) 2011 Apple Inc.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
- * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above
- * copyright holders shall not be used in advertising or otherwise to
- * promote the sale, use or other dealings in this Software without
- * prior written authorization.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#else
-#define DEBUG_CONSOLE_REDIRECT 1
-#define HAVE_LIBDISPATCH 1
-#endif
-
-#include <assert.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/event.h>
-#include <asl.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#include "console_redirect.h"
-
-#define BUF_SIZE 512
-
-#ifdef HAVE_LIBDISPATCH
-#include <dispatch/dispatch.h>
-
-static dispatch_queue_t redirect_serial_q;
-static dispatch_group_t read_source_group;
-#else
-#include <pthread.h>
-
-static pthread_t redirect_pthread;
-static pthread_mutex_t redirect_fds_lock = PTHREAD_MUTEX_INITIALIZER;
-
-static int kq;
-
-/* Notifications to our reader thread */
-#define ASL_REDIRECT_TERMINATE ((void *)(uintptr_t)1)
-#endif
-
-typedef struct {
-    int level;
-    aslclient asl;
-    aslmsg msg;
-
-    /* Buffered reading */
-    char *buf;
-    char *w;
-
-#ifdef HAVE_LIBDISPATCH
-    dispatch_source_t read_source;
-#endif
-} asl_redirect;
-
-static asl_redirect *redirect_fds = NULL;
-static int n_redirect_fds = 0;
-
-/* Read from the FD until there is no more to read and redirect to ASL.
- * Preconditions:
- *      1: pthread_mutex_lock lock is held (pthreads) or called
- *         from the appropriate serial queue for operating on
- *         redirect_fds
- *      2: fd corresponds to a valid entry in redirect_fds
- *
- * Return values:
- *      If the pipe is closed, EOF is returned regardless of how many bytes
- *      were processed.  If the pipe is still open, the number of read bytes
- *      is returned.
- */
-static inline int _read_redirect(int fd, int flush) {
-    int total_read = 0;
-    int nbytes;
-    asl_redirect *aslr = &redirect_fds[fd];
-
-    while((nbytes = read(fd, aslr->w, BUF_SIZE - (aslr->w - aslr->buf) - 1)) > 0) {
-        char *s, *p;
-
-        /* Increment our returned number read */
-        total_read += nbytes;
-
-        nbytes += (aslr->w - aslr->buf);
-        aslr->buf[nbytes] = '\0';
-
-        /* One line at a time */
-        for(p=aslr->buf; *p && (p - aslr->buf) < nbytes; p = s + 1) {
-            // Find null or \n
-            for(s=p; *s && *s != '\n'; s++);
-            if(*s == '\n') {
-                *s='\0';
-                asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
-            } else if(aslr->buf != p) {
-                memmove(aslr->buf, p, BUF_SIZE - (p - aslr->buf));
-                aslr->w = aslr->buf + (s - p);
-                break;
-            } else if(nbytes == BUF_SIZE - 1) {
-                asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
-                aslr->w = aslr->buf;
-                break;
-            }
-        }
-    }
-
-    /* Flush if requested or we're at EOF */
-    if(flush || nbytes == 0) {
-        if(aslr->w > aslr->buf) {
-            *aslr->w = '\0';
-            asl_log(aslr->asl, aslr->msg, aslr->level, "%s", aslr->buf);
-        }
-    }
-
-    if(nbytes == 0)
-        return EOF;
-    return total_read;
-}
-
-#ifdef HAVE_LIBDISPATCH
-static void read_from_source(void *_source) {
-    dispatch_source_t source = (dispatch_source_t)_source;
-    int fd = dispatch_source_get_handle(source);
-    if(_read_redirect(fd, 0) == EOF) {
-        dispatch_source_cancel(source);
-    }
-}
-
-static void cancel_source(void *_source) {
-    dispatch_source_t source = (dispatch_source_t)_source;
-    int fd = dispatch_source_get_handle(source);
-    asl_redirect *aslr = &redirect_fds[fd];
-
-    /* Flush the buffer */
-    _read_redirect(fd, 1);
-
-    close(fd);
-    free(aslr->buf);
-    memset(aslr, 0, sizeof(*aslr));
-    dispatch_release(source);
-    dispatch_group_leave(read_source_group);
-}
-
-#else /* !HAVE_LIBDISPATCH */
-static void *redirect_thread(void *ctx __unused) {
-    struct kevent ev;
-    int n;
-
-    while(1) {
-        n = kevent(kq, NULL, 0, &ev, 1, NULL);
-
-        /* Bail on errors */
-        if(n < 0) {
-            asl_log(NULL, NULL, ASL_LEVEL_ERR, "kevent failure: %s", strerror(errno));
-            break;
-        }
-        
-        /* This should not happen */
-        if(n == 0)
-            continue;
-
-        switch(ev.filter) {
-            case EVFILT_READ:
-                pthread_mutex_lock(&redirect_fds_lock);
-                {
-                    int fd = ev.ident;
-                    int close_fd = 0;
-                    asl_redirect *aslr = &redirect_fds[fd];
-
-                    if(fd < 0 || fd >= n_redirect_fds || aslr->buf == NULL) {
-                        asl_log(NULL, NULL, ASL_LEVEL_ERR, "Unexpected file descriptor: %d", fd);
-                        goto next;
-                    }
-
-                    if(ev.flags & EV_EOF) {
-                        close_fd = 1;
-                        if(EOF != _read_redirect(fd, 1)) {
-                            asl_log(NULL, NULL, ASL_LEVEL_ERR, "kevent reported EOF on %d, but read doesn't concur.", fd);
-                        }
-                    } else {
-                        close_fd = (EOF == _read_redirect(fd, 0));
-                    }
-                    
-                    if(close_fd) {
-                        EV_SET(&ev, fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
-                        kevent(kq, &ev, 1, NULL, 0, NULL);
-                        close(fd);
-                        free(aslr->buf);
-                        memset(aslr, 0, sizeof(*aslr));
-                    }
-                }
-                next:
-                pthread_mutex_unlock(&redirect_fds_lock);
-
-            case EVFILT_TIMER:
-                if(ev.udata == ASL_REDIRECT_TERMINATE)
-                    return NULL;
-
-            default:
-                ;;
-        }
-    }
-
-    return NULL;
-}
-#endif
-
-static void redirect_atexit(void) {
-    /* stdout is linebuffered, so flush the buffer */



Home | Main Index | Thread Index | Old Index