head 1.4; access; symbols pkgsrc-2016Q1:1.3.0.14 pkgsrc-2016Q1-base:1.3 pkgsrc-2015Q4:1.3.0.12 pkgsrc-2015Q4-base:1.3 pkgsrc-2015Q3:1.3.0.10 pkgsrc-2015Q3-base:1.3 pkgsrc-2015Q2:1.3.0.8 pkgsrc-2015Q2-base:1.3 pkgsrc-2015Q1:1.3.0.6 pkgsrc-2015Q1-base:1.3 pkgsrc-2014Q4:1.3.0.4 pkgsrc-2014Q4-base:1.3 pkgsrc-2014Q3:1.3.0.2 pkgsrc-2014Q3-base:1.3 pkgsrc-2014Q2:1.2.0.46 pkgsrc-2014Q2-base:1.2 pkgsrc-2014Q1:1.2.0.44 pkgsrc-2014Q1-base:1.2 pkgsrc-2013Q4:1.2.0.42 pkgsrc-2013Q4-base:1.2 pkgsrc-2013Q3:1.2.0.40 pkgsrc-2013Q3-base:1.2 pkgsrc-2013Q2:1.2.0.38 pkgsrc-2013Q2-base:1.2 pkgsrc-2013Q1:1.2.0.36 pkgsrc-2013Q1-base:1.2 pkgsrc-2012Q4:1.2.0.34 pkgsrc-2012Q4-base:1.2 pkgsrc-2012Q3:1.2.0.32 pkgsrc-2012Q3-base:1.2 pkgsrc-2012Q2:1.2.0.30 pkgsrc-2012Q2-base:1.2 pkgsrc-2012Q1:1.2.0.28 pkgsrc-2012Q1-base:1.2 pkgsrc-2011Q4:1.2.0.26 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q3:1.2.0.24 pkgsrc-2011Q3-base:1.2 pkgsrc-2011Q2:1.2.0.22 pkgsrc-2011Q2-base:1.2 pkgsrc-2011Q1:1.2.0.20 pkgsrc-2011Q1-base:1.2 pkgsrc-2010Q4:1.2.0.18 pkgsrc-2010Q4-base:1.2 pkgsrc-2010Q3:1.2.0.16 pkgsrc-2010Q3-base:1.2 pkgsrc-2010Q2:1.2.0.14 pkgsrc-2010Q2-base:1.2 pkgsrc-2010Q1:1.2.0.12 pkgsrc-2010Q1-base:1.2 pkgsrc-2009Q4:1.2.0.10 pkgsrc-2009Q4-base:1.2 pkgsrc-2009Q3:1.2.0.8 pkgsrc-2009Q3-base:1.2 pkgsrc-2009Q2:1.2.0.6 pkgsrc-2009Q2-base:1.2 pkgsrc-2009Q1:1.2.0.4 pkgsrc-2009Q1-base:1.2 pkgsrc-2008Q4:1.2.0.2 pkgsrc-2008Q4-base:1.2; locks; strict; comment @# @; 1.4 date 2016.06.18.10.23.17; author youri; state dead; branches; next 1.3; commitid Q2pAwvWgWv35YVaz; 1.3 date 2014.08.17.15.59.07; author wiz; state Exp; branches; next 1.2; commitid wI8AuamsPZBGoJMx; 1.2 date 2008.12.26.20.05.56; author hasso; state Exp; branches; next 1.1; 1.1 date 2008.11.25.13.40.05; author hasso; state Exp; branches; next ; desc @@ 1.4 log @consolekit: Update to 1.0.2 using ConsoleKit2, the continuation of consolekit. @ text @$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 #include #include +#include #include #include #include @@@@ -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: @ 1.3 log @Update to 0.4.5. Add comments to patches. ============== Version 0.4.4 ============== * systemd fixes (Lennart Poettering) ============== Version 0.4.3 ============== * Revert VT_WAITEVENT usage, since it is racy (Lennart Poettering) * systemd fixes (Lennart Poettering) ============== Version 0.4.2 ============== * Ensure we only care for seat files ending in .seat (William Jon McCann) * Various Solaris improvements (Halton Huo) * Make build silent (Ray Strode) * Don't take bus name until ready (Ray Strode) * systemd hookup (Lennart Poettering) * add --since option to ck-history (William Jon McCann) * Reduce number of threads on Linux (Kan-Ru Chen) * Other fixes (Anders Kaseor, Frederic Crozat, Matthias Clasen, Michael Biebl, William Jon McCann) ============== Version 0.4.1 ============== * Fix a crasher (William Jon McCann) * fix a small memory leak (Matthias Clasen) * update email address (William Jon McCann) ============== Version 0.4.0 ============== * Starting with this release we will not do session.d/ 'session_active_changed' callouts anymore. (Lennart Poettering) * get rid of session.d's session_active_changed callout (Lennart Poettering) * close file descriptors before exit func (Halton Huo) * log the kernel release and boot arguments at start time (William Jon McCann) * show display in host field if the host isn't set (William Jon McCann) * print the uptime for the reboot items in the report (William Jon McCann) * fix logic for finding session remove events (William Jon McCann) * fix a few small leaks (William Jon McCann) * Add seat.d/ callout directory and guarantee we dump the database before call * database: write the console database to disk before signalling via dbus (Len * Enforce that the env array has the right size (Lennart Poettering) * when printing size_t use %z format string (Lennart Poettering) * make CK database world readable (Lennart Poettering) * get rid of ck_seat_set_active_session() prototype since no such function exi * Move ck_session_run_programs() from ck-run-programs.h to ck-session.h (Lenna * post release version bump (Ray Strode) ============== Version 0.3.1 ============== * port to PolicyKit 1.0 (Matthias Clasen) * D-Bus policy updates (Colin Walters, Martin Pitt, Vincent Untz, William Jon McCann) * better diagnostic information for unimplemented backends (Daniel Macks) * file monitoring fixes (James Westby) * get VT from X display if no controlling tty is available (Ray Strode) * add "nox11" option to PAM module (Martin Pitt) * parse log entries with no body correctly (William Jon McCann) * fix zero-sized struct/unions (William Jon McCann) * solaris build fixes (Halton Huo) * parse gecos field for real name (William Jon McCann) * leak fixes (James Westby, Steve Langasek) * compile warning fixes (Matthias Clasen) * fix doc xml validation errors (William Jon McCann) * fix doc generation when srcdir != builddir (Ray Strode) * add example upstart events for logging (William Jon McCann, Ray Strode) * fix ChangeLog generation script to work with git-log moved to libexecdir (Ray Strode) @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.2 2008/12/26 20:05:56 hasso Exp $ @ 1.2 log @* Improves a lot FreeBSD and DragonFly support (from FreeBSD ports) * Fixes two leak problems (from upstream bugzilla) * Bump PKGREVISION @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.1 2008/11/25 13:40:05 hasso Exp $ d3 4 a6 2 --- src/ck-sysdeps-freebsd.c.orig 2008-11-27 05:12:41 +0200 +++ src/ck-sysdeps-freebsd.c 2008-11-27 05:08:28 +0200 d174 2 a175 2 char * @@@@ -369,7 +412,12 @@@@ ck_get_console_device_for_num (guint num d189 1 a189 1 @@@@ -379,6 +427,7 @@@@ ck_get_console_num_from_device (const ch d197 1 a197 1 @@@@ -388,7 +437,11 @@@@ ck_get_console_num_from_device (const ch d210 1 a210 1 @@@@ -408,6 +461,7 @@@@ ck_get_active_console_num (int consol d218 1 a218 1 @@@@ -420,7 +474,12 @@@@ ck_get_active_console_num (int consol @ 1.1 log @Make it build/work in DragonFly. @ text @d1 1 a1 1 $NetBSD$ d3 11 a13 3 --- src/ck-sysdeps-freebsd.c.orig 2008-11-25 14:43:51 +0200 +++ src/ck-sysdeps-freebsd.c 2008-11-25 14:50:24 +0200 @@@@ -151,14 +151,38 @@@@ stat2proc (pid_t pid, d52 1 a52 1 @@@@ -173,19 +197,33 @@@@ stat2proc (pid_t pid, d86 17 a102 1 @@@@ -308,7 +346,11 @@@@ ck_unix_pid_get_uid (pid_t pid) d114 116 @