summaryrefslogtreecommitdiffstats
path: root/src/ck-sysdeps-unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ck-sysdeps-unix.c')
-rw-r--r--src/ck-sysdeps-unix.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ck-sysdeps-unix.c b/src/ck-sysdeps-unix.c
index fa18dac..6c9b34c 100644
--- a/src/ck-sysdeps-unix.c
+++ b/src/ck-sysdeps-unix.c
@@ -35,6 +35,10 @@
#include <linux/kd.h>
#endif
+#ifdef __FreeBSD__
+#include <sys/consio.h>
+#endif
+
#ifdef HAVE_GETPEERUCRED
#include <ucred.h>
#endif
@@ -114,14 +118,18 @@ ck_get_socket_peer_credentials (int socket_fd,
gboolean
ck_fd_is_a_console (int fd)
{
- char arg;
+#ifdef __linux__
+ char arg = 0;
+#elif defined(__FreeBSD__)
+ int vers;
+#endif
int kb_ok;
- arg = 0;
-
#ifdef __linux__
kb_ok = (ioctl (fd, KDGKBTYPE, &arg) == 0
&& ((arg == KB_101) || (arg == KB_84)));
+#elif defined(__FreeBSD__)
+ kb_ok = (ioctl (fd, CONS_GETVERS, &vers) == 0);
#else
kb_ok = 1;
#endif