aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-07-08 18:55:24 +0000
committerEric Andersen <andersen@codepoet.org>2000-07-08 18:55:24 +0000
commitbd22ed806782eec76929bcd2ec556717e79d24c7 (patch)
treee225367aaef198eacec8ed0b530d36a9d888d92f
parent877a71bbf0b8386add4631c08f7101259ad2dc07 (diff)
downloadbusybox-bd22ed806782eec76929bcd2ec556717e79d24c7.tar.gz
Update files to reduce dependance on kernel version...
-Erik
-rw-r--r--chvt.c10
-rw-r--r--console-tools/chvt.c10
-rw-r--r--console-tools/deallocvt.c7
-rw-r--r--console-tools/loadkmap.c14
-rw-r--r--console-tools/setkeycodes.c9
-rw-r--r--coreutils/ls.c8
-rw-r--r--deallocvt.c7
-rw-r--r--dmesg.c2
-rw-r--r--fdflush.c3
-rw-r--r--init.c42
-rw-r--r--init/init.c42
-rw-r--r--insmod.c7
-rw-r--r--loadkmap.c14
-rw-r--r--ls.c8
-rw-r--r--modutils/insmod.c7
-rw-r--r--mount.c8
-rw-r--r--setkeycodes.c9
-rw-r--r--umount.c20
-rw-r--r--util-linux/dmesg.c2
-rw-r--r--util-linux/fdflush.c3
-rw-r--r--util-linux/mount.c8
-rw-r--r--util-linux/umount.c20
-rw-r--r--utility.c11
23 files changed, 184 insertions, 87 deletions
diff --git a/chvt.c b/chvt.c
index 45a04397a..c5c86b613 100644
--- a/chvt.c
+++ b/chvt.c
@@ -5,12 +5,16 @@
* busyboxed by Erik Andersen
*/
#include "internal.h"
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <linux/vt.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+/* From <linux/vt.h> */
+#define VT_ACTIVATE 0x5606 /* make vt active */
+#define VT_WAITACTIVE 0x5607 /* wait for vt active */
+
int chvt_main(int argc, char **argv)
{
diff --git a/console-tools/chvt.c b/console-tools/chvt.c
index 45a04397a..c5c86b613 100644
--- a/console-tools/chvt.c
+++ b/console-tools/chvt.c
@@ -5,12 +5,16 @@
* busyboxed by Erik Andersen
*/
#include "internal.h"
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <linux/vt.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+/* From <linux/vt.h> */
+#define VT_ACTIVATE 0x5606 /* make vt active */
+#define VT_WAITACTIVE 0x5607 /* wait for vt active */
+
int chvt_main(int argc, char **argv)
{
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index b65f7b098..0cad7717b 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -5,11 +5,14 @@
*/
#include "internal.h"
#include <stdlib.h>
+#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ioctl.h>
-#include <linux/vt.h>
-#include <stdio.h>
+
+/* From <linux/vt.h> */
+#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */
+
char *progname;
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c
index 905741467..0e8c090d2 100644
--- a/console-tools/loadkmap.c
+++ b/console-tools/loadkmap.c
@@ -24,10 +24,20 @@
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
-#include <linux/kd.h>
-#include <linux/keyboard.h>
#include <sys/ioctl.h>
+/* From <linux/kd.h> */
+struct kbentry {
+ unsigned char kb_table;
+ unsigned char kb_index;
+ unsigned short kb_value;
+};
+#define KDSKBENT 0x4B47 /* sets one entry in translation table */
+
+/* From <linux/keyboard.h> */
+#define NR_KEYS 128
+#define MAX_NR_KEYMAPS 256
+
static const char loadkmap_usage[] = "loadkmap\n"
#ifndef BB_FEATURE_TRIVIAL_HELP
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c
index 9062caf75..1bdb909ea 100644
--- a/console-tools/setkeycodes.c
+++ b/console-tools/setkeycodes.c
@@ -27,7 +27,14 @@
#include <stdlib.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <linux/kd.h>
+
+
+/* From <linux/kd.h> */
+struct kbkeycode {
+ unsigned int scancode, keycode;
+};
+#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */
+
static const char setkeycodes_usage[] =
"setkeycodes SCANCODE KEYCODE ...\n"
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 75fa65421..98ccbeddb 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -49,11 +49,11 @@
/************************************************************************/
#include "internal.h"
-#if !defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
-# include <linux/types.h>
-#else
+//#if !defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
+//# include <linux/types.h>
+//#else
# include <sys/types.h>
-#endif
+//#endif
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/deallocvt.c b/deallocvt.c
index b65f7b098..0cad7717b 100644
--- a/deallocvt.c
+++ b/deallocvt.c
@@ -5,11 +5,14 @@
*/
#include "internal.h"
#include <stdlib.h>
+#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ioctl.h>
-#include <linux/vt.h>
-#include <stdio.h>
+
+/* From <linux/vt.h> */
+#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */
+
char *progname;
diff --git a/dmesg.c b/dmesg.c
index 20846f7c6..e88f549ca 100644
--- a/dmesg.c
+++ b/dmesg.c
@@ -16,7 +16,6 @@
*/
#include "internal.h"
-#include <linux/unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -24,6 +23,7 @@
#ifndef __alpha__
# define __NR_klogctl __NR_syslog
+#include <linux/unistd.h>
static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
#else /* __alpha__ */
#define klogctl syslog
diff --git a/fdflush.c b/fdflush.c
index 81f0472c6..d9937355f 100644
--- a/fdflush.c
+++ b/fdflush.c
@@ -24,9 +24,10 @@
#include "internal.h"
#include <stdio.h>
#include <sys/ioctl.h>
-#include <linux/fd.h>
#include <fcntl.h>
+/* From <linux/fd.h> */
+#define FDFLUSH _IO(2,0x4b)
extern int fdflush_main(int argc, char **argv)
{
diff --git a/init.c b/init.c
index 35f2255b5..b368c00ed 100644
--- a/init.c
+++ b/init.c
@@ -37,12 +37,6 @@
#include <string.h>
#include <termios.h>
#include <unistd.h>
-#include <asm/types.h>
-#include <linux/serial.h> /* for serial_struct */
-#include <linux/version.h>
-#include <linux/reboot.h>
-#include <linux/unistd.h>
-#include <linux/vt.h> /* for vt_stat */
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
@@ -52,6 +46,33 @@
# include <sys/syslog.h>
#endif
+/* From <linux/vt.h> */
+struct vt_stat {
+ unsigned short v_active; /* active vt */
+ unsigned short v_signal; /* signal to send */
+ unsigned short v_state; /* vt bitmask */
+};
+#define VT_GETSTATE 0x5603 /* get global vt state info */
+
+/* From <linux/serial.h> */
+struct serial_struct {
+ int type;
+ int line;
+ int port;
+ int irq;
+ int flags;
+ int xmit_fifo_size;
+ int custom_divisor;
+ int baud_base;
+ unsigned short close_delay;
+ char reserved_char[2];
+ int hub6;
+ unsigned short closing_wait; /* time to wait before closing */
+ unsigned short closing_wait2; /* no longer used... */
+ int reserved[4];
+};
+
+
#ifndef RB_HALT_SYSTEM
#define RB_HALT_SYSTEM 0xcdef0123
@@ -84,13 +105,12 @@
#include <sys/time.h>
#endif
-#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#endif
#if defined(__GLIBC__)
#include <sys/kdaemon.h>
#else
+#include <linux/unistd.h> /* for _syscall() macro */
static _syscall2(int, bdflush, int, func, int, data);
#endif /* __GLIBC__ */
@@ -568,7 +588,7 @@ static void shutdown_system(void)
run_lastAction();
sync();
- if (kernelVersion > 0 && kernelVersion <= 2 * 65536 + 2 * 256 + 11) {
+ if (kernelVersion > 0 && kernelVersion <= KERNEL_VERSION(2,2,11)) {
/* bdflush, kupdate not needed for kernels >2.2.11 */
bdflush(1, 0);
sync();
@@ -587,11 +607,9 @@ static void halt_signal(int sig)
/* allow time for last message to reach serial console */
sleep(2);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
- if (sig == SIGUSR2)
+ if (sig == SIGUSR2 && kernelVersion >= KERNEL_VERSION(2,2,0))
init_reboot(RB_POWER_OFF);
else
-#endif
init_reboot(RB_HALT_SYSTEM);
exit(0);
}
diff --git a/init/init.c b/init/init.c
index 35f2255b5..b368c00ed 100644
--- a/init/init.c
+++ b/init/init.c
@@ -37,12 +37,6 @@
#include <string.h>
#include <termios.h>
#include <unistd.h>
-#include <asm/types.h>
-#include <linux/serial.h> /* for serial_struct */
-#include <linux/version.h>
-#include <linux/reboot.h>
-#include <linux/unistd.h>
-#include <linux/vt.h> /* for vt_stat */
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
@@ -52,6 +46,33 @@
# include <sys/syslog.h>
#endif
+/* From <linux/vt.h> */
+struct vt_stat {
+ unsigned short v_active; /* active vt */
+ unsigned short v_signal; /* signal to send */
+ unsigned short v_state; /* vt bitmask */
+};
+#define VT_GETSTATE 0x5603 /* get global vt state info */
+
+/* From <linux/serial.h> */
+struct serial_struct {
+ int type;
+ int line;
+ int port;
+ int irq;
+ int flags;
+ int xmit_fifo_size;
+ int custom_divisor;
+ int baud_base;
+ unsigned short close_delay;
+ char reserved_char[2];
+ int hub6;
+ unsigned short closing_wait; /* time to wait before closing */
+ unsigned short closing_wait2; /* no longer used... */
+ int reserved[4];
+};
+
+
#ifndef RB_HALT_SYSTEM
#define RB_HALT_SYSTEM 0xcdef0123
@@ -84,13 +105,12 @@
#include <sys/time.h>
#endif
-#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#endif
#if defined(__GLIBC__)
#include <sys/kdaemon.h>
#else
+#include <linux/unistd.h> /* for _syscall() macro */
static _syscall2(int, bdflush, int, func, int, data);
#endif /* __GLIBC__ */
@@ -568,7 +588,7 @@ static void shutdown_system(void)
run_lastAction();
sync();
- if (kernelVersion > 0 && kernelVersion <= 2 * 65536 + 2 * 256 + 11) {
+ if (kernelVersion > 0 && kernelVersion <= KERNEL_VERSION(2,2,11)) {
/* bdflush, kupdate not needed for kernels >2.2.11 */
bdflush(1, 0);
sync();
@@ -587,11 +607,9 @@ static void halt_signal(int sig)
/* allow time for last message to reach serial console */
sleep(2);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
- if (sig == SIGUSR2)
+ if (sig == SIGUSR2 && kernelVersion >= KERNEL_VERSION(2,2,0))
init_reboot(RB_POWER_OFF);
else
-#endif
init_reboot(RB_HALT_SYSTEM);
exit(0);
}
diff --git a/insmod.c b/insmod.c
index 006468877..75058b959 100644
--- a/insmod.c
+++ b/insmod.c
@@ -71,7 +71,7 @@
#ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1
-#ident "$Id: insmod.c,v 1.11 2000/06/26 11:16:22 andersen Exp $"
+#ident "$Id: insmod.c,v 1.12 2000/07/08 18:55:24 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -277,7 +277,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1
-#ident "$Id: insmod.c,v 1.11 2000/06/26 11:16:22 andersen Exp $"
+#ident "$Id: insmod.c,v 1.12 2000/07/08 18:55:24 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -530,6 +530,9 @@ _syscall2(int, new_sys_init_module, const char *, name,
_syscall5(int, old_sys_init_module, const char *, name, char *, code,
unsigned, codesize, struct old_mod_routines *, routines,
struct old_symbol_table *, symtab)
+#ifndef __NR_query_module
+#define __NR_query_module 167
+#endif
_syscall5(int, query_module, const char *, name, int, which,
void *, buf, size_t, bufsize, size_t*, ret);
#ifndef BB_RMMOD
diff --git a/loadkmap.c b/loadkmap.c
index 905741467..0e8c090d2 100644
--- a/loadkmap.c
+++ b/loadkmap.c
@@ -24,10 +24,20 @@
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
-#include <linux/kd.h>
-#include <linux/keyboard.h>
#include <sys/ioctl.h>
+/* From <linux/kd.h> */
+struct kbentry {
+ unsigned char kb_table;
+ unsigned char kb_index;
+ unsigned short kb_value;
+};
+#define KDSKBENT 0x4B47 /* sets one entry in translation table */
+
+/* From <linux/keyboard.h> */
+#define NR_KEYS 128
+#define MAX_NR_KEYMAPS 256
+
static const char loadkmap_usage[] = "loadkmap\n"
#ifndef BB_FEATURE_TRIVIAL_HELP
diff --git a/ls.c b/ls.c
index 75fa65421..98ccbeddb 100644
--- a/ls.c
+++ b/ls.c
@@ -49,11 +49,11 @@
/************************************************************************/
#include "internal.h"
-#if !defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
-# include <linux/types.h>
-#else
+//#if !defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
+//# include <linux/types.h>
+//#else
# include <sys/types.h>
-#endif
+//#endif
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 006468877..75058b959 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -71,7 +71,7 @@
#ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1
-#ident "$Id: insmod.c,v 1.11 2000/06/26 11:16:22 andersen Exp $"
+#ident "$Id: insmod.c,v 1.12 2000/07/08 18:55:24 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -277,7 +277,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1
-#ident "$Id: insmod.c,v 1.11 2000/06/26 11:16:22 andersen Exp $"
+#ident "$Id: insmod.c,v 1.12 2000/07/08 18:55:24 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -530,6 +530,9 @@ _syscall2(int, new_sys_init_module, const char *, name,
_syscall5(int, old_sys_init_module, const char *, name, char *, code,
unsigned, codesize, struct old_mod_routines *, routines,
struct old_symbol_table *, symtab)
+#ifndef __NR_query_module
+#define __NR_query_module 167
+#endif
_syscall5(int, query_module, const char *, name, int, which,
void *, buf, size_t, bufsize, size_t*, ret);
#ifndef BB_RMMOD
diff --git a/mount.c b/mount.c
index 76f048b1c..01e9b3d67 100644
--- a/mount.c
+++ b/mount.c
@@ -48,15 +48,17 @@
#if defined BB_FEATURE_USE_DEVPS_PATCH
#include <linux/devmtab.h>
#endif
-#ifndef MS_RDONLY
-#include <linux/fs.h>
+
+/* 2.0.x. kernels don't know about MS_NODIRATIME */
+#ifndef MS_NODIRATIME
+#define MS_NODIRATIME 2048 /* Do not update directory access times */
#endif
+
#if defined BB_FEATURE_MOUNT_LOOP
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <linux/loop.h>
static int use_loop = FALSE;
diff --git a/setkeycodes.c b/setkeycodes.c
index 9062caf75..1bdb909ea 100644
--- a/setkeycodes.c
+++ b/setkeycodes.c
@@ -27,7 +27,14 @@
#include <stdlib.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <linux/kd.h>
+
+
+/* From <linux/kd.h> */
+struct kbkeycode {
+ unsigned int scancode, keycode;
+};
+#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */
+
static const char setkeycodes_usage[] =
"setkeycodes SCANCODE KEYCODE ...\n"
diff --git a/umount.c b/umount.c
index 61f7f9028..d790d68ff 100644
--- a/umount.c
+++ b/umount.c
@@ -26,20 +26,20 @@
#include <stdio.h>
#include <mntent.h>
#include <errno.h>
+#include <sys/mount.h>
#include <linux/unistd.h>
-//#include <sys/mount.h>
-/* Include our own version of sys/mount.h, since libc5 doesn't
- * know about umount2 */
-static _syscall1(int, umount, const char *, special_file);
-static _syscall2(int, umount2, const char *, special_file, int, flags);
-static _syscall5(int, mount, const char *, special_file, const char *, dir,
- const char *, fstype, unsigned long int, rwflag, const void *, data);
+/* Include our own version of umount2 if we need it... */
+#ifndef __NR_umount2
+#define __NR_umount2 52
#define MNT_FORCE 1
-#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */
-#define MS_REMOUNT 32 /* Alter flags of a mounted FS. */
-#define MS_RDONLY 1 /* Mount read-only. */
+#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */
+#define MS_REMOUNT 32 /* Alter flags of a mounted FS. */
+#define MS_RDONLY 1 /* Mount read-only. */
+
+#endif
+static _syscall2(int, umount2, const char *, special_file, int, flags);
static const char umount_usage[] =
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 20846f7c6..e88f549ca 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -16,7 +16,6 @@
*/
#include "internal.h"
-#include <linux/unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -24,6 +23,7 @@
#ifndef __alpha__
# define __NR_klogctl __NR_syslog
+#include <linux/unistd.h>
static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
#else /* __alpha__ */
#define klogctl syslog
diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c
index 81f0472c6..d9937355f 100644
--- a/util-linux/fdflush.c
+++ b/util-linux/fdflush.c
@@ -24,9 +24,10 @@
#include "internal.h"
#include <stdio.h>
#include <sys/ioctl.h>
-#include <linux/fd.h>
#include <fcntl.h>
+/* From <linux/fd.h> */
+#define FDFLUSH _IO(2,0x4b)
extern int fdflush_main(int argc, char **argv)
{
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 76f048b1c..01e9b3d67 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -48,15 +48,17 @@
#if defined BB_FEATURE_USE_DEVPS_PATCH
#include <linux/devmtab.h>
#endif
-#ifndef MS_RDONLY
-#include <linux/fs.h>
+
+/* 2.0.x. kernels don't know about MS_NODIRATIME */
+#ifndef MS_NODIRATIME
+#define MS_NODIRATIME 2048 /* Do not update directory access times */
#endif
+
#if defined BB_FEATURE_MOUNT_LOOP
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <linux/loop.h>
static int use_loop = FALSE;
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 61f7f9028..d790d68ff 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -26,20 +26,20 @@
#include <stdio.h>
#include <mntent.h>
#include <errno.h>
+#include <sys/mount.h>
#include <linux/unistd.h>
-//#include <sys/mount.h>
-/* Include our own version of sys/mount.h, since libc5 doesn't
- * know about umount2 */
-static _syscall1(int, umount, const char *, special_file);
-static _syscall2(int, umount2, const char *, special_file, int, flags);
-static _syscall5(int, mount, const char *, special_file, const char *, dir,
- const char *, fstype, unsigned long int, rwflag, const void *, data);
+/* Include our own version of umount2 if we need it... */
+#ifndef __NR_umount2
+#define __NR_umount2 52
#define MNT_FORCE 1
-#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */
-#define MS_REMOUNT 32 /* Alter flags of a mounted FS. */
-#define MS_RDONLY 1 /* Mount read-only. */
+#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */
+#define MS_REMOUNT 32 /* Alter flags of a mounted FS. */
+#define MS_RDONLY 1 /* Mount read-only. */
+
+#endif
+static _syscall2(int, umount2, const char *, special_file, int, flags);
static const char umount_usage[] =
diff --git a/utility.c b/utility.c
index e1e0f71a5..271b101ec 100644
--- a/utility.c
+++ b/utility.c
@@ -45,14 +45,14 @@
#include <dirent.h>
#include <time.h>
#include <utime.h>
-#include <sys/stat.h>
#include <unistd.h>
#include <ctype.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
#include <sys/utsname.h> /* for uname(2) */
#if defined BB_FEATURE_MOUNT_LOOP
#include <fcntl.h>
-#include <sys/ioctl.h>
#include <linux/loop.h>
#endif
@@ -904,9 +904,10 @@ unsigned long my_getpwnamegid(char *name)
#if (defined BB_CHVT) || (defined BB_DEALLOCVT) || (defined BB_SETKEYCODES)
-
-#include <linux/kd.h>
-#include <sys/ioctl.h>
+/* From <linux/kd.h> */
+#define KDGKBTYPE 0x4B33 /* get keyboard type */
+#define KB_84 0x01
+#define KB_101 0x02 /* this is what we always answer */
int is_a_console(int fd)
{