import ConsoleKit-0.3.0:
ConsoleKit is a framework for defining and tracking users, login sessions, and seats. The primary motivations for this framework are to facilitate fast-user-switching and multi-seat capabilities, and to enable more sophisticated policy decisions for desktop sessions. this is not hooked up to the build just yet, just like policykit
This commit is contained in:
parent
263aeffc03
commit
7977c66927
41
sysutils/consolekit/Makefile
Normal file
41
sysutils/consolekit/Makefile
Normal file
@ -0,0 +1,41 @@
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
|
||||
COMMENT= Framework for defining and tracking users
|
||||
|
||||
DISTNAME= ConsoleKit-0.3.0
|
||||
PKGNAME= ${DISTNAME:L}
|
||||
CATEGORIES= sysutils
|
||||
EXTRACT_SUFX= .tar.bz2
|
||||
|
||||
SHARED_LIBS+= ck-connector 0.0
|
||||
|
||||
HOMEPAGE= http://cgit.freedesktop.org/ConsoleKit/
|
||||
|
||||
# GPLv2+
|
||||
PERMIT_DISTFILES_CDROM= Yes
|
||||
PERMIT_DISTFILES_FTP= Yes
|
||||
PERMIT_PACKAGE_CDROM= Yes
|
||||
PERMIT_PACKAGE_FTP= Yes
|
||||
|
||||
WANTLIB= c
|
||||
|
||||
MASTER_SITES= http://people.freedesktop.org/~mccann/dist/
|
||||
|
||||
AUTOCONF_VERSION= 2.61
|
||||
CONFIGURE_STYLE= autoconf
|
||||
CONFIGURE_ARGS= --with-authfw=bsdauth \
|
||||
--with-os-type=openbsd
|
||||
CONFIGURE_ENV= CFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include"
|
||||
|
||||
USE_LIBTOOL= Yes
|
||||
USE_GMAKE= Yes
|
||||
|
||||
FAKE_FLAGS= DBUS_SYS_DIR=${TRUEPREFIX}/share/examples/consolekit/dbus-1 \
|
||||
sysconfdir=${TRUEPREFIX}/share/examples/consolekit
|
||||
|
||||
pre-patch:
|
||||
@cd ${WRKSRC}/tools && \
|
||||
cp -R freebsd openbsd && \
|
||||
perl -pi -e "s,freebsd,openbsd,g" openbsd/Makefile.in
|
||||
|
||||
.include <bsd.port.mk>
|
5
sysutils/consolekit/distinfo
Normal file
5
sysutils/consolekit/distinfo
Normal file
@ -0,0 +1,5 @@
|
||||
MD5 (ConsoleKit-0.3.0.tar.bz2) = Q7AqUiEjMLVM+zTEBE2c4A==
|
||||
RMD160 (ConsoleKit-0.3.0.tar.bz2) = eh69L0v7ZWkOcBOMmSPD/S/K9nE=
|
||||
SHA1 (ConsoleKit-0.3.0.tar.bz2) = 47YVZiLMFOvKc4KlW47RXy8rrZg=
|
||||
SHA256 (ConsoleKit-0.3.0.tar.bz2) = y8+7PfLcdoVcmcHN/wSiV+xScPpi4dIbDQV7CNiMD9Q=
|
||||
SIZE (ConsoleKit-0.3.0.tar.bz2) = 393694
|
41
sysutils/consolekit/patches/patch-configure_ac
Normal file
41
sysutils/consolekit/patches/patch-configure_ac
Normal file
@ -0,0 +1,41 @@
|
||||
$OpenBSD: patch-configure_ac,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
--- configure.ac.orig Sat May 30 23:09:15 2009
|
||||
+++ configure.ac Sat May 30 23:10:16 2009
|
||||
@@ -176,6 +176,14 @@ dnl --------------------------------------------------
|
||||
CK_BACKEND=""
|
||||
KVM_LIBS=""
|
||||
case "$host" in
|
||||
+ *-*-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
|
||||
+ ;;
|
||||
*-*-freebsd*)
|
||||
CK_BACKEND="freebsd"
|
||||
AC_CHECK_LIB(kvm, kvm_openfiles, have_kvm=yes,
|
||||
@@ -196,6 +204,7 @@ 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_OPENBSD, test x$CK_BACKEND = xopenbsd, [Compiling for OpenBSD])
|
||||
AM_CONDITIONAL(CK_COMPILE_SOLARIS, test x$CK_BACKEND = xsolaris, [Compiling for Solaris])
|
||||
AC_SUBST(CK_BACKEND)
|
||||
|
||||
@@ -393,6 +402,7 @@ src/Makefile
|
||||
tools/Makefile
|
||||
tools/linux/Makefile
|
||||
tools/freebsd/Makefile
|
||||
+tools/openbsd/Makefile
|
||||
tools/solaris/Makefile
|
||||
data/Makefile
|
||||
doc/Makefile
|
||||
@@ -441,4 +451,4 @@ if test x${have_polkit} = xno -a x${msg_rbac_shutdown}
|
||||
echo " a huge SECURITY HOLE. I repeat: YOU NEED TO EDIT THE FILE"
|
||||
echo " ConsoleKit.conf to match your distro/site to avoid NASTY SECURITY HOLES."
|
||||
echo ""
|
||||
-fi
|
||||
\ No newline at end of file
|
||||
+fi
|
54
sysutils/consolekit/patches/patch-src_Makefile_in
Normal file
54
sysutils/consolekit/patches/patch-src_Makefile_in
Normal file
@ -0,0 +1,54 @@
|
||||
$OpenBSD: patch-src_Makefile_in,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
--- src/Makefile.in.orig Thu Jul 31 02:41:10 2008
|
||||
+++ src/Makefile.in Sun May 31 00:06:37 2009
|
||||
@@ -46,6 +46,10 @@ host_triplet = @host@
|
||||
@CK_COMPILE_FREEBSD_TRUE@ ck-sysdeps-freebsd.c \
|
||||
@CK_COMPILE_FREEBSD_TRUE@ $(NULL)
|
||||
|
||||
+@CK_COMPILE_OPENBSD_TRUE@am__append_3 = \
|
||||
+@CK_COMPILE_OPENBSD_TRUE@ ck-sysdeps-openbsd.c \
|
||||
+@CK_COMPILE_OPENBSD_TRUE@ $(NULL)
|
||||
+
|
||||
sbin_PROGRAMS = console-kit-daemon$(EXEEXT) $(am__EXEEXT_1)
|
||||
noinst_PROGRAMS = test-event-logger$(EXEEXT) \
|
||||
test-tty-idle-monitor$(EXEEXT) test-vt-monitor$(EXEEXT) \
|
||||
@@ -69,13 +73,17 @@ am__DEPENDENCIES_1 =
|
||||
@CK_COMPILE_FREEBSD_TRUE@libck_la_DEPENDENCIES = \
|
||||
@CK_COMPILE_FREEBSD_TRUE@ $(am__DEPENDENCIES_1)
|
||||
am__libck_la_SOURCES_DIST = ck-sysdeps.h ck-sysdeps-unix.c \
|
||||
- ck-sysdeps-linux.c ck-sysdeps-solaris.c ck-sysdeps-freebsd.c
|
||||
+ ck-sysdeps-linux.c ck-sysdeps-solaris.c ck-sysdeps-freebsd.c \
|
||||
+ ck-sysdeps-openbsd.c
|
||||
@CK_COMPILE_LINUX_TRUE@am__objects_2 = ck-sysdeps-linux.lo \
|
||||
@CK_COMPILE_LINUX_TRUE@ $(am__objects_1)
|
||||
@CK_COMPILE_SOLARIS_TRUE@am__objects_3 = ck-sysdeps-solaris.lo \
|
||||
@CK_COMPILE_SOLARIS_TRUE@ $(am__objects_1)
|
||||
@CK_COMPILE_FREEBSD_TRUE@am__objects_4 = ck-sysdeps-freebsd.lo \
|
||||
@CK_COMPILE_FREEBSD_TRUE@ $(am__objects_1)
|
||||
+@CK_COMPILE_OPENBSD_TRUE@am__objects_4 = ck-sysdeps-openbsd.lo \
|
||||
+@CK_COMPILE_OPENBSD_TRUE@ $(am__objects_1)
|
||||
+
|
||||
am_libck_la_OBJECTS = ck-sysdeps-unix.lo $(am__objects_1) \
|
||||
$(am__objects_2) $(am__objects_3) $(am__objects_4)
|
||||
libck_la_OBJECTS = $(am_libck_la_OBJECTS)
|
||||
@@ -362,10 +370,12 @@ libck_event_log_la_SOURCES = \
|
||||
libck_la_SOURCES = ck-sysdeps.h ck-sysdeps-unix.c $(NULL) \
|
||||
$(am__append_1) $(am__append_2) $(am__append_3)
|
||||
@CK_COMPILE_FREEBSD_TRUE@libck_la_LIBADD = $(KVM_LIBS)
|
||||
+@CK_COMPILE_OPENBSD_TRUE@libck_la_LIBADD = $(KVM_LIBS)
|
||||
EXTRA_libck_la_SOURCES = \
|
||||
ck-sysdeps-linux.c \
|
||||
ck-sysdeps-solaris.c \
|
||||
ck-sysdeps-freebsd.c \
|
||||
+ ck-sysdeps-openbsd.c \
|
||||
$(NULL)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
@@ -571,6 +581,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-session-leader.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-session.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-sysdeps-freebsd.Plo@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-sysdeps-openbsd.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-sysdeps-linux.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-sysdeps-solaris.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-sysdeps-unix.Plo@am__quote@
|
11
sysutils/consolekit/patches/patch-src_ck-run-programs_c
Normal file
11
sysutils/consolekit/patches/patch-src_ck-run-programs_c
Normal file
@ -0,0 +1,11 @@
|
||||
$OpenBSD: patch-src_ck-run-programs_c,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
--- src/ck-run-programs.c.orig Sun May 31 19:37:54 2009
|
||||
+++ src/ck-run-programs.c Sun May 31 19:38:07 2009
|
||||
@@ -225,6 +225,7 @@ ck_run_programs (const char *dirpath,
|
||||
out_loop:
|
||||
g_free (child_argv[0]);
|
||||
}
|
||||
+ g_dir_close (dir);
|
||||
out:
|
||||
g_strfreev (env_for_child);
|
||||
}
|
12
sysutils/consolekit/patches/patch-src_ck-session_c
Normal file
12
sysutils/consolekit/patches/patch-src_ck-session_c
Normal file
@ -0,0 +1,12 @@
|
||||
$OpenBSD: patch-src_ck-session_c,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
--- src/ck-session.c.orig Sun May 31 19:37:12 2009
|
||||
+++ src/ck-session.c Sun May 31 19:37:38 2009
|
||||
@@ -1100,6 +1100,8 @@ ck_session_finalize (GObject *object)
|
||||
|
||||
session_remove_activity_watch (session);
|
||||
|
||||
+ g_object_unref (session->priv->bus_proxy);
|
||||
+
|
||||
g_free (session->priv->id);
|
||||
g_free (session->priv->cookie);
|
||||
g_free (session->priv->seat_id);
|
416
sysutils/consolekit/patches/patch-src_ck-sysdeps-openbsd_c
Normal file
416
sysutils/consolekit/patches/patch-src_ck-sysdeps-openbsd_c
Normal file
@ -0,0 +1,416 @@
|
||||
$OpenBSD: patch-src_ck-sysdeps-openbsd_c,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
--- src/ck-sysdeps-openbsd.c.orig Sun May 31 04:10:36 2009
|
||||
+++ src/ck-sysdeps-openbsd.c Sun May 31 19:24:53 2009
|
||||
@@ -0,0 +1,412 @@
|
||||
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
||||
+ *
|
||||
+ * Copyright (C) 2006 William Jon McCann <mccann@jhu.edu>
|
||||
+ * Copyright (C) 2007 Joe Marcus Clarke <marcus@FreeBSD.org>
|
||||
+ * Copyright (C) 2008 Jared D. McNeill <jmcneill@NetBSD.org>
|
||||
+ * Copyright (C) 2009 Jared D. McNeill <robert@openbsd.org>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * 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, write to the Free Software
|
||||
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+#include <errno.h>
|
||||
+#include <paths.h>
|
||||
+#include <ttyent.h>
|
||||
+#include <kvm.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#include <sys/user.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+
|
||||
+#include <dev/wscons/wsdisplay_usl_io.h>
|
||||
+
|
||||
+#define DEV_ENCODE(M,m) ( \
|
||||
+ ( (M&0xfff) << 8) | ( (m&0xfff00) << 12) | (m&0xff) \
|
||||
+)
|
||||
+
|
||||
+#include "ck-sysdeps.h"
|
||||
+
|
||||
+#ifndef ERROR
|
||||
+#define ERROR -1
|
||||
+#endif
|
||||
+
|
||||
+/* adapted from procps */
|
||||
+struct _CkProcessStat
|
||||
+{
|
||||
+ int pid;
|
||||
+ int ppid; /* stat,status pid of parent process */
|
||||
+ char state; /* stat,status single-char code for process state (S=sleeping) */
|
||||
+ char cmd[16]; /* stat,status basename of executable file in call to exec(2) */
|
||||
+ unsigned long long utime; /* stat user-mode CPU time accumulated by process */
|
||||
+ unsigned long long stime; /* stat kernel-mode CPU time accumulated by process */
|
||||
+ unsigned long long cutime; /* stat cumulative utime of process and reaped children */
|
||||
+ unsigned long long cstime; /* stat cumulative stime of process and reaped children */
|
||||
+ unsigned long long start_time; /* stat start time of process -- seconds since 1-1-70 */
|
||||
+ unsigned long start_code; /* stat address of beginning of code segment */
|
||||
+ unsigned long end_code; /* stat address of end of code segment */
|
||||
+ unsigned long start_stack; /* stat address of the bottom of stack for the process */
|
||||
+ unsigned long kstk_esp; /* stat kernel stack pointer */
|
||||
+ unsigned long kstk_eip; /* stat kernel instruction pointer */
|
||||
+ unsigned long wchan; /* stat (special) address of kernel wait channel proc is sleeping in */
|
||||
+ long priority; /* stat kernel scheduling priority */
|
||||
+ long nice; /* stat standard unix nice level of process */
|
||||
+ long rss; /* stat resident set size from /proc/#/stat (pages) */
|
||||
+ long alarm; /* stat ? */
|
||||
+ unsigned long rtprio; /* stat real-time priority */
|
||||
+ unsigned long sched; /* stat scheduling class */
|
||||
+ unsigned long vsize; /* stat number of pages of virtual memory ... */
|
||||
+ unsigned long rss_rlim; /* stat resident set size limit? */
|
||||
+ unsigned long flags; /* stat kernel flags for the process */
|
||||
+ unsigned long min_flt; /* stat number of minor page faults since process start */
|
||||
+ unsigned long maj_flt; /* stat number of major page faults since process start */
|
||||
+ unsigned long cmin_flt; /* stat cumulative min_flt of process and child processes */
|
||||
+ unsigned long cmaj_flt; /* stat cumulative maj_flt of process and child processes */
|
||||
+ int pgrp; /* stat process group id */
|
||||
+ int session; /* stat session id */
|
||||
+ int nlwp; /* stat number of threads, or 0 if no clue */
|
||||
+ int tty; /* stat full device number of controlling terminal */
|
||||
+ int tpgid; /* stat terminal process group id */
|
||||
+ int exit_signal; /* stat might not be SIGCHLD */
|
||||
+ int processor; /* stat current (or most recent?) CPU */
|
||||
+ unsigned long penv; /* stat address of initial environment vector */
|
||||
+ char tty_text[16]; /* stat device name */
|
||||
+
|
||||
+};
|
||||
+
|
||||
+pid_t
|
||||
+ck_process_stat_get_ppid (CkProcessStat *stat)
|
||||
+{
|
||||
+ g_return_val_if_fail (stat != NULL, -1);
|
||||
+
|
||||
+ return stat->ppid;
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+ck_process_stat_get_cmd (CkProcessStat *stat)
|
||||
+{
|
||||
+ g_return_val_if_fail (stat != NULL, NULL);
|
||||
+
|
||||
+ return g_strdup (stat->cmd);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+ck_process_stat_get_tty (CkProcessStat *stat)
|
||||
+{
|
||||
+ g_return_val_if_fail (stat != NULL, NULL);
|
||||
+
|
||||
+ return g_strdup (stat->tty_text);
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+get_kinfo_proc (pid_t pid,
|
||||
+ struct kinfo_proc2 *p)
|
||||
+{
|
||||
+ int name[6];
|
||||
+ u_int namelen;
|
||||
+ size_t sz;
|
||||
+
|
||||
+ sz = sizeof(*p);
|
||||
+ namelen = 0;
|
||||
+ name[namelen++] = CTL_KERN;
|
||||
+ name[namelen++] = KERN_PROC2;
|
||||
+ name[namelen++] = KERN_PROC_PID;
|
||||
+ name[namelen++] = pid;
|
||||
+ name[namelen++] = sz;
|
||||
+ name[namelen++] = 1;
|
||||
+
|
||||
+ if (sysctl (name, namelen, p, &sz, NULL, 0) == -1) {
|
||||
+ perror("sysctl kern.proc2.pid");
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+/* return 1 if it works, or 0 for failure */
|
||||
+static gboolean
|
||||
+stat2proc (pid_t pid,
|
||||
+ CkProcessStat *P)
|
||||
+{
|
||||
+ struct kinfo_proc2 p;
|
||||
+ char *ttname;
|
||||
+ int num;
|
||||
+ int tty_maj;
|
||||
+ int tty_min;
|
||||
+
|
||||
+ if (! get_kinfo_proc (pid, &p)) {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ num = KI_MAXCOMLEN;
|
||||
+ if (num >= sizeof P->cmd) {
|
||||
+ num = sizeof P->cmd - 1;
|
||||
+ }
|
||||
+
|
||||
+ memcpy (P->cmd, p.p_comm, num);
|
||||
+
|
||||
+ P->cmd[num] = '\0';
|
||||
+ P->pid = p.p_pid;
|
||||
+ P->ppid = p.p_ppid;
|
||||
+ P->pgrp = p.p__pgid;
|
||||
+ P->session = p.p_sid;
|
||||
+ P->rss = p.p_vm_rssize;
|
||||
+ P->vsize = p.p_vm_dsize + p.p_vm_dsize + p.p_vm_ssize; /* XXX */
|
||||
+ P->start_time = p.p_ustart_sec;
|
||||
+ P->wchan = (unsigned long) p.p_wchan;
|
||||
+ P->state = p.p_stat;
|
||||
+ P->nice = p.p_nice;
|
||||
+ P->flags = p.p_realflag;
|
||||
+ P->tpgid = p.p_tpgid;
|
||||
+ P->processor = p.p_cpuid;
|
||||
+
|
||||
+ /* we like it Linux-encoded :-) */
|
||||
+ tty_maj = major (p.p_tdev);
|
||||
+ tty_min = minor (p.p_tdev);
|
||||
+ P->tty = DEV_ENCODE (tty_maj,tty_min);
|
||||
+
|
||||
+ snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min);
|
||||
+
|
||||
+ if (p.p_tdev != NODEV && (ttname = devname (p.p_tdev, S_IFCHR)) != NULL) {
|
||||
+ memcpy (P->tty_text, ttname, sizeof P->tty_text);
|
||||
+ }
|
||||
+
|
||||
+ if (p.p_tdev == NODEV) {
|
||||
+ /* XXXJDM nasty hack */
|
||||
+ memcpy (P->tty_text, "/dev/ttyE4", sizeof P->tty_text);
|
||||
+ }
|
||||
+
|
||||
+ if (P->pid != pid) {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+gboolean
|
||||
+ck_process_stat_new_for_unix_pid (pid_t pid,
|
||||
+ CkProcessStat **stat,
|
||||
+ GError **error)
|
||||
+{
|
||||
+ gboolean res;
|
||||
+ CkProcessStat *proc;
|
||||
+
|
||||
+ g_debug ("ck_process_stat_new_for_unix_pid");
|
||||
+
|
||||
+ g_return_val_if_fail (pid > 1, FALSE);
|
||||
+
|
||||
+ if (stat == NULL) {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ proc = g_new0 (CkProcessStat, 1);
|
||||
+ proc->pid = pid;
|
||||
+ res = stat2proc (pid, proc);
|
||||
+ if (res) {
|
||||
+ *stat = proc;
|
||||
+ } else {
|
||||
+ *stat = NULL;
|
||||
+ }
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+ck_process_stat_free (CkProcessStat *stat)
|
||||
+{
|
||||
+ g_free (stat);
|
||||
+}
|
||||
+
|
||||
+GHashTable *
|
||||
+ck_unix_pid_get_env_hash (pid_t pid)
|
||||
+{
|
||||
+ GHashTable *hash;
|
||||
+ char **penv;
|
||||
+ kvm_t *kd;
|
||||
+ struct kinfo_proc2 p;
|
||||
+ int i;
|
||||
+
|
||||
+ kd = kvm_openfiles (_PATH_DEVNULL, _PATH_DEVNULL, NULL, O_RDONLY, NULL);
|
||||
+ if (kd == NULL) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (! get_kinfo_proc (pid, &p)) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ penv = kvm_getenvv2 (kd, &p, 0);
|
||||
+ if (penv == NULL) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ hash = g_hash_table_new_full (g_str_hash,
|
||||
+ g_str_equal,
|
||||
+ g_free,
|
||||
+ g_free);
|
||||
+
|
||||
+ for (i = 0; penv[i] != NULL; i++) {
|
||||
+ char **vals;
|
||||
+
|
||||
+ vals = g_strsplit (penv[i], "=", 2);
|
||||
+ if (vals != NULL) {
|
||||
+ g_hash_table_insert (hash,
|
||||
+ g_strdup (vals[0]),
|
||||
+ g_strdup (vals[1]));
|
||||
+ g_strfreev (vals);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ kvm_close (kd);
|
||||
+
|
||||
+ return hash;
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+ck_unix_pid_get_env (pid_t pid,
|
||||
+ const char *var)
|
||||
+{
|
||||
+ GHashTable *hash;
|
||||
+ char *val;
|
||||
+
|
||||
+ /*
|
||||
+ * Would probably be more efficient to just loop through the
|
||||
+ * environment and return the value, avoiding building the hash
|
||||
+ * table, but this works for now.
|
||||
+ */
|
||||
+ hash = ck_unix_pid_get_env_hash (pid);
|
||||
+ val = g_strdup (g_hash_table_lookup (hash, var));
|
||||
+ g_hash_table_destroy (hash);
|
||||
+
|
||||
+ return val;
|
||||
+}
|
||||
+
|
||||
+uid_t
|
||||
+ck_unix_pid_get_uid (pid_t pid)
|
||||
+{
|
||||
+ uid_t uid;
|
||||
+ gboolean res;
|
||||
+ struct kinfo_proc2 p;
|
||||
+
|
||||
+ g_return_val_if_fail (pid > 1, 0);
|
||||
+
|
||||
+ uid = -1;
|
||||
+
|
||||
+ res = get_kinfo_proc (pid, &p);
|
||||
+
|
||||
+ if (res) {
|
||||
+ uid = p.p_uid;
|
||||
+ }
|
||||
+
|
||||
+ return uid;
|
||||
+}
|
||||
+
|
||||
+gboolean
|
||||
+ck_unix_pid_get_login_session_id (pid_t pid,
|
||||
+ char **idp)
|
||||
+{
|
||||
+ g_return_val_if_fail (pid > 1, FALSE);
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+gboolean
|
||||
+ck_get_max_num_consoles (guint *num)
|
||||
+{
|
||||
+ /* XXXJDM how can we find out how many are configured? */
|
||||
+ if (num != NULL) {
|
||||
+ *num = 8;
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+ck_get_console_device_for_num (guint num)
|
||||
+{
|
||||
+ char *device;
|
||||
+
|
||||
+ /* The device number is always one less than the VT number. */
|
||||
+ num--;
|
||||
+
|
||||
+ device = g_strdup_printf ("/dev/ttyE%u", num);
|
||||
+
|
||||
+ return device;
|
||||
+}
|
||||
+
|
||||
+gboolean
|
||||
+ck_get_console_num_from_device (const char *device,
|
||||
+ guint *num)
|
||||
+{
|
||||
+ guint n;
|
||||
+ gboolean ret;
|
||||
+
|
||||
+ n = 0;
|
||||
+ ret = FALSE;
|
||||
+
|
||||
+ if (device == NULL) {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if (sscanf (device, "/dev/ttyE%u", &n) == 1) {
|
||||
+ /* The VT number is always one more than the device number. */
|
||||
+ n++;
|
||||
+ ret = TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if (num != NULL) {
|
||||
+ *num = n;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+gboolean
|
||||
+ck_get_active_console_num (int console_fd,
|
||||
+ guint *num)
|
||||
+{
|
||||
+ gboolean ret;
|
||||
+ int res;
|
||||
+ int active;
|
||||
+
|
||||
+ g_assert (console_fd != -1);
|
||||
+
|
||||
+ active = 0;
|
||||
+ ret = FALSE;
|
||||
+
|
||||
+ res = ioctl (console_fd, VT_GETACTIVE, &active);
|
||||
+ if (res == ERROR) {
|
||||
+ perror ("ioctl VT_GETACTIVE");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ g_debug ("Active VT is: %d (ttyE%d)", active, active - 1);
|
||||
+ ret = TRUE;
|
||||
+
|
||||
+ out:
|
||||
+ if (num != NULL) {
|
||||
+ *num = active;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
47
sysutils/consolekit/patches/patch-src_ck-sysdeps-unix_c
Normal file
47
sysutils/consolekit/patches/patch-src_ck-sysdeps-unix_c
Normal file
@ -0,0 +1,47 @@
|
||||
$OpenBSD: patch-src_ck-sysdeps-unix_c,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
--- src/ck-sysdeps-unix.c.orig Sun May 31 19:27:59 2009
|
||||
+++ src/ck-sysdeps-unix.c Sun May 31 19:40:26 2009
|
||||
@@ -35,6 +35,11 @@
|
||||
#include <linux/kd.h>
|
||||
#endif
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+#include <dev/wscons/wsdisplay_usl_io.h>
|
||||
+#include <sys/un.h>
|
||||
+#endif
|
||||
+
|
||||
#ifdef HAVE_SYS_VT_H
|
||||
#include <sys/vt.h>
|
||||
#endif
|
||||
@@ -126,7 +131,7 @@ ck_get_socket_peer_credentials (int socket_fd,
|
||||
gboolean
|
||||
ck_fd_is_a_console (int fd)
|
||||
{
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__OpenBSD__)
|
||||
struct vt_stat vts;
|
||||
#elif defined(__FreeBSD__)
|
||||
int vers;
|
||||
@@ -134,7 +139,7 @@ ck_fd_is_a_console (int fd)
|
||||
int kb_ok;
|
||||
|
||||
errno = 0;
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__OpenBSD__)
|
||||
kb_ok = (ioctl (fd, VT_GETSTATE, &vts) == 0);
|
||||
#elif defined(__FreeBSD__)
|
||||
kb_ok = (ioctl (fd, CONS_GETVERS, &vers) == 0);
|
||||
@@ -182,6 +187,13 @@ ck_get_a_console_fd (void)
|
||||
if (fd >= 0) {
|
||||
goto done;
|
||||
}
|
||||
+#endif
|
||||
+
|
||||
+#if defined(__OpenBSD__)
|
||||
+ fd = open_a_console ("/dev/ttyC0");
|
||||
+ if (fd >= 0) {
|
||||
+ goto done;
|
||||
+ }
|
||||
#endif
|
||||
|
||||
#ifdef _PATH_TTY
|
14
sysutils/consolekit/patches/patch-src_ck-sysdeps_h
Normal file
14
sysutils/consolekit/patches/patch-src_ck-sysdeps_h
Normal file
@ -0,0 +1,14 @@
|
||||
$OpenBSD: patch-src_ck-sysdeps_h,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
--- src/ck-sysdeps.h.orig Sat May 30 23:01:14 2009
|
||||
+++ src/ck-sysdeps.h Sat May 30 23:01:57 2009
|
||||
@@ -23,6 +23,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+#ifndef ENOTSUP
|
||||
+#define ENOTSUP EOPNOTSUPP
|
||||
+#endif
|
||||
+
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
4
sysutils/consolekit/pkg/DESCR
Normal file
4
sysutils/consolekit/pkg/DESCR
Normal file
@ -0,0 +1,4 @@
|
||||
ConsoleKit is a framework for defining and tracking users, login
|
||||
sessions, and seats. The primary motivations for this framework are to
|
||||
facilitate fast-user-switching and multi-seat capabilities, and to
|
||||
enable more sophisticated policy decisions for desktop sessions.
|
2
sysutils/consolekit/pkg/PFRAG.shared
Normal file
2
sysutils/consolekit/pkg/PFRAG.shared
Normal file
@ -0,0 +1,2 @@
|
||||
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
@lib lib/libck-connector.so.${LIBck-connector_VERSION}
|
50
sysutils/consolekit/pkg/PLIST
Normal file
50
sysutils/consolekit/pkg/PLIST
Normal file
@ -0,0 +1,50 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
|
||||
%%SHARED%%
|
||||
@bin bin/ck-history
|
||||
@bin bin/ck-launch-session
|
||||
@bin bin/ck-list-sessions
|
||||
include/ConsoleKit/
|
||||
include/ConsoleKit/ck-connector/
|
||||
include/ConsoleKit/ck-connector/ck-connector.h
|
||||
lib/ConsoleKit/
|
||||
lib/ConsoleKit/run-session.d/
|
||||
lib/libck-connector.a
|
||||
lib/libck-connector.la
|
||||
lib/pkgconfig/
|
||||
lib/pkgconfig/ck-connector.pc
|
||||
@bin libexec/ck-collect-session-info
|
||||
@bin libexec/ck-get-x11-display-device
|
||||
@bin libexec/ck-get-x11-server-pid
|
||||
@bin sbin/ck-log-system-restart
|
||||
@bin sbin/ck-log-system-start
|
||||
@bin sbin/ck-log-system-stop
|
||||
@bin sbin/console-kit-daemon
|
||||
share/PolicyKit/
|
||||
share/PolicyKit/policy/
|
||||
share/PolicyKit/policy/org.freedesktop.consolekit.policy
|
||||
share/dbus-1/
|
||||
share/dbus-1/interfaces/
|
||||
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Manager.xml
|
||||
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Seat.xml
|
||||
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Session.xml
|
||||
share/dbus-1/system-services/
|
||||
share/dbus-1/system-services/org.freedesktop.ConsoleKit.service
|
||||
share/examples/consolekit/
|
||||
share/examples/consolekit/ConsoleKit/
|
||||
@sample ${SYSCONFDIR}/ConsoleKit/
|
||||
share/examples/consolekit/ConsoleKit/run-session.d/
|
||||
@sample ${SYSCONFDIR}/ConsoleKit/run-session.d/
|
||||
share/examples/consolekit/ConsoleKit/seats.d/
|
||||
@sample ${SYSCONFDIR}/ConsoleKit/seats.d/
|
||||
share/examples/consolekit/ConsoleKit/seats.d/00-primary.seat
|
||||
@sample ${SYSCONFDIR}/ConsoleKit/seats.d/00-primary.seat
|
||||
share/examples/consolekit/dbus-1/
|
||||
@sample ${SYSCONFDIR}/dbus-1/
|
||||
share/examples/consolekit/dbus-1/ConsoleKit.conf
|
||||
@sample ${SYSCONFDIR}/dbus-1/system.d/ConsoleKit.conf
|
||||
var/
|
||||
var/log/
|
||||
var/log/ConsoleKit/
|
||||
var/run/
|
||||
var/run/ConsoleKit/
|
||||
@exec ${PREFIX}/bin/dbus-uuidgen --ensure
|
Loading…
Reference in New Issue
Block a user