Changes to the include files in order to make cross-compilation possible.

- The primary reason is that mkfs and installboot need to run natively during
  the cross compilation (host and target versions are compiled). There is a
  collision of include files though. E.g. a.out.h is very minix-specific.
  Therefore some files we moved and replaced by stubs that include the original
  file if compiling on or for Minix :
  
  include/a.out.h -> include/minix/a.out.h
  include/sys/dir.h -> include/minix/dir.h
  include/dirent.h -> include/minix/dirent.h
  include/sys/types.h -> include/minix/types.h

- This does not break any native compilation on Minix. Other headers that were
  including the original files are changed according to include directly the
  new, minix specific location not to pick up the host system includes while
  cross-compiling.

- role of this patch is to make rebasing of the build branch simpler until the
  new build system is merged
This commit is contained in:
Tomas Hruby 2009-11-06 08:46:22 +00:00
parent 616d936638
commit 0b8e20c89e
40 changed files with 470 additions and 410 deletions

View file

@ -1,118 +1,11 @@
/* The <a.out> header file describes the format of executable files. */ /*
* 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 _AOUT_H #if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
#define _AOUT_H #error "Including Minix specific file in program targeted for other system"
#else
struct exec { /* a.out header */ #include <minix/a.out.h>
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 #endif
_PROTOTYPE( int nlist, (char *_file, struct nlist *_nl) );
#endif /* _AOUT_H */

View file

@ -5,7 +5,7 @@
#define _ALLOCA_H #define _ALLOCA_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
#if __GNUC__ #if __GNUC__

View file

@ -1,98 +1,11 @@
/* dirent.h - Declarations for directory reading routines. /*
* Author: Kees J. Bot * this files resolves conflicts between the file of the host system and
* 24 Apr 1989 * the minix specific one. This file is included directly only on Minix
* * and it is an error to do so on any other system
* 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 #if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
#define _DIRENT_H #error "Including Minix specific file in program targeted for other system"
#else
#ifndef _TYPES_H #include <minix/dirent.h>
#include <sys/types.h>
#endif #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 */

View file

@ -11,7 +11,7 @@
#define _FCNTL_H #define _FCNTL_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
/* These values are used for cmd in fcntl(). POSIX Table 6-1. */ /* These values are used for cmd in fcntl(). POSIX Table 6-1. */

View file

@ -4,7 +4,7 @@
#define _GRP_H #define _GRP_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
struct group { struct group {

View file

@ -11,7 +11,7 @@
/* The following are so basic, all the lib files get them automatically. */ /* The following are so basic, all the lib files get them automatically. */
#include <minix/config.h> /* must be first */ #include <minix/config.h> /* must be first */
#include <sys/types.h> #include <minix/types.h>
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
#include <ansi.h> #include <ansi.h>

View file

@ -38,7 +38,7 @@
#define LONG_MAX 2147483647L /* maximum value of a long */ #define LONG_MAX 2147483647L /* maximum value of a long */
#define ULONG_MAX 0xFFFFFFFFL /* maximum value of an unsigned 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). */ /* Minimum sizes required by the POSIX P1003.1 standard (Table 2-3). */
#ifdef _POSIX_SOURCE /* these are only visible for POSIX */ #ifdef _POSIX_SOURCE /* these are only visible for POSIX */

118
include/minix/a.out.h Normal file
View file

@ -0,0 +1,118 @@
/* 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 */

View file

@ -10,7 +10,7 @@
#define _DEVIO_H #define _DEVIO_H
#include <minix/sys_config.h> /* needed to include <minix/type.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;
typedef U16_t Port_t; typedef U16_t Port_t;

19
include/minix/dir.h Normal file
View file

@ -0,0 +1,19 @@
/* 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 */

98
include/minix/dirent.h Normal file
View file

@ -0,0 +1,98 @@
/* 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 */

View file

@ -3,7 +3,7 @@
#ifndef _MINIX_DS_H #ifndef _MINIX_DS_H
#define _MINIX_DS_H #define _MINIX_DS_H
#include <sys/types.h> #include <minix/types.h>
/* DS Flag values. */ /* DS Flag values. */
#define DS_IN_USE 0x0001 /* Internal use only. */ #define DS_IN_USE 0x0001 /* Internal use only. */

View file

@ -8,7 +8,7 @@
#define _M_IOCTL_H #define _M_IOCTL_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
#if _EM_WSIZE >= 4 #if _EM_WSIZE >= 4

View file

@ -7,7 +7,7 @@
#define _MINIX__PARTITION_H #define _MINIX__PARTITION_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
struct partition { struct partition {

View file

@ -8,7 +8,7 @@ Created: Jan 15, 1992 by Philip Homburg
#define _PORTIO_H_ #define _PORTIO_H_
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
unsigned inb(U16_t _port); unsigned inb(U16_t _port);

View file

@ -31,7 +31,7 @@ struct {
#endif /* SPROFILE */ #endif /* SPROFILE */
#include <sys/types.h> #include <minix/types.h>
# define PROF_GET 2 /* get call profiling tables */ # define PROF_GET 2 /* get call profiling tables */
# define PROF_RESET 3 /* reset call profiling tables */ # define PROF_RESET 3 /* reset call profiling tables */

View file

@ -3,7 +3,7 @@
#define _MINIX_SAFECOPIES_H 1 #define _MINIX_SAFECOPIES_H 1
#include <minix/sys_config.h> #include <minix/sys_config.h>
#include <sys/types.h> #include <minix/types.h>
#include <stdint.h> #include <stdint.h>
typedef int32_t cp_grant_id_t; typedef int32_t cp_grant_id_t;

View file

@ -4,7 +4,7 @@
#define _SYSLIB_H #define _SYSLIB_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
#ifndef _IPC_H #ifndef _IPC_H

View file

@ -2,7 +2,7 @@
#ifndef _MINIX_TTY_H #ifndef _MINIX_TTY_H
#define _MINIX_TTY_H #define _MINIX_TTY_H
#include <sys/types.h> #include <minix/types.h>
#define TTYMAGIC 0xb105 #define TTYMAGIC 0xb105

View file

@ -6,7 +6,7 @@
#endif #endif
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
/* Type definitions. */ /* Type definitions. */

168
include/minix/types.h Normal file
View file

@ -0,0 +1,168 @@
/* 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 */

View file

@ -6,7 +6,7 @@
#define _MINIX__U64_H #define _MINIX__U64_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
u64_t add64(u64_t i, u64_t j); u64_t add64(u64_t i, u64_t j);

View file

@ -3,7 +3,7 @@
#ifndef _MINIX_VM_H #ifndef _MINIX_VM_H
#define _MINIX_VM_H #define _MINIX_VM_H
#include <sys/types.h> #include <minix/types.h>
#include <minix/endpoint.h> #include <minix/endpoint.h>
_PROTOTYPE( int vm_exit, (endpoint_t ep)); _PROTOTYPE( int vm_exit, (endpoint_t ep));

View file

@ -4,7 +4,7 @@
#define _PWD_H #define _PWD_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
struct passwd { struct passwd {

View file

@ -41,7 +41,7 @@
#define _REGEX_H_ #define _REGEX_H_
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
/* types */ /* types */

View file

@ -11,7 +11,7 @@
#endif #endif
#ifdef _POSIX_SOURCE #ifdef _POSIX_SOURCE
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
#endif #endif

View file

@ -11,7 +11,7 @@
#define _STDINT_H #define _STDINT_H
#ifndef _MINIX__TYPES_H #ifndef _MINIX__TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
#include <minix/sys_config.h> #include <minix/sys_config.h>

View file

@ -55,7 +55,7 @@ typedef struct __iobuf {
#define FOPEN_MAX 20 #define FOPEN_MAX 20
#include <sys/dir.h> #include <minix/dir.h>
#define FILENAME_MAX DIRSIZ #define FILENAME_MAX DIRSIZ
#define TMP_MAX 999 #define TMP_MAX 999

View file

@ -1,19 +1,11 @@
/* The <dir.h> header gives the layout of a directory. */ /*
* 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 _DIR_H #if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
#define _DIR_H #error "Including Minix specific file in program targeted for other system"
#else
#include <sys/types.h> #include <minix/dir.h>
#define DIRBLKSIZ 512 /* size of directory block */
#ifndef DIRSIZ
#define DIRSIZ 60
#endif #endif
struct direct {
ino_t d_ino;
char d_name[DIRSIZ];
};
#endif /* _DIR_H */

View file

@ -3,7 +3,7 @@
#define _MMAN_H #define _MMAN_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
/* prot argument for mmap() */ /* prot argument for mmap() */

View file

@ -6,7 +6,7 @@
#endif #endif
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <minix/types.h>
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>

View file

@ -7,7 +7,7 @@
#define _STAT_H #define _STAT_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
struct stat { struct stat {

View file

@ -4,7 +4,7 @@
#define _STATFS_H #define _STATFS_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
struct statfs { struct statfs {

View file

@ -8,7 +8,7 @@ Created: Feb 15, 1994 by Philip Homburg <philip@cs.vu.nl>
#define _SYS__SVRCTL_H #define _SYS__SVRCTL_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
/* Server control commands have the same encoding as the commands for ioctls. */ /* Server control commands have the same encoding as the commands for ioctls. */

View file

@ -1,154 +1,11 @@
/* The <sys/types.h> header contains important data type definitions. /*
* It is considered good programming practice to use these definitions, * this files resolves conflicts between the file of the host system and
* instead of the underlying base type. By convention, all type names end * the minix specific one. This file is included directly only on Minix
* with _t. * and it is an error to do so on any other system
*/ */
#ifndef _TYPES_H #if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
#define _TYPES_H #error "Including Minix specific file in program targeted for other system"
#else
#ifndef _ANSI_H #include <minix/types.h>
#include <ansi.h>
#endif #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)
#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 */

View file

@ -17,7 +17,7 @@
#define _WAIT_H #define _WAIT_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
#define _LOW(v) ( (v) & 0377) #define _LOW(v) ( (v) & 0377)

View file

@ -16,7 +16,7 @@
#define _TIMERS_H #define _TIMERS_H
#include <limits.h> #include <limits.h>
#include <sys/types.h> #include <minix/types.h>
struct timer; struct timer;
typedef void (*tmr_func_t)(struct timer *tp); typedef void (*tmr_func_t)(struct timer *tp);

View file

@ -76,12 +76,14 @@ EXTERN environment *env; /* Lists the environment */
EXTERN int fsok; /* True if the boot device contains an FS */ EXTERN int fsok; /* True if the boot device contains an FS */
EXTERN u32_t lowsec; /* Offset to the file system on the boot dev */ EXTERN u32_t lowsec; /* Offset to the file system on the boot dev */
#if defined(_MINIX) || defined(__minix) || defined(__ACK__)
/* Prototypes */ /* Prototypes */
_PROTOTYPE( off_t r_super, (void)); _PROTOTYPE( off_t r_super, (void));
_PROTOTYPE( void r_stat, (Ino_t _inum, struct stat *_stp )); _PROTOTYPE( void r_stat, (Ino_t _inum, struct stat *_stp ));
_PROTOTYPE( ino_t r_readdir, (char *_name )); _PROTOTYPE( ino_t r_readdir, (char *_name ));
_PROTOTYPE( off_t r_vir2abs, (off_t _virblk )); _PROTOTYPE( off_t r_vir2abs, (off_t _virblk ));
_PROTOTYPE( ino_t r_lookup, (Ino_t _cwd, char *_path )); _PROTOTYPE( ino_t r_lookup, (Ino_t _cwd, char *_path ));
#endif
#ifdef _MONHEAD #ifdef _MONHEAD
_PROTOTYPE( void readerr, (off_t _sec, int _err )); _PROTOTYPE( void readerr, (off_t _sec, int _err ));

View file

@ -4,7 +4,7 @@
#define _UNISTD_H #define _UNISTD_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
/* Values used by access(). POSIX Table 2-8. */ /* Values used by access(). POSIX Table 2-8. */

View file

@ -4,7 +4,7 @@
#define _UTIME_H #define _UTIME_H
#ifndef _TYPES_H #ifndef _TYPES_H
#include <sys/types.h> #include <minix/types.h>
#endif #endif
struct utimbuf { struct utimbuf {