theme.h \
user.c \
user.h \
+ vt.c \
+ vt.h \
xauth.c \
xauth.h \
xdmcp-protocol.c \
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
#include <xcb/xcb.h>
#include <fcntl.h>
-#include <glib/gstdio.h>
-#include <sys/ioctl.h>
-#ifdef __linux__
-#include <linux/vt.h>
-#endif
#include "display-manager.h"
#include "configuration.h"
#include "user.h"
#include "xdmcp-server.h"
#include "xserver.h"
+#include "vt.h"
#include "theme.h"
enum {
}
}
-static gint
-vt_get_active ()
-{
-#ifdef __linux__
- gint console_fd;
- struct vt_stat console_state = { 0 };
-
- console_fd = g_open ("/dev/console", O_RDONLY | O_NOCTTY);
- if (console_fd < 0)
- {
- g_warning ("Error opening /dev/console: %s", strerror (errno));
- return -1;
- }
-
- if (ioctl (console_fd, VT_GETSTATE, &console_state) < 0)
- g_warning ("Error using VT_GETSTATE on /dev/console: %s", strerror (errno));
-
- close (console_fd);
-
- return console_state.v_active;
-#else
- return -1;
-#endif
-}
-
-static gint
-vt_get_unused ()
-{
-#ifdef __linux__
- gint console_fd;
- int number;
-
- console_fd = g_open ("/dev/console", O_RDONLY | O_NOCTTY);
- if (console_fd < 0)
- {
- g_warning ("Error opening /dev/console: %s", strerror (errno));
- return -1;
- }
-
- if (ioctl (console_fd, VT_OPENQRY, &number) < 0)
- g_warning ("Error using VT_OPENQRY on /dev/console: %s", strerror (errno));
-
- close (console_fd);
-
- return number;
-#else
- return -1;
-#endif
-}
-
static XServer *
make_xserver (DisplayManager *manager, gchar *config_section)
{
--- /dev/null
+/*
+ * Copyright (C) 2010-2011 Robert Ancell.
+ * Author: Robert Ancell <robert.ancell@canonical.com>
+ *
+ * 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 3 of the License, or (at your option) any later
+ * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
+ * license.
+ */
+
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <glib/gstdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#ifdef __linux__
+#include <linux/vt.h>
+#endif
+
+#include "vt.h"
+
+gint
+vt_get_active (void)
+{
+#ifdef __linux__
+ gint console_fd;
+ struct vt_stat console_state = { 0 };
+
+ console_fd = g_open ("/dev/console", O_RDONLY | O_NOCTTY);
+ if (console_fd < 0)
+ {
+ g_warning ("Error opening /dev/console: %s", strerror (errno));
+ return -1;
+ }
+
+ if (ioctl (console_fd, VT_GETSTATE, &console_state) < 0)
+ g_warning ("Error using VT_GETSTATE on /dev/console: %s", strerror (errno));
+
+ close (console_fd);
+
+ return console_state.v_active;
+#else
+ return -1;
+#endif
+}
+
+gint
+vt_get_unused (void)
+{
+#ifdef __linux__
+ gint console_fd;
+ int number;
+
+ console_fd = g_open ("/dev/console", O_RDONLY | O_NOCTTY);
+ if (console_fd < 0)
+ {
+ g_warning ("Error opening /dev/console: %s", strerror (errno));
+ return -1;
+ }
+
+ if (ioctl (console_fd, VT_OPENQRY, &number) < 0)
+ g_warning ("Error using VT_OPENQRY on /dev/console: %s", strerror (errno));
+
+ close (console_fd);
+
+ return number;
+#else
+ return -1;
+#endif
+}
+
+void
+vt_release (gint number)
+{
+}
--- /dev/null
+/*
+ * Copyright (C) 2010-2011 Robert Ancell.
+ * Author: Robert Ancell <robert.ancell@canonical.com>
+ *
+ * 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 3 of the License, or (at your option) any later
+ * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
+ * license.
+ */
+
+#ifndef _VT_H_
+#define _VT_H_
+
+#include <glib.h>
+
+gint vt_get_active (void);
+
+gint vt_get_unused (void);
+
+void vt_release (gint number);
+
+#endif /* _VT_H_ */