From 342f4d1b60850daad422bd683978a88cb6a7eed7 Mon Sep 17 00:00:00 2001 From: Florent Thoumie Date: Sat, 25 Aug 2007 17:08:20 +0100 Subject: 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 --- src/ck-vt-monitor.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/ck-vt-monitor.c') 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 #include #include +#if defined(__linux__) #include +#elif defined(__FreeBSD__) +#include +#endif #include #include @@ -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 -- cgit