diff options
author | Florent Thoumie <flz@FreeBSD.org> | 2007-08-25 17:08:20 +0100 |
---|---|---|
committer | Florent Thoumie <flz@FreeBSD.org> | 2007-08-25 17:08:20 +0100 |
commit | 342f4d1b60850daad422bd683978a88cb6a7eed7 (patch) | |
tree | c027328d454bc357036a239e162095ac2573f567 /src/ck-vt-monitor.c | |
parent | f19761b0e2e6649836d3514fbd007b9365756f32 (diff) |
First attempt a making ConsoleKit work on FreeBSD
- Add some ifdef's to make the code compile.
- Add ck-sysdeps-freebsd.c, based on the Linux version, which
means it's using linprocfs right now.
Signed-off-by: Florent Thoumie <flz@FreeBSD.org>
Diffstat (limited to 'src/ck-vt-monitor.c')
-rw-r--r-- | src/ck-vt-monitor.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ck-vt-monitor.c b/src/ck-vt-monitor.c index 5c37a64..f71b7b5 100644 --- a/src/ck-vt-monitor.c +++ b/src/ck-vt-monitor.c @@ -27,7 +27,11 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> +#if defined(__linux__) #include <sys/vt.h> +#elif defined(__FreeBSD__) +#include <sys/consio.h> +#endif #include <glib.h> #include <glib/gi18n.h> @@ -390,18 +394,25 @@ static guint get_active_native (CkVtMonitor *vt_monitor) { int ret; + int active; +#if defined(__linux__) struct vt_stat stat; ret = ioctl (vt_monitor->priv->vfd, VT_GETSTATE, &stat); +#elif defined(__FreeBSD__) + ret = ioctl (vt_monitor->priv->vfd, VT_GETACTIVE, &active); +#endif if (ret == ERROR) { perror ("ioctl VT_GETSTATE"); return -1; } + g_debug ("Current VT: tty%d", active); + +#if defined(__linux__) { int i; - g_debug ("Current VT: tty%d", stat.v_active); for (i = 1; i <= 16; i++) { gboolean is_on; is_on = stat.v_state & (1 << i); @@ -409,8 +420,9 @@ get_active_native (CkVtMonitor *vt_monitor) g_debug ("VT %d:%s", i, is_on ? "on" : "off"); } } +#endif - return stat.v_active; + return active; } static void |