-/* The <a.out> header file describes the format of executable files. */
-
-#ifndef _AOUT_H
-#define _AOUT_H
-
-struct exec { /* a.out header */
- unsigned char a_magic[2]; /* magic number */
- unsigned char a_flags; /* flags, see below */
- unsigned char a_cpu; /* cpu id */
- unsigned char a_hdrlen; /* length of header */
- unsigned char a_unused; /* reserved for future use */
- unsigned short a_version; /* version stamp (not used at present) */
- long a_text; /* size of text segement in bytes */
- long a_data; /* size of data segment in bytes */
- long a_bss; /* size of bss segment in bytes */
- long a_entry; /* entry point */
- long a_total; /* total memory allocated */
- long a_syms; /* size of symbol table */
-
- /* SHORT FORM ENDS HERE */
- long a_trsize; /* text relocation size */
- long a_drsize; /* data relocation size */
- long a_tbase; /* text relocation base */
- long a_dbase; /* data relocation base */
-};
-
-#define A_MAGIC0 (unsigned char) 0x01
-#define A_MAGIC1 (unsigned char) 0x03
-#define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||(X).a_magic[1] != A_MAGIC1)
-
-/* CPU Id of TARGET machine (byte order coded in low order two bits) */
-#define A_NONE 0x00 /* unknown */
-#define A_I8086 0x04 /* intel i8086/8088 */
-#define A_M68K 0x0B /* motorola m68000 */
-#define A_NS16K 0x0C /* national semiconductor 16032 */
-#define A_I80386 0x10 /* intel i80386 */
-#define A_SPARC 0x17 /* Sun SPARC */
-
-#define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */
-#define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */
-
-/* Flags. */
-#define A_UZP 0x01 /* unmapped zero page (pages) */
-#define A_PAL 0x02 /* page aligned executable */
-#define A_NSYM 0x04 /* new style symbol table */
-#define A_IMG 0x08 /* image instead of executable (e.g. root FS) */
-#define A_EXEC 0x10 /* executable */
-#define A_SEP 0x20 /* separate I/D */
-#define A_PURE 0x40 /* pure text */ /* not used */
-#define A_TOVLY 0x80 /* text overlay */ /* not used */
-
-/* Offsets of various things. */
-#define A_MINHDR 32
-#define A_TEXTPOS(X) ((long)(X).a_hdrlen)
-#define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text)
-#define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR)
-#define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8))
-#define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16))
-#define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24))
-#define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data)
-#define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize)
-#define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \
- ((X).a_trsize + (X).a_drsize) : 0))
-
-struct reloc {
- long r_vaddr; /* virtual address of reference */
- unsigned short r_symndx; /* internal segnum or extern symbol num */
- unsigned short r_type; /* relocation type */
-};
-
-/* r_tyep values: */
-#define R_ABBS 0
-#define R_RELLBYTE 2
-#define R_PCRBYTE 3
-#define R_RELWORD 4
-#define R_PCRWORD 5
-#define R_RELLONG 6
-#define R_PCRLONG 7
-#define R_REL3BYTE 8
-#define R_KBRANCHE 9
-
-/* r_symndx for internal segments */
-#define S_ABS ((unsigned short)-1)
-#define S_TEXT ((unsigned short)-2)
-#define S_DATA ((unsigned short)-3)
-#define S_BSS ((unsigned short)-4)
-
-struct nlist { /* symbol table entry */
- char n_name[8]; /* symbol name */
- long n_value; /* value */
- unsigned char n_sclass; /* storage class */
- unsigned char n_numaux; /* number of auxiliary entries (not used) */
- unsigned short n_type; /* language base and derived type (not used) */
-};
-
-/* Low bits of storage class (section). */
-#define N_SECT 07 /* section mask */
-#define N_UNDF 00 /* undefined */
-#define N_ABS 01 /* absolute */
-#define N_TEXT 02 /* text */
-#define N_DATA 03 /* data */
-#define N_BSS 04 /* bss */
-#define N_COMM 05 /* (common) */
-
-/* High bits of storage class. */
-#define N_CLASS 0370 /* storage class mask */
-#define C_NULL
-#define C_EXT 0020 /* external symbol */
-#define C_STAT 0030 /* static */
-
-/* Function prototypes. */
-#ifndef _ANSI_H
-#include <ansi.h>
+/*
+ * this files resolves conflicts between the file of the host system and
+ * the minix specific one. This file is included directly only on Minix
+ * and it is an error to do so on any other system
+ */
+
+#if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
+#error "Including Minix specific file in program targeted for other system"
+#else
+#include <minix/a.out.h>
#endif
-
-_PROTOTYPE( int nlist, (char *_file, struct nlist *_nl) );
-
-#endif /* _AOUT_H */
#define _ALLOCA_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
#if __GNUC__
-/* dirent.h - Declarations for directory reading routines.
- * Author: Kees J. Bot
- * 24 Apr 1989
- *
- * Note: The V7 format directory entries used under Minix must be transformed
- * into a struct dirent with a d_name of at least 15 characters. Given that
- * we have to transform V7 entries anyhow it is little trouble to let the
- * routines understand the so-called "flex" directory format too.
+/*
+ * this files resolves conflicts between the file of the host system and
+ * the minix specific one. This file is included directly only on Minix
+ * and it is an error to do so on any other system
*/
-#ifndef _DIRENT_H
-#define _DIRENT_H
-
-#ifndef _TYPES_H
-#include <sys/types.h>
+#if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
+#error "Including Minix specific file in program targeted for other system"
+#else
+#include <minix/dirent.h>
#endif
-
-#include <sys/dir.h>
-
-/* _fl_direct is a flexible directory entry. Actually it's a union of 8
- * characters and the 3 fields defined below.
- */
-
-/* Flexible directory entry: */
-struct _fl_direct { /* First slot in an entry */
- ino_t d_ino;
- unsigned char d_extent;
- char d_name[3]; /* two characters for the shortest name */
-};
-
- /* Name of length len needs _EXTENT(len) extra slots. */
-#define _EXTENT(len) (((len) + 5) >> 3)
-
-/* Version 7 directory entry: */
-struct _v7_direct {
- ino_t d_ino;
- char d_name[DIRSIZ];
-};
-
-/* The block size must be at least 1024 bytes, because otherwise
- * the superblock (at 1024 bytes) overlaps with other filesystem data.
- */
-#define _MIN_BLOCK_SIZE 1024
-
-/* The below is allocated in some parts of the system as the largest
- * a filesystem block can be. For instance, the boot monitor allocates
- * 3 of these blocks and has to fit within 64kB, so this can't be
- * increased without taking that into account.
- */
-#define _MAX_BLOCK_SIZE 4096
-
-/* This is the block size for the fixed versions of the filesystem (V1/V2) */
-#define _STATIC_BLOCK_SIZE 1024
-
-#define _STATIC_FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
-#define _FLEX_PER_V7 (_EXTENT(DIRSIZ) + 1)
-#define _FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
-
-/* Definitions for the directory(3) routines: */
-typedef struct {
- char _fd; /* Filedescriptor of open directory */
- unsigned _count; /* This many bytes in _buf */
- unsigned _pos; /* Position in _buf */
- char _buf[_MAX_BLOCK_SIZE]; /* The size does not really
- * matter as long as the
- * buffer is big enough
- * to contain at least one
- * entry.
- */
-} DIR;
-
-#define _DIRENT_NAME_LEN 61
-
-struct dirent { /* Largest entry (8 slots) */
- ino_t d_ino; /* I-node number */
- off_t d_off; /* Offset in directory */
- unsigned short d_reclen; /* Length of this record */
- char d_name[1]; /* Null terminated name */
-};
-
-/* Function Prototypes. */
-_PROTOTYPE( int closedir, (DIR *_dirp) );
-_PROTOTYPE( DIR *opendir, (const char *_dirname) );
-_PROTOTYPE( struct dirent *readdir, (DIR *_dirp) );
-_PROTOTYPE( void rewinddir, (DIR *_dirp) );
-
-#ifdef _MINIX
-_PROTOTYPE( int seekdir, (DIR *_dirp, off_t _loc) );
-_PROTOTYPE( off_t telldir, (DIR *_dirp) );
-
-#define dirfd(dirp) ((dirp)->_fd)
-
-_PROTOTYPE( int getdents, (int _fildes, struct dirent *_buf,
- size_t _nbyte) );
-
-#endif
-
-#endif /* _DIRENT_H */
#define _FCNTL_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
/* These values are used for cmd in fcntl(). POSIX Table 6-1. */
#define _GRP_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
struct group {
/* The following are so basic, all the lib files get them automatically. */
#include <minix/config.h> /* must be first */
-#include <sys/types.h>
+#include <minix/types.h>
#include <limits.h>
#include <errno.h>
#include <ansi.h>
#define LONG_MAX 2147483647L /* maximum value of a long */
#define ULONG_MAX 0xFFFFFFFFL /* maximum value of an unsigned long */
-#include <sys/dir.h>
+#include <minix/dir.h>
/* Minimum sizes required by the POSIX P1003.1 standard (Table 2-3). */
#ifdef _POSIX_SOURCE /* these are only visible for POSIX */
--- /dev/null
+/* The <a.out> header file describes the format of executable files. */
+
+#ifndef _AOUT_H
+#define _AOUT_H
+
+struct exec { /* a.out header */
+ unsigned char a_magic[2]; /* magic number */
+ unsigned char a_flags; /* flags, see below */
+ unsigned char a_cpu; /* cpu id */
+ unsigned char a_hdrlen; /* length of header */
+ unsigned char a_unused; /* reserved for future use */
+ unsigned short a_version; /* version stamp (not used at present) */
+ long a_text; /* size of text segement in bytes */
+ long a_data; /* size of data segment in bytes */
+ long a_bss; /* size of bss segment in bytes */
+ long a_entry; /* entry point */
+ long a_total; /* total memory allocated */
+ long a_syms; /* size of symbol table */
+
+ /* SHORT FORM ENDS HERE */
+ long a_trsize; /* text relocation size */
+ long a_drsize; /* data relocation size */
+ long a_tbase; /* text relocation base */
+ long a_dbase; /* data relocation base */
+};
+
+#define A_MAGIC0 (unsigned char) 0x01
+#define A_MAGIC1 (unsigned char) 0x03
+#define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||(X).a_magic[1] != A_MAGIC1)
+
+/* CPU Id of TARGET machine (byte order coded in low order two bits) */
+#define A_NONE 0x00 /* unknown */
+#define A_I8086 0x04 /* intel i8086/8088 */
+#define A_M68K 0x0B /* motorola m68000 */
+#define A_NS16K 0x0C /* national semiconductor 16032 */
+#define A_I80386 0x10 /* intel i80386 */
+#define A_SPARC 0x17 /* Sun SPARC */
+
+#define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */
+#define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */
+
+/* Flags. */
+#define A_UZP 0x01 /* unmapped zero page (pages) */
+#define A_PAL 0x02 /* page aligned executable */
+#define A_NSYM 0x04 /* new style symbol table */
+#define A_IMG 0x08 /* image instead of executable (e.g. root FS) */
+#define A_EXEC 0x10 /* executable */
+#define A_SEP 0x20 /* separate I/D */
+#define A_PURE 0x40 /* pure text */ /* not used */
+#define A_TOVLY 0x80 /* text overlay */ /* not used */
+
+/* Offsets of various things. */
+#define A_MINHDR 32
+#define A_TEXTPOS(X) ((long)(X).a_hdrlen)
+#define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text)
+#define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR)
+#define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8))
+#define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16))
+#define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24))
+#define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data)
+#define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize)
+#define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \
+ ((X).a_trsize + (X).a_drsize) : 0))
+
+struct reloc {
+ long r_vaddr; /* virtual address of reference */
+ unsigned short r_symndx; /* internal segnum or extern symbol num */
+ unsigned short r_type; /* relocation type */
+};
+
+/* r_tyep values: */
+#define R_ABBS 0
+#define R_RELLBYTE 2
+#define R_PCRBYTE 3
+#define R_RELWORD 4
+#define R_PCRWORD 5
+#define R_RELLONG 6
+#define R_PCRLONG 7
+#define R_REL3BYTE 8
+#define R_KBRANCHE 9
+
+/* r_symndx for internal segments */
+#define S_ABS ((unsigned short)-1)
+#define S_TEXT ((unsigned short)-2)
+#define S_DATA ((unsigned short)-3)
+#define S_BSS ((unsigned short)-4)
+
+struct nlist { /* symbol table entry */
+ char n_name[8]; /* symbol name */
+ long n_value; /* value */
+ unsigned char n_sclass; /* storage class */
+ unsigned char n_numaux; /* number of auxiliary entries (not used) */
+ unsigned short n_type; /* language base and derived type (not used) */
+};
+
+/* Low bits of storage class (section). */
+#define N_SECT 07 /* section mask */
+#define N_UNDF 00 /* undefined */
+#define N_ABS 01 /* absolute */
+#define N_TEXT 02 /* text */
+#define N_DATA 03 /* data */
+#define N_BSS 04 /* bss */
+#define N_COMM 05 /* (common) */
+
+/* High bits of storage class. */
+#define N_CLASS 0370 /* storage class mask */
+#define C_NULL
+#define C_EXT 0020 /* external symbol */
+#define C_STAT 0030 /* static */
+
+/* Function prototypes. */
+#ifndef _ANSI_H
+#include <ansi.h>
+#endif
+
+_PROTOTYPE( int nlist, (char *_file, struct nlist *_nl) );
+
+#endif /* _AOUT_H */
#define _DEVIO_H
#include <minix/sys_config.h> /* needed to include <minix/type.h> */
-#include <sys/types.h> /* u8_t, u16_t, u32_t needed */
+#include <minix/types.h> /* u8_t, u16_t, u32_t needed */
typedef u16_t port_t;
typedef U16_t Port_t;
--- /dev/null
+/* The <dir.h> header gives the layout of a directory. */
+
+#ifndef _DIR_H
+#define _DIR_H
+
+#include <minix/types.h>
+
+#define DIRBLKSIZ 512 /* size of directory block */
+
+#ifndef DIRSIZ
+#define DIRSIZ 60
+#endif
+
+struct direct {
+ ino_t d_ino;
+ char d_name[DIRSIZ];
+};
+
+#endif /* _DIR_H */
--- /dev/null
+/* dirent.h - Declarations for directory reading routines.
+ * Author: Kees J. Bot
+ * 24 Apr 1989
+ *
+ * Note: The V7 format directory entries used under Minix must be transformed
+ * into a struct dirent with a d_name of at least 15 characters. Given that
+ * we have to transform V7 entries anyhow it is little trouble to let the
+ * routines understand the so-called "flex" directory format too.
+ */
+
+#ifndef _DIRENT_H
+#define _DIRENT_H
+
+#ifndef _TYPES_H
+#include <minix/types.h>
+#endif
+
+#include <minix/dir.h>
+
+/* _fl_direct is a flexible directory entry. Actually it's a union of 8
+ * characters and the 3 fields defined below.
+ */
+
+/* Flexible directory entry: */
+struct _fl_direct { /* First slot in an entry */
+ ino_t d_ino;
+ unsigned char d_extent;
+ char d_name[3]; /* two characters for the shortest name */
+};
+
+ /* Name of length len needs _EXTENT(len) extra slots. */
+#define _EXTENT(len) (((len) + 5) >> 3)
+
+/* Version 7 directory entry: */
+struct _v7_direct {
+ ino_t d_ino;
+ char d_name[DIRSIZ];
+};
+
+/* The block size must be at least 1024 bytes, because otherwise
+ * the superblock (at 1024 bytes) overlaps with other filesystem data.
+ */
+#define _MIN_BLOCK_SIZE 1024
+
+/* The below is allocated in some parts of the system as the largest
+ * a filesystem block can be. For instance, the boot monitor allocates
+ * 3 of these blocks and has to fit within 64kB, so this can't be
+ * increased without taking that into account.
+ */
+#define _MAX_BLOCK_SIZE 4096
+
+/* This is the block size for the fixed versions of the filesystem (V1/V2) */
+#define _STATIC_BLOCK_SIZE 1024
+
+#define _STATIC_FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
+#define _FLEX_PER_V7 (_EXTENT(DIRSIZ) + 1)
+#define _FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
+
+/* Definitions for the directory(3) routines: */
+typedef struct {
+ char _fd; /* Filedescriptor of open directory */
+ unsigned _count; /* This many bytes in _buf */
+ unsigned _pos; /* Position in _buf */
+ char _buf[_MAX_BLOCK_SIZE]; /* The size does not really
+ * matter as long as the
+ * buffer is big enough
+ * to contain at least one
+ * entry.
+ */
+} DIR;
+
+#define _DIRENT_NAME_LEN 61
+
+struct dirent { /* Largest entry (8 slots) */
+ ino_t d_ino; /* I-node number */
+ off_t d_off; /* Offset in directory */
+ unsigned short d_reclen; /* Length of this record */
+ char d_name[1]; /* Null terminated name */
+};
+
+/* Function Prototypes. */
+_PROTOTYPE( int closedir, (DIR *_dirp) );
+_PROTOTYPE( DIR *opendir, (const char *_dirname) );
+_PROTOTYPE( struct dirent *readdir, (DIR *_dirp) );
+_PROTOTYPE( void rewinddir, (DIR *_dirp) );
+
+#ifdef _MINIX
+_PROTOTYPE( int seekdir, (DIR *_dirp, off_t _loc) );
+_PROTOTYPE( off_t telldir, (DIR *_dirp) );
+
+#define dirfd(dirp) ((dirp)->_fd)
+
+_PROTOTYPE( int getdents, (int _fildes, struct dirent *_buf,
+ size_t _nbyte) );
+
+#endif
+
+#endif /* _DIRENT_H */
#ifndef _MINIX_DS_H
#define _MINIX_DS_H
-#include <sys/types.h>
+#include <minix/types.h>
/* DS Flag values. */
#define DS_IN_USE 0x0001 /* Internal use only. */
#define _M_IOCTL_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
#if _EM_WSIZE >= 4
#define _MINIX__PARTITION_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
struct partition {
#define _PORTIO_H_
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
unsigned inb(U16_t _port);
#endif /* SPROFILE */
-#include <sys/types.h>
+#include <minix/types.h>
# define PROF_GET 2 /* get call profiling tables */
# define PROF_RESET 3 /* reset call profiling tables */
#define _MINIX_SAFECOPIES_H 1
#include <minix/sys_config.h>
-#include <sys/types.h>
+#include <minix/types.h>
#include <stdint.h>
typedef int32_t cp_grant_id_t;
#define _SYSLIB_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
#ifndef _IPC_H
#ifndef _MINIX_TTY_H
#define _MINIX_TTY_H
-#include <sys/types.h>
+#include <minix/types.h>
#define TTYMAGIC 0xb105
#endif
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
/* Type definitions. */
--- /dev/null
+/* The <sys/types.h> header contains important data type definitions.
+ * It is considered good programming practice to use these definitions,
+ * instead of the underlying base type. By convention, all type names end
+ * with _t.
+ */
+
+#ifndef _TYPES_H
+#define _TYPES_H
+
+#ifndef _ANSI_H
+#include <ansi.h>
+#endif
+
+typedef unsigned char u8_t; /* 8 bit type */
+typedef unsigned short u16_t; /* 16 bit type */
+typedef char i8_t; /* 8 bit signed type */
+typedef short i16_t; /* 16 bit signed type */
+
+#if __SIZEOF_LONG__ > 4
+/* compiling with gcc on some (e.g. x86-64) platforms */
+typedef unsigned int u32_t; /* 32 bit type */
+typedef int i32_t; /* 32 bit signed type */
+#else
+/* default for ACK or gcc on 32 bit platforms */
+typedef unsigned long u32_t; /* 32 bit type */
+typedef long i32_t; /* 32 bit signed type */
+#endif
+
+typedef struct {
+ u32_t lo;
+ u32_t hi;
+} u64_t;
+
+/* some Minix specific types that do not conflict with posix */
+typedef u32_t zone_t; /* zone number */
+typedef u32_t block_t; /* block number */
+typedef u32_t bit_t; /* bit number in a bit map */
+typedef u16_t zone1_t; /* zone number for V1 file systems */
+typedef u16_t bitchunk_t; /* collection of bits in a bitmap */
+
+/* ANSI C makes writing down the promotion of unsigned types very messy. When
+ * sizeof(short) == sizeof(int), there is no promotion, so the type stays
+ * unsigned. When the compiler is not ANSI, there is usually no loss of
+ * unsignedness, and there are usually no prototypes so the promoted type
+ * doesn't matter. The use of types like Ino_t is an attempt to use ints
+ * (which are not promoted) while providing information to the reader.
+ */
+
+typedef unsigned long Ino_t;
+
+#if defined(_MINIX) || defined(__minix)
+
+/* The type size_t holds all results of the sizeof operator. At first glance,
+ * it seems obvious that it should be an unsigned int, but this is not always
+ * the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit
+ * integers. When one asks for the size of a 70K struct or array, the result
+ * requires 17 bits to express, so size_t must be a long type. The type
+ * ssize_t is the signed version of size_t.
+ */
+#ifndef _SIZE_T
+#define _SIZE_T
+typedef unsigned int size_t;
+#endif
+
+#ifndef _SSIZE_T
+#define _SSIZE_T
+typedef int ssize_t;
+#endif
+
+#ifndef _TIME_T
+#define _TIME_T
+typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
+#endif
+
+#ifndef _CLOCK_T
+#define _CLOCK_T
+typedef long clock_t; /* unit for system accounting */
+#endif
+
+#ifndef _SIGSET_T
+#define _SIGSET_T
+typedef unsigned long sigset_t;
+#endif
+
+#ifndef _KEY_T
+#define _KEY_T
+typedef long key_t;
+#endif
+
+/* Open Group Base Specifications Issue 6 (not complete) */
+typedef long useconds_t; /* Time in microseconds */
+
+typedef short dev_t; /* holds (major|minor) device pair */
+
+/* Types used in disk, inode, etc. data structures. */
+typedef char gid_t; /* group id */
+typedef unsigned long ino_t; /* i-node number (V3 filesystem) */
+typedef unsigned short mode_t; /* file type and permissions bits */
+typedef short nlink_t; /* number of links to a file */
+typedef long off_t; /* offset within a file */
+typedef int pid_t; /* process id (must be signed) */
+typedef short uid_t; /* user id */
+
+/* The following types are needed because MINIX uses K&R style function
+ * definitions (for maximum portability). When a short, such as dev_t, is
+ * passed to a function with a K&R definition, the compiler automatically
+ * promotes it to an int. The prototype must contain an int as the parameter,
+ * not a short, because an int is what an old-style function definition
+ * expects. Thus using dev_t in a prototype would be incorrect. It would be
+ * sufficient to just use int instead of dev_t in the prototypes, but Dev_t
+ * is clearer.
+ */
+typedef int Dev_t;
+typedef int _mnx_Gid_t;
+typedef int Nlink_t;
+typedef int _mnx_Uid_t;
+typedef int U8_t;
+typedef unsigned long U32_t;
+typedef int I8_t;
+typedef int I16_t;
+typedef long I32_t;
+
+#if _EM_WSIZE == 2
+/*typedef unsigned int Ino_t; Ino_t is now 32 bits */
+typedef unsigned int Zone1_t;
+typedef unsigned int Bitchunk_t;
+typedef unsigned int U16_t;
+typedef unsigned int _mnx_Mode_t;
+
+#else /* _EM_WSIZE == 4, or _EM_WSIZE undefined */
+/*typedef int Ino_t; Ino_t is now 32 bits */
+typedef int Zone1_t;
+typedef int Bitchunk_t;
+typedef int U16_t;
+typedef int _mnx_Mode_t;
+
+#endif /* _EM_WSIZE == 2, etc */
+
+/* Signal handler type, e.g. SIG_IGN */
+typedef void _PROTOTYPE( (*sighandler_t), (int) );
+
+/* Compatibility with other systems */
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned int u_int;
+typedef unsigned long u_long;
+typedef char *caddr_t;
+
+/* Devices. */
+#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
+#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
+
+#ifndef minor
+#define minor(dev) (((dev) >> MINOR) & 0xff)
+#endif
+
+#ifndef major
+#define major(dev) (((dev) >> MAJOR) & 0xff)
+#endif
+
+#ifndef makedev
+#define makedev(major, minor) \
+ ((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
+#endif
+
+#endif /* _MINIX || __minix */
+
+#endif /* _TYPES_H */
#define _MINIX__U64_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
u64_t add64(u64_t i, u64_t j);
#ifndef _MINIX_VM_H
#define _MINIX_VM_H
-#include <sys/types.h>
+#include <minix/types.h>
#include <minix/endpoint.h>
_PROTOTYPE( int vm_exit, (endpoint_t ep));
#define _PWD_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
struct passwd {
#define _REGEX_H_
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
/* types */
#endif
#ifdef _POSIX_SOURCE
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
#endif
#define _STDINT_H
#ifndef _MINIX__TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
#include <minix/sys_config.h>
#define FOPEN_MAX 20
-#include <sys/dir.h>
+#include <minix/dir.h>
#define FILENAME_MAX DIRSIZ
#define TMP_MAX 999
-/* The <dir.h> header gives the layout of a directory. */
-
-#ifndef _DIR_H
-#define _DIR_H
-
-#include <sys/types.h>
-
-#define DIRBLKSIZ 512 /* size of directory block */
-
-#ifndef DIRSIZ
-#define DIRSIZ 60
+/*
+ * this files resolves conflicts between the file of the host system and
+ * the minix specific one. This file is included directly only on Minix
+ * and it is an error to do so on any other system
+ */
+
+#if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
+#error "Including Minix specific file in program targeted for other system"
+#else
+#include <minix/dir.h>
#endif
-
-struct direct {
- ino_t d_ino;
- char d_name[DIRSIZ];
-};
-
-#endif /* _DIR_H */
#define _MMAN_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
/* prot argument for mmap() */
#endif
#include <sys/time.h>
-#include <sys/types.h>
+#include <minix/types.h>
#include <limits.h>
#include <string.h>
#define _STAT_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
struct stat {
#define _STATFS_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
struct statfs {
#define _SYS__SVRCTL_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
/* Server control commands have the same encoding as the commands for ioctls. */
-/* The <sys/types.h> header contains important data type definitions.
- * It is considered good programming practice to use these definitions,
- * instead of the underlying base type. By convention, all type names end
- * with _t.
+/*
+ * this files resolves conflicts between the file of the host system and
+ * the minix specific one. This file is included directly only on Minix
+ * and it is an error to do so on any other system
*/
-#ifndef _TYPES_H
-#define _TYPES_H
-
-#ifndef _ANSI_H
-#include <ansi.h>
-#endif
-
-/* The type size_t holds all results of the sizeof operator. At first glance,
- * it seems obvious that it should be an unsigned int, but this is not always
- * the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit
- * integers. When one asks for the size of a 70K struct or array, the result
- * requires 17 bits to express, so size_t must be a long type. The type
- * ssize_t is the signed version of size_t.
- */
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef unsigned int size_t;
-#endif
-
-#ifndef _SSIZE_T
-#define _SSIZE_T
-typedef int ssize_t;
-#endif
-
-#ifndef _TIME_T
-#define _TIME_T
-typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
-#endif
-
-#ifndef _CLOCK_T
-#define _CLOCK_T
-typedef long clock_t; /* unit for system accounting */
-#endif
-
-#ifndef _SIGSET_T
-#define _SIGSET_T
-typedef unsigned long sigset_t;
-#endif
-
-#ifndef _KEY_T
-#define _KEY_T
-typedef long key_t;
-#endif
-
-/* Open Group Base Specifications Issue 6 (not complete) */
-typedef long useconds_t; /* Time in microseconds */
-
-/* Types used in disk, inode, etc. data structures. */
-typedef short dev_t; /* holds (major|minor) device pair */
-typedef char gid_t; /* group id */
-typedef unsigned long ino_t; /* i-node number (V3 filesystem) */
-typedef unsigned short mode_t; /* file type and permissions bits */
-typedef short nlink_t; /* number of links to a file */
-typedef long off_t; /* offset within a file */
-typedef int pid_t; /* process id (must be signed) */
-typedef short uid_t; /* user id */
-typedef unsigned long zone_t; /* zone number */
-typedef unsigned long block_t; /* block number */
-typedef unsigned long bit_t; /* bit number in a bit map */
-typedef unsigned short zone1_t; /* zone number for V1 file systems */
-typedef unsigned short bitchunk_t; /* collection of bits in a bitmap */
-
-typedef unsigned char u8_t; /* 8 bit type */
-typedef unsigned short u16_t; /* 16 bit type */
-typedef unsigned long u32_t; /* 32 bit type */
-
-typedef char i8_t; /* 8 bit signed type */
-typedef short i16_t; /* 16 bit signed type */
-typedef long i32_t; /* 32 bit signed type */
-
-typedef struct {
- u32_t lo;
- u32_t hi;
-} u64_t;
-
-/* The following types are needed because MINIX uses K&R style function
- * definitions (for maximum portability). When a short, such as dev_t, is
- * passed to a function with a K&R definition, the compiler automatically
- * promotes it to an int. The prototype must contain an int as the parameter,
- * not a short, because an int is what an old-style function definition
- * expects. Thus using dev_t in a prototype would be incorrect. It would be
- * sufficient to just use int instead of dev_t in the prototypes, but Dev_t
- * is clearer.
- */
-typedef int Dev_t;
-typedef int _mnx_Gid_t;
-typedef int Nlink_t;
-typedef int _mnx_Uid_t;
-typedef int U8_t;
-typedef unsigned long U32_t;
-typedef int I8_t;
-typedef int I16_t;
-typedef long I32_t;
-
-/* ANSI C makes writing down the promotion of unsigned types very messy. When
- * sizeof(short) == sizeof(int), there is no promotion, so the type stays
- * unsigned. When the compiler is not ANSI, there is usually no loss of
- * unsignedness, and there are usually no prototypes so the promoted type
- * doesn't matter. The use of types like Ino_t is an attempt to use ints
- * (which are not promoted) while providing information to the reader.
- */
-
-typedef unsigned long Ino_t;
-
-#if _EM_WSIZE == 2
-/*typedef unsigned int Ino_t; Ino_t is now 32 bits */
-typedef unsigned int Zone1_t;
-typedef unsigned int Bitchunk_t;
-typedef unsigned int U16_t;
-typedef unsigned int _mnx_Mode_t;
-
-#else /* _EM_WSIZE == 4, or _EM_WSIZE undefined */
-/*typedef int Ino_t; Ino_t is now 32 bits */
-typedef int Zone1_t;
-typedef int Bitchunk_t;
-typedef int U16_t;
-typedef int _mnx_Mode_t;
-
-#endif /* _EM_WSIZE == 2, etc */
-
-/* Signal handler type, e.g. SIG_IGN */
-typedef void _PROTOTYPE( (*sighandler_t), (int) );
-
-/* Compatibility with other systems */
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned int u_int;
-typedef unsigned long u_long;
-typedef char *caddr_t;
-
-/* Devices. */
-#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
-#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
-
-#ifndef minor
-#define minor(dev) (((dev) >> MINOR) & 0xff)
+#if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
+#error "Including Minix specific file in program targeted for other system"
+#else
+#include <minix/types.h>
#endif
-
-#ifndef major
-#define major(dev) (((dev) >> MAJOR) & 0xff)
-#endif
-
-#ifndef makedev
-#define makedev(major, minor) \
- ((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
-#endif
-
-#endif /* _TYPES_H */
#define _WAIT_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
#define _LOW(v) ( (v) & 0377)
#define _TIMERS_H
#include <limits.h>
-#include <sys/types.h>
+#include <minix/types.h>
struct timer;
typedef void (*tmr_func_t)(struct timer *tp);
EXTERN int fsok; /* True if the boot device contains an FS */
EXTERN u32_t lowsec; /* Offset to the file system on the boot dev */
+#if defined(_MINIX) || defined(__minix) || defined(__ACK__)
/* Prototypes */
_PROTOTYPE( off_t r_super, (void));
_PROTOTYPE( void r_stat, (Ino_t _inum, struct stat *_stp ));
_PROTOTYPE( ino_t r_readdir, (char *_name ));
_PROTOTYPE( off_t r_vir2abs, (off_t _virblk ));
_PROTOTYPE( ino_t r_lookup, (Ino_t _cwd, char *_path ));
+#endif
#ifdef _MONHEAD
_PROTOTYPE( void readerr, (off_t _sec, int _err ));
#define _UNISTD_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
/* Values used by access(). POSIX Table 2-8. */
#define _UTIME_H
#ifndef _TYPES_H
-#include <sys/types.h>
+#include <minix/types.h>
#endif
struct utimbuf {