Import of pkgsrc-2016Q3

This commit is contained in:
2016-10-14 07:49:11 +02:00
committed by Lionel Sambuc
parent 9d819b6d54
commit 1242aa1e36
35952 changed files with 949749 additions and 377083 deletions

View File

@@ -1,38 +0,0 @@
$NetBSD: patch-aa,v 1.5 2014/08/17 15:59:07 wiz Exp $
Add backends for NetBSD, Dragonfly, and OpenBSD.
--- configure.ac.orig 2011-02-17 00:37:16.000000000 +0000
+++ configure.ac
@@ -190,6 +201,21 @@ case "$host" in
*-*-solaris*)
CK_BACKEND="solaris"
;;
+ *-*-netbsd*)
+ CK_BACKEND="netbsd"
+ ;;
+ *-*-dragonfly*)
+ CK_BACKEND="freebsd"
+ KVM_LIBS="-lkvm"
+ ;;
+ *-*-openbsd*)
+ CK_BACKEND="openbsd"
+ AC_CHECK_LIB(kvm, kvm_openfiles, have_kvm=yes,
+ AC_MSG_ERROR([Unable to find libkvm which is needed on OpenBSD]))
+ if test "x$have_kvm" = "xyes"; then
+ KVM_LIBS="-lkvm"
+ fi
+ ;;
*)
AC_MSG_ERROR([No sysdeps back-end implemented for host $host])
;;
@@ -199,7 +225,9 @@ AC_SUBST(KVM_LIBS)
AM_CONDITIONAL(CK_COMPILE_LINUX, test x$CK_BACKEND = xlinux, [Compiling for Linux])
AM_CONDITIONAL(CK_COMPILE_FREEBSD, test x$CK_BACKEND = xfreebsd, [Compiling for FreeBSD])
+AM_CONDITIONAL(CK_COMPILE_NETBSD, test x$CK_BACKEND = xnetbsd, [Compiling for NetBSD])
AM_CONDITIONAL(CK_COMPILE_SOLARIS, test x$CK_BACKEND = xsolaris, [Compiling for Solaris])
+AM_CONDITIONAL(CK_COMPILE_OPENBSD, test x$CK_BACKEND = xopenbsd, [Compiling for OpenBSD])
AC_SUBST(CK_BACKEND)
dnl ---------------------------------------------------------------------------

View File

@@ -1,32 +0,0 @@
$NetBSD: patch-ab,v 1.3 2014/08/17 15:59:07 wiz Exp $
Add backends for NetBSD and OpenBSD.
--- src/Makefile.am.orig 2008-07-25 18:38:56.000000000 +0000
+++ src/Makefile.am
@@ -56,11 +56,25 @@ libck_la_SOURCES += \
$(NULL)
libck_la_LIBADD = $(KVM_LIBS)
endif
+if CK_COMPILE_NETBSD
+libck_la_SOURCES += \
+ ck-sysdeps-netbsd.c \
+ $(NULL)
+libck_la_LIBADD = -lkvm
+endif
+if CK_COMPILE_OPENBSD
+libck_la_SOURCES += \
+ ck-sysdeps-openbsd.c \
+ $(NULL)
+libck_la_LIBADD = $(KVM_LIBS)
+endif
EXTRA_libck_la_SOURCES = \
ck-sysdeps-linux.c \
ck-sysdeps-solaris.c \
ck-sysdeps-freebsd.c \
+ ck-sysdeps-netbsd.c \
+ ck-sysdeps-openbsd.c \
$(NULL)
sbin_PROGRAMS = \

View File

@@ -1,21 +0,0 @@
$NetBSD: patch-ac,v 1.3 2014/08/17 15:59:07 wiz Exp $
Add backends for NetBSD and OpenBSD.
--- tools/Makefile.am.orig 2008-02-13 03:46:39.000000000 +0000
+++ tools/Makefile.am
@@ -18,6 +18,14 @@ if CK_COMPILE_SOLARIS
SUBDIRS += solaris
endif
+if CK_COMPILE_NETBSD
+SUBDIRS += freebsd
+endif
+
+if CK_COMPILE_OPENBSD
+SUBDIRS += freebsd
+endif
+
DIST_SUBDIRS = \
linux \
freebsd \

View File

@@ -1,18 +0,0 @@
$NetBSD: patch-ad,v 1.2 2014/08/17 15:59:07 wiz Exp $
Install config files into pkgsrc example path.
--- data/Makefile.am.orig 2008-02-29 15:23:02.000000000 -0500
+++ data/Makefile.am
@@ -1,9 +1,9 @@
NULL =
-dbusconfdir = $(DBUS_SYS_DIR)
+dbusconfdir = $(PREFIX)/share/examples/consolekit
dbusconf_DATA = ConsoleKit.conf
-seatdir = $(sysconfdir)/ConsoleKit/seats.d
+seatdir = $(PREFIX)/share/examples/consolekit
seat_DATA = 00-primary.seat
if HAVE_POLKIT

View File

@@ -1,127 +0,0 @@
$NetBSD: patch-ae,v 1.7 2014/08/17 15:59:07 wiz Exp $
Fix UNIX backend for NetBSD, DragonFly, and OpenBSD.
--- src/ck-sysdeps-unix.c.orig 2008-01-23 14:30:44.000000000 +0000
+++ src/ck-sysdeps-unix.c
@@ -35,6 +35,11 @@
#include <linux/kd.h>
#endif
+#ifdef __NetBSD__
+#include <dev/wscons/wsdisplay_usl_io.h>
+#include <sys/un.h>
+#endif
+
#ifdef HAVE_SYS_VT_H
#include <sys/vt.h>
#endif
@@ -53,6 +58,25 @@
#define ERROR -1
#endif
+#ifdef LOCAL_PEEREID
+static gboolean
+ck_nb_getpeeruucred(int socket_fd, pid_t *pid, uid_t *uid)
+{
+ struct unpcbid cred;
+ socklen_t len = sizeof(cred);
+
+ if (getsockopt(socket_fd, 0, LOCAL_PEEREID, &cred, &len) < 0)
+ return FALSE;
+
+ if (pid)
+ *pid = cred.unp_pid;
+ if (uid)
+ *uid = cred.unp_euid;
+
+ return TRUE;
+}
+#endif
+
/* Adapted from dbus-sysdeps-unix.c:_dbus_read_credentials_socket() */
gboolean
ck_get_socket_peer_credentials (int socket_fd,
@@ -69,7 +93,11 @@ ck_get_socket_peer_credentials (int
ret = FALSE;
#ifdef SO_PEERCRED
+#if !defined(__OpenBSD__)
struct ucred cr;
+#else
+ struct sockpeercred cr;
+#endif
socklen_t cr_len;
cr_len = sizeof (cr);
@@ -99,7 +127,16 @@ ck_get_socket_peer_credentials (int
if (ucred != NULL) {
ucred_free (ucred);
}
-#else /* !SO_PEERCRED && !HAVE_GETPEERUCRED */
+#elif defined(LOCAL_PEEREID)
+ pid_t sockpid = -1, sockuid = -1;
+ if (ck_nb_getpeeruucred(socket_fd, &sockpid, &sockuid) == TRUE) {
+ pid_read = sockpid;
+ uid_read = sockuid;
+ ret = TRUE;
+ } else {
+ g_warning ("Failed to ck_nb_getpeeruucred() credentials\n");
+ }
+#else /* !SO_PEERCRED && !HAVE_GETPEERUCRED && !LOCAL_PEEREID*/
g_warning ("Socket credentials not supported on this OS\n");
#endif
@@ -126,17 +163,17 @@ ck_get_socket_peer_credentials (int
gboolean
ck_fd_is_a_console (int fd)
{
-#ifdef __linux__
+#if defined(__linux__) || defined(__NetBSD__)
struct vt_stat vts;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
int vers;
#endif
int kb_ok;
errno = 0;
-#ifdef __linux__
+#if defined(__linux__) || defined(__NetBSD__)
kb_ok = (ioctl (fd, VT_GETSTATE, &vts) == 0);
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
kb_ok = (ioctl (fd, CONS_GETVERS, &vers) == 0);
#else
kb_ok = 1;
@@ -172,6 +209,15 @@ ck_get_a_console_fd (void)
fd = -1;
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+ /* On FreeBSD, try /dev/consolectl first as this will survive
+ * /etc/ttys initialization. */
+ fd = open_a_console ("/dev/consolectl");
+ if (fd >= 0) {
+ goto done;
+ }
+#endif
+
#ifdef __sun
/* On Solaris, first try Sun VT device. */
fd = open_a_console ("/dev/vt/active");
@@ -184,6 +230,14 @@ ck_get_a_console_fd (void)
}
#endif
+#ifdef __NetBSD__
+ /* On NetBSD, first try wsdisplay device. */
+ fd = open_a_console ("/dev/ttyE0");
+ if (fd >= 0) {
+ goto done;
+ }
+#endif
+
#ifdef _PATH_TTY
fd = open_a_console (_PATH_TTY);
if (fd >= 0) {

View File

@@ -1,231 +0,0 @@
$NetBSD: patch-af,v 1.3 2014/08/17 15:59:07 wiz Exp $
Adapt FreeBSD backend for DragonFly.
--- src/ck-sysdeps-freebsd.c.orig 2010-09-03 13:54:31.000000000 +0000
+++ src/ck-sysdeps-freebsd.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <string.h>
#include <errno.h>
+#include <glob.h>
#include <paths.h>
#include <ttyent.h>
#include <kvm.h>
@@ -151,14 +152,38 @@ stat2proc (pid_t pid,
return FALSE;
}
+#ifdef __DragonFly__
+ num = MAXCOMLEN;
+#else
num = OCOMMLEN;
+#endif
if (num >= sizeof P->cmd) {
num = sizeof P->cmd - 1;
}
+#ifdef __DragonFly__
+ memcpy (P->cmd, p.kp_comm, num);
+#else
memcpy (P->cmd, p.ki_ocomm, num);
+#endif
P->cmd[num] = '\0';
+#ifdef __DragonFly__
+ P->pid = p.kp_pid;
+ P->ppid = p.kp_ppid;
+ P->pgrp = p.kp_pgid;
+ P->session = p.kp_sid;
+ P->rss = p.kp_vm_rssize;
+ P->vsize = p.kp_vm_map_size;
+ P->start_time = p.kp_start.tv_sec;
+ P->wchan = (unsigned long) p.kp_lwp.kl_wchan;
+ P->state = p.kp_stat;
+ P->nice = p.kp_nice;
+ P->flags = p.kp_flags;
+ P->tpgid = p.kp_tpgid;
+ P->processor = p.kp_lwp.kl_cpuid;
+ P->nlwp = p.kp_nthreads;
+#else
P->pid = p.ki_pid;
P->ppid = p.ki_ppid;
P->pgrp = p.ki_pgid;
@@ -173,19 +198,33 @@ stat2proc (pid_t pid,
P->tpgid = p.ki_tpgid;
P->processor = p.ki_oncpu;
P->nlwp = p.ki_numthreads;
+#endif
/* we like it Linux-encoded :-) */
+#ifdef __DragonFly__
+ tty_maj = major (p.kp_tdev);
+ tty_min = minor (p.kp_tdev);
+#else
tty_maj = major (p.ki_tdev);
tty_min = minor (p.ki_tdev);
+#endif
P->tty = DEV_ENCODE (tty_maj,tty_min);
snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min);
+#ifdef __DragonFly__
+ if (p.kp_tdev != NODEV && (ttname = devname (p.kp_tdev, S_IFCHR)) != NULL) {
+#else
if (p.ki_tdev != NODEV && (ttname = devname (p.ki_tdev, S_IFCHR)) != NULL) {
+#endif
memcpy (P->tty_text, ttname, sizeof P->tty_text);
}
+#ifdef __DragonFly__
+ if (p.kp_tdev == NODEV) {
+#else
if (p.ki_tdev == NODEV) {
+#endif
memcpy (P->tty_text, " ? ", sizeof P->tty_text);
}
@@ -202,7 +241,6 @@ ck_process_stat_new_for_unix_pid (pid_t
GError **error)
{
gboolean res;
- GError *local_error;
CkProcessStat *proc;
g_return_val_if_fail (pid > 1, FALSE);
@@ -217,7 +255,6 @@ ck_process_stat_new_for_unix_pid (pid_t
if (res) {
*stat = proc;
} else {
- g_propagate_error (error, local_error);
*stat = NULL;
}
@@ -308,7 +345,11 @@ ck_unix_pid_get_uid (pid_t pid)
res = get_kinfo_proc (pid, &p);
if (res) {
+#ifdef __DragonFly__
+ uid = p.kp_uid;
+#else
uid = p.ki_uid;
+#endif
}
return uid;
@@ -327,38 +368,40 @@ gboolean
ck_get_max_num_consoles (guint *num)
{
int max_consoles;
- int res;
- gboolean ret;
- struct ttyent *t;
+ int i;
+ glob_t g;
- ret = FALSE;
max_consoles = 0;
- res = setttyent ();
- if (res == 0) {
- goto done;
- }
-
- while ((t = getttyent ()) != NULL) {
- if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0)
+ g.gl_offs = 0;
+ glob ("/dev/ttyv*", GLOB_DOOFFS, NULL, &g);
+ for (i = 0; i < g.gl_pathc && g.gl_pathv[i] != NULL; i++) {
+ int fd;
+ char *cdev;
+
+ cdev = g.gl_pathv[i];
+ fd = open (cdev, O_RDONLY | O_NOCTTY);
+ if (fd > -1) {
+ close (fd);
max_consoles++;
+ } else {
+ break;
+ }
}
- /* Increment one more so that all consoles are properly counted
+ globfree (&g);
+
+ /*
+ * Increment one more so that all consoles are properly counted
* this is arguable a bug in vt_add_watches().
*/
max_consoles++;
- ret = TRUE;
-
- endttyent ();
-
-done:
if (num != NULL) {
*num = max_consoles;
}
- return ret;
+ return TRUE;
}
gboolean
@@ -375,7 +418,12 @@ ck_get_console_device_for_num (guint num
/* The device number is always one less than the VT number. */
num--;
- device = g_strdup_printf ("/dev/ttyv%u", num);
+ if (num < 10)
+ device = g_strdup_printf ("/dev/ttyv%i", num);
+ else if (num < 32)
+ device = g_strdup_printf ("/dev/ttyv%c", num - 10 + 'a');
+ else
+ device = NULL;
return device;
}
@@ -385,6 +433,7 @@ ck_get_console_num_from_device (const ch
guint *num)
{
guint n;
+ char c;
gboolean ret;
n = 0;
@@ -394,7 +443,11 @@ ck_get_console_num_from_device (const ch
return FALSE;
}
- if (sscanf (device, "/dev/ttyv%u", &n) == 1) {
+ if (sscanf (device, "/dev/ttyv%c", &c) == 1) {
+ if (c < 58)
+ n = c - 48;
+ else
+ n = c - 'a' + 10;
/* The VT number is always one more than the device number. */
n++;
ret = TRUE;
@@ -414,6 +467,7 @@ ck_get_active_console_num (int consol
gboolean ret;
int res;
int active;
+ char ttyn;
g_assert (console_fd != -1);
@@ -426,7 +480,12 @@ ck_get_active_console_num (int consol
goto out;
}
- g_debug ("Active VT is: %d (ttyv%d)", active, active - 1);
+ if (active - 1 < 10)
+ ttyn = active - 1 + '0';
+ else
+ ttyn = active - 11 + 'a';
+
+ g_debug ("Active VT is: %d (ttyv%c)", active, ttyn);
ret = TRUE;
out:

View File

@@ -0,0 +1,16 @@
$NetBSD: patch-data_Makefile.am,v 1.2 2016/06/18 11:09:36 ryoon Exp $
* Fix installation of script data files
--- data/Makefile.am.orig 2015-06-28 08:37:44.000000000 +0000
+++ data/Makefile.am
@@ -113,8 +113,7 @@ install-logrotate: $(LOGROTATE_CONFS)
install-90-consolekit: $(XINITRC_CONFS)
$(MKDIR_P) $(DESTDIR)$(XINITRC_DIR)/
- $(INSTALL_PROGRAM) 90-consolekit $(DESTDIR)$(XINITRC_DIR) && \
- chmod +x $(DESTDIR)$(XINITRC_DIR)/90-consolekit
+ $(INSTALL_DATA) 90-consolekit $(DESTDIR)$(XINITRC_DIR)
uninstall-logrotate:
rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/consolekit

View File

@@ -0,0 +1,15 @@
$NetBSD: patch-data_Makefile.in,v 1.1 2016/06/18 11:09:36 ryoon Exp $
* Fix installation of script data files
--- data/Makefile.in.orig 2016-03-19 15:19:18.000000000 +0000
+++ data/Makefile.in
@@ -784,7 +784,7 @@ install-logrotate: $(LOGROTATE_CONFS)
install-90-consolekit: $(XINITRC_CONFS)
$(MKDIR_P) $(DESTDIR)$(XINITRC_DIR)/
- $(INSTALL_PROGRAM) 90-consolekit $(DESTDIR)$(XINITRC_DIR) && \
+ $(INSTALL_SCRIPT) 90-consolekit $(DESTDIR)$(XINITRC_DIR) && \
chmod +x $(DESTDIR)$(XINITRC_DIR)/90-consolekit
uninstall-logrotate: