summaryrefslogtreecommitdiff
path: root/libc/kinclude/linuxmt
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1996-03-24 21:25:23 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:29:54 +0200
commitdcc973ea3e31710429858c99d4f040334ac67c06 (patch)
tree8883b902eb18eba489957b7f03caa491fd7992a7 /libc/kinclude/linuxmt
parentfe22c37817ce338fbbc90b239320248c270957fa (diff)
downloaddev86-dcc973ea3e31710429858c99d4f040334ac67c06.tar.gz
Import Dev86-0.0.5.tar.gzv0.0.5
Diffstat (limited to 'libc/kinclude/linuxmt')
-rw-r--r--libc/kinclude/linuxmt/errno.h1
-rw-r--r--libc/kinclude/linuxmt/fcntl.h70
-rw-r--r--libc/kinclude/linuxmt/ioctl.h1
-rw-r--r--libc/kinclude/linuxmt/stat.h55
-rw-r--r--libc/kinclude/linuxmt/termios.h258
-rw-r--r--libc/kinclude/linuxmt/types.h32
6 files changed, 417 insertions, 0 deletions
diff --git a/libc/kinclude/linuxmt/errno.h b/libc/kinclude/linuxmt/errno.h
new file mode 100644
index 0000000..b4c07a3
--- /dev/null
+++ b/libc/kinclude/linuxmt/errno.h
@@ -0,0 +1 @@
+#include "../arch/errno.h"
diff --git a/libc/kinclude/linuxmt/fcntl.h b/libc/kinclude/linuxmt/fcntl.h
new file mode 100644
index 0000000..d9188a1
--- /dev/null
+++ b/libc/kinclude/linuxmt/fcntl.h
@@ -0,0 +1,70 @@
+#ifndef __LINUXMT_FCNTL_H
+#define __LINUXMT_FCNTL_H
+
+/*
+ * Definitions taken from the i386 Linux kernel.
+ */
+
+/* open/fcntl */
+
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#define O_CREAT 0100 /* not fcntl */
+#define O_EXCL 0200 /* not fcntl */
+#define O_NOCTTY 0400 /* not fcntl */
+#define O_TRUNC 01000 /* not fcntl */
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_NDELAY O_NONBLOCK
+#if 0
+#define O_SYNC 010000 /* Not supported */
+#define FASYNC 020000 /* Not supported */
+#endif
+
+#define F_DUPFD 0 /* dup */
+#define F_GETFD 1 /* get f_flags */
+#define F_SETFD 2 /* set f_flags */
+#define F_GETFL 3 /* more flags (cloexec) */
+#define F_SETFL 4
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+
+#define F_SETOWN 8 /* for sockets. */
+#define F_GETOWN 9 /* for sockets. */
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH 1 /* shared lock */
+#define LOCK_EX 2 /* exclusive lock */
+#define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+#define LOCK_UN 8 /* remove lock */
+
+#ifdef __KERNEL__
+#define F_POSIX 1
+#define F_FLOCK 2
+#endif /* __KERNEL__ */
+
+struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+
+#endif
diff --git a/libc/kinclude/linuxmt/ioctl.h b/libc/kinclude/linuxmt/ioctl.h
new file mode 100644
index 0000000..20f5ac6
--- /dev/null
+++ b/libc/kinclude/linuxmt/ioctl.h
@@ -0,0 +1 @@
+#include "../arch/ioctl.h"
diff --git a/libc/kinclude/linuxmt/stat.h b/libc/kinclude/linuxmt/stat.h
new file mode 100644
index 0000000..0eb1c0e
--- /dev/null
+++ b/libc/kinclude/linuxmt/stat.h
@@ -0,0 +1,55 @@
+#ifndef _LINUX_STAT_H
+#define _LINUX_STAT_H
+
+#ifdef __KERNEL__
+
+#include "../arch/stat.h"
+
+#endif
+
+#define S_IFMT 00170000
+#ifdef __LINUXMT_NETWORK__
+#define S_IFSOCK 0140000
+#endif
+#define S_IFLNK 0120000
+#define S_IFREG 0100000
+#define S_IFBLK 0060000
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFIFO 0010000
+#define S_ISUID 0004000
+#define S_ISGID 0002000
+#define S_ISVTX 0001000
+
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+
+#define S_IRWXU 00700
+#define S_IRUSR 00400
+#define S_IWUSR 00200
+#define S_IXUSR 00100
+
+#define S_IRWXG 00070
+#define S_IRGRP 00040
+#define S_IWGRP 00020
+#define S_IXGRP 00010
+
+#define S_IRWXO 00007
+#define S_IROTH 00004
+#define S_IWOTH 00002
+#define S_IXOTH 00001
+
+#ifdef __KERNEL__
+#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
+#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
+#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
+#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
+#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
+#endif
+
+#endif
diff --git a/libc/kinclude/linuxmt/termios.h b/libc/kinclude/linuxmt/termios.h
new file mode 100644
index 0000000..52bde9a
--- /dev/null
+++ b/libc/kinclude/linuxmt/termios.h
@@ -0,0 +1,258 @@
+#ifndef _LINUXMT_TERMIOS_H
+#define _LINUXMT_TERMIOS_H
+#include <linuxmt/types.h>
+
+/* This is just a magic number to make these relatively unique ('T') */
+#define __TERMIOS_MAJ ('T'<<8)
+
+#define TCGETS (__TERMIOS_MAJ+0x01)
+#define TCSETS (__TERMIOS_MAJ+0x02)
+#define TCSETSW (__TERMIOS_MAJ+0x03)
+#define TCSETSF (__TERMIOS_MAJ+0x04)
+#define TCGETA (__TERMIOS_MAJ+0x05)
+#define TCSETA (__TERMIOS_MAJ+0x06)
+#define TCSETAW (__TERMIOS_MAJ+0x07)
+#define TCSETAF (__TERMIOS_MAJ+0x08)
+#define TCSBRK (__TERMIOS_MAJ+0x09)
+#define TCXONC (__TERMIOS_MAJ+0x0A)
+#define TCFLSH (__TERMIOS_MAJ+0x0B)
+#define TIOCEXCL (__TERMIOS_MAJ+0x0C)
+#define TIOCNXCL (__TERMIOS_MAJ+0x0D)
+#define TIOCSCTTY (__TERMIOS_MAJ+0x0E)
+#define TIOCGPGRP (__TERMIOS_MAJ+0x0F)
+#define TIOCSPGRP (__TERMIOS_MAJ+0x10)
+#define TIOCOUTQ (__TERMIOS_MAJ+0x11)
+#define TIOCSTI (__TERMIOS_MAJ+0x12)
+#define TIOCGWINSZ (__TERMIOS_MAJ+0x13)
+#define TIOCSWINSZ (__TERMIOS_MAJ+0x14)
+#define TIOCMGET (__TERMIOS_MAJ+0x15)
+#define TIOCMBIS (__TERMIOS_MAJ+0x16)
+#define TIOCMBIC (__TERMIOS_MAJ+0x17)
+#define TIOCMSET (__TERMIOS_MAJ+0x18)
+#define TIOCGSOFTCAR (__TERMIOS_MAJ+0x19)
+#define TIOCSSOFTCAR (__TERMIOS_MAJ+0x1A)
+#define FIONREAD (__TERMIOS_MAJ+0x1B)
+#define TIOCINQ FIONREAD
+#define TIOCLINUX (__TERMIOS_MAJ+0x1C)
+#define TIOCCONS (__TERMIOS_MAJ+0x1D)
+#define TIOCGSERIAL (__TERMIOS_MAJ+0x1E)
+#define TIOCSSERIAL (__TERMIOS_MAJ+0x1F)
+#define TIOCPKT (__TERMIOS_MAJ+0x20)
+#define FIONBIO (__TERMIOS_MAJ+0x21)
+#define TIOCNOTTY (__TERMIOS_MAJ+0x22)
+#define TIOCSETD (__TERMIOS_MAJ+0x23)
+#define TIOCGETD (__TERMIOS_MAJ+0x24)
+#define TCSBRKP (__TERMIOS_MAJ+0x25) /* Needed for POSIX tcsendbreak */
+#define TIOCTTYGSTRUCT (__TERMIOS_MAJ+0x26) /* For debugging only */
+#define FIONCLEX (__TERMIOS_MAJ+0x50) /* these numbers need to be adjusted. */
+#define FIOCLEX (__TERMIOS_MAJ+0x51)
+#define FIOASYNC (__TERMIOS_MAJ+0x52)
+#define TIOCSERCONFIG (__TERMIOS_MAJ+0x53)
+#define TIOCSERGWILD (__TERMIOS_MAJ+0x54)
+#define TIOCSERSWILD (__TERMIOS_MAJ+0x55)
+#define TIOCGLCKTRMIOS (__TERMIOS_MAJ+0x56)
+#define TIOCSLCKTRMIOS (__TERMIOS_MAJ+0x57)
+#define TIOCSERGSTRUCT (__TERMIOS_MAJ+0x58) /* For debugging only */
+#define TIOCSERGETLSR (__TERMIOS_MAJ+0x59) /* Get line status register */
+#define TIOCSERGETMULTI (__TERMIOS_MAJ+0x5A) /* Get multiport config */
+#define TIOCSERSETMULTI (__TERMIOS_MAJ+0x5B) /* Set multiport config */
+
+/* Used for packet mode */
+#define TIOCPKT_DATA 0
+#define TIOCPKT_FLUSHREAD 1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP 4
+#define TIOCPKT_START 8
+#define TIOCPKT_NOSTOP 16
+#define TIOCPKT_DOSTOP 32
+
+struct winsize {
+ unsigned short ws_row;
+ unsigned short ws_col;
+ unsigned short ws_xpixel;
+ unsigned short ws_ypixel;
+};
+
+#define NCC 8
+struct termio {
+ unsigned short c_iflag; /* input mode flags */
+ unsigned short c_oflag; /* output mode flags */
+ unsigned short c_cflag; /* control mode flags */
+ unsigned short c_lflag; /* local mode flags */
+ unsigned char c_line; /* line discipline */
+ unsigned char c_cc[NCC]; /* control characters */
+};
+
+#define NCCS 19
+struct termios {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+};
+
+/* c_cc characters */
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VTIME 5
+#define VMIN 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VEOL 11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOL2 16
+
+/* c_iflag bits */
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+
+/* c_oflag bits */
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+#define CRDLY 0003000
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+#define TAB3 0014000
+#define XTABS 0014000
+#define BSDLY 0020000
+#define BS0 0000000
+#define BS1 0020000
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+
+/* c_cflag bit meaning */
+#define CBAUD 0010017
+#define B0 0000000 /* hang up */
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+#define EXTA B19200
+#define EXTB B38400
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+#define CBAUDEX 0010000
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CRTSCTS 020000000000 /* flow control */
+
+/* c_lflag bits */
+#define ISIG 0000001
+#define ICANON 0000002
+#define XCASE 0000004
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE 0004000
+#define FLUSHO 0010000
+#define PENDIN 0040000
+#define IEXTEN 0100000
+
+/* modem lines */
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x008
+#define TIOCM_SR 0x010
+#define TIOCM_CTS 0x020
+#define TIOCM_CAR 0x040
+#define TIOCM_RNG 0x080
+#define TIOCM_DSR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RI TIOCM_RNG
+
+/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+
+
+/* tcflow() and TCXONC use these */
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+/* tcflush() and TCFLSH use these */
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+/* tcsetattr uses these */
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+/* line disciplines */
+#define N_TTY 0
+#define N_SLIP 1
+#define N_MOUSE 2
+#define N_PPP 3
+
+#endif /* _LINUXMT_TERMIOS_H */
diff --git a/libc/kinclude/linuxmt/types.h b/libc/kinclude/linuxmt/types.h
new file mode 100644
index 0000000..437d985
--- /dev/null
+++ b/libc/kinclude/linuxmt/types.h
@@ -0,0 +1,32 @@
+#ifndef __LINUXMT_TYPES_H
+#define __LINUXMT_TYPES_H
+
+#include "../arch/types.h"
+
+/* Throw away _FUNCTION parameters - the syntax is ripped off of Minix's
+ _PROTOTYPE. Considering Borland did the same thing to MFC on a bigger
+ scale, I don't think PH will mind :) */
+
+/* Yes, this should be in arch/types.h too */
+
+#define _FUNCTION(function, params) function()
+#define _VFUNCTION(functiom, params) (*function) ()
+
+typedef __u32 off_t;
+typedef __u16 pid_t;
+typedef __u16 uid_t;
+typedef __u16 gid_t;
+typedef __u32 time_t;
+typedef __u16 umode_t;
+typedef __u16 nlink_t;
+typedef __u16 mode_t;
+typedef __u32 loff_t;
+typedef unsigned int speed_t;
+
+typedef __u16 dev_t;
+typedef __u16 ino_t;
+typedef __u32 tcflag_t;
+typedef __u8 cc_t;
+
+#endif
+