updated to minix 1.5

This commit is contained in:
ceriel 1991-09-03 11:54:28 +00:00
parent 096b4683d4
commit c44e30af8b
12 changed files with 634 additions and 52 deletions

View file

@ -1,4 +1,11 @@
ansi.h
fcntl.h
limits.h
lib.h
errno.h errno.h
minix minix
sgtty.h sgtty.h
signal.h signal.h
string.h
time.h
utime.h

54
lib/minix/include/ansi.h Normal file
View file

@ -0,0 +1,54 @@
/* The <ansi.h> header checks whether the compiler claims conformance to ANSI
* Standard C. If so, the symbol _ANSI is defined as 1, otherwise it is
* defined as 0. Based on the result, a macro
*
* _PROTOTYPE(function, params)
*
* is defined. This macro expands in different ways, generating either
* ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie)
* prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc
* in such a way that they are portable over both ANSI and K&R compilers.
* The appropriate macros are defined here.
*/
#ifndef _ANSI_H
#define _ANSI_H
/* ANSI C requires __STDC__ to be defined as 1 for an ANSI C compiler.
* Some half-ANSI compilers define it as 0. Get around this here.
*/
#define _ANSI 0 /* 0 if compiler is not ANSI C, 1 if it is */
#ifdef __STDC__ /* __STDC__ defined for (near) ANSI compilers*/
#if __STDC__ == 1 /* __STDC__ == 1 for conformant compilers */
#undef _ANSI /* get rid of above definition */
#define _ANSI 1 /* _ANSI = 1 for ANSI C compilers */
#endif
#endif
/* At this point, _ANSI has been set correctly to 0 or 1. Define the
* _PROTOTYPE macro to either expand both of its arguments (ANSI prototypes),
* only the function name (K&R prototypes).
*/
#if _ANSI
#define _PROTOTYPE(function, params) function params
#define _VOIDSTAR void *
#define _VOID void
#define _CONST const
#define _VOLATILE volatile
#define _SIZET size_t
#else
#define _PROTOTYPE(function, params) function()
#define _VOIDSTAR void *
#define _VOID void
#define _CONST
#define _VOLATILE
#define _SIZET int
#endif /* _ANSI */
#endif /* ANSI_H */

View file

@ -1,41 +1,96 @@
#define OK 0 /* The <errno.h> header defines the numbers of the various errors that can
#define ERROR 1 * occur during program execution. They are visible to user programs and
#define EPERM 1 * should be small positive integers. However, they are also used within
#define ENOENT 2 * MINIX, where they must be negative. For example, the READ system call is
#define ESRCH 3 * executed internally by calling do_read(). This function returns either a
#define EINTR 4 * (negative) error number or a (positive) number of bytes actually read.
#define EIO 5 *
#define ENXIO 6 * To solve the problem of having the error numbers be negative inside the
#define E2BIG 7 * the system and positive outside, the following mechanism is used. All the
#define ENOEXEC 8 * definitions are are the form:
#define EBADF 9 *
#define ECHILD 10 * #define EPERM (_SIGN 1)
#define EAGAIN 11 *
#define ENOMEM 12 * If the macro _SYSTEM is defined, then _SIGN is set to "-", otherwise it is
#define EACCES 13 * set to "". Thus when compiling the operating system, the macro _SYSTEM
#define EFAULT 14 * will be defined, setting EPERM to (- 1), whereas when when this
#define ENOTBLK 15 * file is included in an ordinary user program, EPERM has the value ( 1).
#define EBUSY 16 */
#define EEXIST 17
#define EXDEV 18
#define ENODEV 19
#define ENOTDIR 20
#define EISDIR 21
#define EINVAL 22
#define ENFILE 23
#define EMFILE 24
#define ENOTTY 25
#define ETXTBSY 26
#define EFBIG 27
#define ENOSPC 28
#define ESPIPE 29
#define EROFS 30
#define EMLINK 31
#define EPIPE 32
#define EDOM 33
#define ERANGE 34
#define E_LOCKED 101 #ifndef _ERRNO_H /* check if <errno.h> is already included */
#define E_BAD_CALL 102 #define _ERRNO_H /* it is not included; note that fact */
#define E_LONG_STRING 103
/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
#ifdef _SYSTEM
# define _SIGN -
# define OK 0
#else
# define _SIGN
#endif
extern int errno; /* place where the error numbers go */
/* Here are the numerical values of the error numbers. */
#define _NERROR 39 /* number of errors */
#define ERROR (_SIGN 99) /* generic error */
#define EPERM (_SIGN 1) /* operation not permitted */
#define ENOENT (_SIGN 2) /* no such file or directory */
#define ESRCH (_SIGN 3) /* no such process */
#define EINTR (_SIGN 4) /* interrupted function call */
#define EIO (_SIGN 5) /* input/output error */
#define ENXIO (_SIGN 6) /* no such device or address */
#define E2BIG (_SIGN 7) /* arg list too long */
#define ENOEXEC (_SIGN 8) /* exec format error */
#define EBADF (_SIGN 9) /* bad file descriptor */
#define ECHILD (_SIGN 10) /* no child process */
#define EAGAIN (_SIGN 11) /* resource temporarily unavailable */
#define ENOMEM (_SIGN 12) /* not enough space */
#define EACCES (_SIGN 13) /* permission denied */
#define EFAULT (_SIGN 14) /* bad address */
#define ENOTBLK (_SIGN 15) /* Extension: not a block special file */
#define EBUSY (_SIGN 16) /* resource busy */
#define EEXIST (_SIGN 17) /* file exists */
#define EXDEV (_SIGN 18) /* improper link */
#define ENODEV (_SIGN 19) /* no such device */
#define ENOTDIR (_SIGN 20) /* not a directory */
#define EISDIR (_SIGN 21) /* is a directory */
#define EINVAL (_SIGN 22) /* invalid argument */
#define ENFILE (_SIGN 23) /* too many open files in system */
#define EMFILE (_SIGN 24) /* too many open files */
#define ENOTTY (_SIGN 25) /* inappropriate I/O control operation */
#define ETXTBSY (_SIGN 26) /* no longer used */
#define EFBIG (_SIGN 27) /* file too large */
#define ENOSPC (_SIGN 28) /* no space left on device */
#define ESPIPE (_SIGN 29) /* invalid seek */
#define EROFS (_SIGN 30) /* read-only file system */
#define EMLINK (_SIGN 31) /* too many links */
#define EPIPE (_SIGN 32) /* broken pipe */
#define EDOM (_SIGN 33) /* domain error (from ANSI C std) */
#define ERANGE (_SIGN 34) /* result too large (from ANSI C std) */
#define EDEADLK (_SIGN 35) /* resource deadlock avoided */
#define ENAMETOOLONG (_SIGN 36) /* file name too long */
#define ENOLCK (_SIGN 37) /* no locks available */
#define ENOSYS (_SIGN 38) /* function not implemented */
#define ENOTEMPTY (_SIGN 39) /* directory not empty */
/* The following are not POSIX errors, but they can still happen. */
#define ELOCKED (_SIGN 101) /* can't send message */
#define EBADCALL (_SIGN 102) /* error on send/receive */
/* The following error codes are generated by the kernel itself. */
#ifdef _SYSTEM
#define E_BAD_DEST -1 /* destination address illegal */
#define E_BAD_SRC -2 /* source address illegal */
#define E_TRY_AGAIN -3 /* can't send-- tables full */
#define E_OVERRUN -4 /* interrupt for task that is not waiting */
#define E_BAD_BUF -5 /* message buf outside caller's addr space */
#define E_TASK -6 /* can't send to task */
#define E_NO_MESSAGE -7 /* RECEIVE failed: no message present */
#define E_NO_PERM -8 /* ordinary users can't send to tasks */
#define E_BAD_FCN -9 /* only valid fcns are SEND, RECEIVE, BOTH */
#define E_BAD_ADDR -10 /* bad address given to utility routine */
#define E_BAD_PROC -11 /* bad proc number given to utility */
#endif /* _SYSTEM */
#endif /* _ERRNO_H */

68
lib/minix/include/fcntl.h Normal file
View file

@ -0,0 +1,68 @@
/* The <fcntl.h> header is needed by the open() and fcntl() system calls,
* which have a variety of parameters and flags. They are described here.
* The formats of the calls to each of these are:
*
* open(path, oflag [,mode]) open a file
* fcntl(fd, cmd [,arg]) get or set file attributes
*
*/
#ifndef _FCNTL_H
#define _FCNTL_H
/* These values are used for cmd in fcntl(). POSIX Table 6-1. */
#define F_DUPFD 0 /* duplicate file descriptor */
#define F_GETFD 1 /* get file descriptor flags */
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
#define F_GETLK 5 /* get record locking information */
#define F_SETLK 6 /* set record locking information */
#define F_SETLKW 7 /* set record locking info; wait if blocked */
/* File descriptor flags used for fcntl(). POSIX Table 6-2. */
#define FD_CLOEXEC 1 /* close on exec flag for third arg of fcntl */
/* L_type values for record locking with fcntl(). POSIX Table 6-3. */
#define F_RDLCK 0 /* shared or read lock */
#define F_WRLCK 1 /* exclusive or write lock */
#define F_UNLCK 2 /* unlock */
/* Oflag values for open(). POSIX Table 6-4. */
#define O_CREAT 00100 /* creat file if it doesn't exist */
#define O_EXCL 00200 /* exclusive use flag */
#define O_NOCTTY 00400 /* do not assign a controlling terminal */
#define O_TRUNC 01000 /* truncate flag */
/* File status flags for open() and fcntl(). POSIX Table 6-5. */
#define O_APPEND 02000 /* set append mode */
#define O_NONBLOCK 04000 /* no delay */
/* File access modes for open() and fcntl(). POSIX Table 6-6. */
#define O_RDONLY 0 /* open(name, O_RDONLY) opens read only */
#define O_WRONLY 1 /* open(name, O_WRONLY) opens write only */
#define O_RDWR 2 /* open(name, O_RDWR) opens read/write */
/* Mask for use with file access modes. POSIX Table 6-7. */
#define O_ACCMODE 03 /* mask for file access modes */
/* Struct used for locking. POSIX Table 6-8. */
struct flock {
short l_type; /* type: F_RDLCK, F_WRLCK, or F_UNLCK */
short l_whence; /* flag for starting offset */
off_t l_start; /* relative offset in bytes */
off_t l_len; /* size; if 0, then until EOF */
pid_t l_pid; /* process id of the locks' owner */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int creat, (const char *_path, Mode_t _mode) );
_PROTOTYPE( int fcntl, (int _filedes, int _cmd, ...) );
_PROTOTYPE( int open, (const char *_path, int _oflag, ...) );
#endif /* _FCNTL_H */

41
lib/minix/include/lib.h Normal file
View file

@ -0,0 +1,41 @@
/* The <lib.h> header is the master header used by the library.
* All the C files in the lib subdirectories include it.
*/
#ifndef _LIB_H
#define _LIB_H
/* First come the defines. */
#define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */
#define _MINIX 1 /* tell headers to include MINIX stuff */
/* The following are so basic, all the lib files get them automatically. */
#include <minix/config.h> /* must be first */
#include <sys/types.h>
#include <limits.h>
#include <errno.h>
#include <ansi.h>
#include <minix/const.h>
#include <minix/type.h>
#include <minix/callnr.h>
extern message _M;
#define MM 0
#define FS 1
_PROTOTYPE( int __execve, (char *_path, char **_argv, char **_envp,
int _nargs, int _nenvps) );
_PROTOTYPE( int _callm1, (int _proc, int _syscallnr,
int _int1, int _int2, int _int3,
char *_ptr1, char *_ptr2, char *_ptr3) );
_PROTOTYPE( int _callm3, (int _proc, int _syscallnr, int _int1,
const char *_name) );
_PROTOTYPE( int _callx, (int _proc, int _syscallnr) );
_PROTOTYPE( int _len, (const char *_s) );
_PROTOTYPE( void panic, (const char *_message, int _errnum) );
_PROTOTYPE( int _sendrec, (int _src_dest, message *_m_ptr) );
_PROTOTYPE( void _begsig, (int _dummy) );
#endif /* _LIB_H */

View file

@ -0,0 +1,69 @@
/* The <limits.h> header defines some basic sizes, both of the language types
* (e.g., the number of bits in an integer), and of the operating system (e.g.
* the number of characters in a file name.
*/
#ifndef _LIMITS_H
#define _LIMITS_H
/* Definitions about chars (8 bits in MINIX, and signed). */
#define CHAR_BIT 8 /* # bits in a char */
#define CHAR_MIN -128 /* minimum value of a char */
#define CHAR_MAX 127 /* maximum value of a char */
#define SCHAR_MIN -128 /* minimum value of a signed char */
#define SCHAR_MAX 127 /* maximum value of a signed char */
#define UCHAR_MAX 255 /* maximum value of an unsigned char */
#define MB_LEN_MAX 1 /* maximum length of a multibyte char */
/* Definitions about shorts (16 bits in MINIX). */
#define SHRT_MIN (-32767-1) /* minimum value of a short */
#define SHRT_MAX 32767 /* maximum value of a short */
#define USHRT_MAX 0xFFFF /* maximum value of unsigned short */
#if _EM_WSIZE == 4
#define INT_MIN (-2147483647-1)
#define INT_MAX 2147483647
#define UINT_MAX 0xFFFFFFFF
#else /* _EM_WSIZE == 2 */
/* Definitions about ints (16 bits in MINIX for 8088, 80286, Atari etc) */
#define INT_MIN (-32767-1) /* minimum value of an int */
#define INT_MAX 32767 /* maximum value of an int */
#define UINT_MAX 0xFFFF /* maximum value of an unsigned int */
#endif
/*Definitions about longs (32 bits in MINIX). */
#define LONG_MIN (-2147483647L-1)/* minimum value of a long */
#define LONG_MAX 2147483647L /* maximum value of a long */
#define ULONG_MAX 0xFFFFFFFFL /* maximum value of an unsigned long */
/* Minimum sizes required by the POSIX P1003.1 standard (Table 2-2). */
#ifdef _POSIX_SOURCE /* these are only visible for POSIX */
#define _POSIX_ARG_MAX 4096 /* exec() may have 4K worth of args */
#define _POSIX_CHILD_MAX 6 /* a process may have 6 children */
#define _POSIX_LINK_MAX 8 /* a file may have 8 links */
#define _POSIX_MAX_CANON 255 /* size of the canonical input queue */
#define _POSIX_MAX_INPUT 255 /* you can type 255 chars ahead */
#define _POSIX_NAME_MAX 14 /* a file name may have 14 chars */
#define _POSIX_NGROUPS_MAX 0 /* supplementary group IDs are optional */
#define _POSIX_OPEN_MAX 16 /* a process may have 16 files open */
#define _POSIX_PATH_MAX 255 /* a pathname may contain 255 chars */
#define _POSIX_PIPE_BUF 512 /* pipes writes of 512 bytes must be atomic */
/* Values actually implemented by MINIX (Tables 2-3, 2-4, and 2-5). */
/* Some of these old names had better be defined when not POSIX. */
#define _NO_LIMIT 100 /* arbitrary number; limit not enforced */
#define NGROUPS_MAX 0 /* supplemental group IDs not available */
#define ARG_MAX 4096 /* # bytes of args + environ for exec() */
#define CHILD_MAX _NO_LIMIT /* MINIX does not limit children */
#define OPEN_MAX 20 /* # open files a process may have */
#define LINK_MAX 127 /* # links a file may have */
#define MAX_CANON 255 /* size of the canonical input queue */
#define MAX_INPUT 255 /* size of the type-ahead buffer */
#define NAME_MAX 14 /* # chars in a file name */
#define PATH_MAX 255 /* # chars in a path name */
#define PIPE_BUF 7168 /* # bytes in atomic write to a pipe */
#endif /* _POSIX_SOURCE */
#endif /* _LIMITS_H */

View file

@ -1,4 +1,7 @@
/* Data structures for IOCTL. */ /* The <sgtty.h> header contains data structures for ioctl(). */
#ifndef _SGTTY_H
#define _SGTTY_H
struct sgttyb { struct sgttyb {
char sg_ispeed; /* input speed */ char sg_ispeed; /* input speed */
@ -31,7 +34,10 @@ struct tchars {
#define CBREAK 0000002 /* enable cbreak mode */ #define CBREAK 0000002 /* enable cbreak mode */
#define COOKED 0000000 /* neither CBREAK nor RAW */ #define COOKED 0000000 /* neither CBREAK nor RAW */
#define DCD 0100000 /* Data Carrier Detect */
/* Line speeds */ /* Line speeds */
#define B0 0 /* code for line-hangup */
#define B110 1 #define B110 1
#define B300 3 #define B300 3
#define B1200 12 #define B1200 12
@ -43,3 +49,48 @@ struct tchars {
#define TIOCSETP (('t'<<8) | 9) #define TIOCSETP (('t'<<8) | 9)
#define TIOCGETC (('t'<<8) | 18) #define TIOCGETC (('t'<<8) | 18)
#define TIOCSETC (('t'<<8) | 17) #define TIOCSETC (('t'<<8) | 17)
#define TIOCFLUSH (('t'<<8) | 16)
/* Things Minix supports but not properly */
/* the divide-by-100 encoding ain't too hot */
#define ANYP 0000300
#define B50 0
#define B75 0
#define B134 0
#define B150 0
#define B200 2
#define B600 6
#define B1800 18
#define B3600 36
#define B7200 72
#define EXTA 192
#define EXTB 0
/* Things Minix doesn't support but are fairly harmless if used */
#define NLDELAY 0001400
#define TBDELAY 0006000
#define CRDELAY 0030000
#define VTDELAY 0040000
#define BSDELAY 0100000
#define ALLDELAY 0177400
#if MACHINE == ATARI
/* ST specific clock stuff */
#define DCLOCK ('D'<<8)
#define DC_RBMS100 (DCLOCK|1)
#define DC_RBMS200 (DCLOCK|2)
#define DC_RSUPRA (DCLOCK|3)
#define DC_RICD (DCLOCK|4)
#define DC_WBMS100 (DCLOCK|8)
#define DC_WBMS200 (DCLOCK|9)
#endif
#include <ansi.h>
_PROTOTYPE( int gtty, (int _fd, struct sgttyb *_argp) );
_PROTOTYPE( int ioctl, (int _fd, int _request, struct sgttyb *_argp) );
_PROTOTYPE( int stty, (int _fd, struct sgttyb *_argp) );
#endif /* _SGTTY_H */

View file

@ -1,24 +1,114 @@
#define NSIG 16 /* number of signals used */ /* The <signal.h> header defines all the ANSI and POSIX signals.
* MINIX supports all the signals required by POSIX. They are defined below.
* Some additional signals are also supported.
*/
#define SIGHUP 1 /* hangup */ #ifndef _SIGNAL_H
#define _SIGNAL_H
/* Here are types that are closely associated with signal handling. */
typedef int sig_atomic_t;
#ifdef _POSIX_SOURCE
typedef unsigned short sigset_t;
#endif
#define _NSIG 16 /* number of signals used */
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt (DEL) */ #define SIGINT 2 /* interrupt (DEL) */
#define SIGQUIT 3 /* quit (ASCII FS) */ #define SIGQUIT 3 /* quit (ASCII FS) */
#define SIGILL 4 /* illegal instruction (not reset when caught)*/ #define SIGILL 4 /* illegal instruction */
#define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGIOT 6 /* IOT instruction */ #define SIGABRT 6 /* IOT instruction */
#define SIGEMT 7 /* EMT instruction */ #define SIGIOT 6 /* SIGABRT for people who speak PDP-11 */
#define SIGUNUSED 7 /* spare code */
#define SIGFPE 8 /* floating point exception */ #define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */ #define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */ #define SIGUSR1 10 /* user defined signal # 1 */
#define SIGSEGV 11 /* segmentation violation */ #define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */ #define SIGUSR2 12 /* user defined signal # 2 */
#define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */ #define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */ #define SIGTERM 15 /* software termination signal from kill */
#define SIGSTKFLT 16 /* used by kernel to indicate stack fault */
#define STACK_FAULT 16 /* used by kernel to signal stack fault */ #define SIGEMT 7 /* obsolete */
#define NR_SIGS NSIG #define SIGBUS 10 /* obsolete */
int (*signal())(); /* POSIX requires the following signals to be defined, even if they are
#define SIG_DFL (int (*)())0 * not supported. Here are the definitions, but they are not supported.
#define SIG_IGN (int (*)())1 */
#define SIGCHLD 17 /* child process terminated or stopped */
#define SIGCONT 18 /* continue if stopped */
#define SIGSTOP 19 /* stop signal */
#define SIGTSTP 20 /* interactive stop signal */
#define SIGTTIN 21 /* background process wants to read */
#define SIGTTOU 22 /* background process wants to write */
#ifdef _POSIX_SOURCE
#define SA_NOCLDSTOP 1 /* signal parent if child stops */
#endif /* _POSIX_SOURCE */
/* POSIX requires these values for use on system calls involving signals. */
#define SIG_BLOCK 0 /* for blocking signals */
#define SIG_UNBLOCK 1 /* for unblocking signals */
#define SIG_SETMASK 2 /* for setting the signal mask */
#ifndef _ANSI_H
#include <ansi.h>
#endif
/* Macros used as function pointers and one awful prototype. */
#if _ANSI
#define SIG_DFL ((void (*)(int))0) /* default signal handling */
#define SIG_IGN ((void (*)(int))1) /* ignore signal */
#define SIG_ERR ((void (*)(int))-1)
void (*signal(int _sig, void (*_func)(int)))(int);
#ifdef _POSIX_SOURCE
struct sigaction {
void (*sa_handler)(int); /* SIG_DFL, SIG_IGN, or pointer to function */
sigset_t sa_mask; /* signals to be blocked during handler */
int sa_flags; /* special flags */
};
#endif
#else /* !_ANSI */
#define SIG_DFL ((void (*)())0) /* default signal handling */
#define SIG_IGN ((void (*)())1) /* ignore signal */
#define SIG_ERR ((void (*)())-1)
void (*signal()) ();
#ifdef _POSIX_SOURCE /* otherwise sigset_t is not defined */
struct sigaction {
void (*sa_handler)(); /* SIG_DFL, SIG_IGN, or pointer to function */
sigset_t sa_mask; /* signals to be blocked during handler */
int sa_flags; /* special flags */
};
#endif
#endif /* _ANSI */
/* Function Prototypes. */
_PROTOTYPE( int raise, (int _sig) );
#ifdef _POSIX_SOURCE
_PROTOTYPE( int kill, (pid_t _pid, int _sig) );
_PROTOTYPE( int sigaddset, (sigset_t *_set) );
_PROTOTYPE( int sigdelset, (sigset_t *_set) );
_PROTOTYPE( int sigemptyset, (sigset_t *_set) );
_PROTOTYPE( int sigfillset, (sigset_t *_set) );
_PROTOTYPE( int sigismember, (sigset_t *_set, int _signo) );
_PROTOTYPE( int sigpending, (sigset_t *set) );
_PROTOTYPE( int sigprocmask, (int _how, sigset_t *_set, sigset_t *_oset));
_PROTOTYPE( int sigsuspend, (sigset_t *_sigmask) );
_PROTOTYPE( int sigaction,
(int _sig, struct sigaction *_a, struct sigaction *_oact) );
#endif
#endif /* _SIGNAL_H */

View file

@ -0,0 +1,55 @@
/* The <string.h> header contains prototypes for the string handling
* functions.
*/
#ifndef _STRING_H
#define _STRING_H
#define NULL ((void *)0)
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif /*_SIZE_T */
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( void *memcpy, (void *_s1, const void *_s2, size_t _n) );
_PROTOTYPE( void *memmove, (void *_s1, const void *_s2, size_t _n) );
_PROTOTYPE( char *strcpy, (char *_s1, const char *_s2) );
_PROTOTYPE( char *strncpy, (char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( char *strcat, (char *_s1, const char *_s2) );
_PROTOTYPE( char *strncat, (char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( int memcmp, (const void *_s1, const void *_s2, size_t _n) );
_PROTOTYPE( int strcmp, (const char *_s1, const char *_s2) );
_PROTOTYPE( int strcoll, (const char *_s1, const char *_s2) );
_PROTOTYPE( int strncmp, (const char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( size_t strxfrm, (char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( void *memchr, (const void *_s, int _c, size_t _n) );
_PROTOTYPE( char *strchr, (const char *_s, int _c) );
_PROTOTYPE( size_t strcspn, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strpbrk, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strrchr, (const char *_s, int _c) );
_PROTOTYPE( size_t strspn, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strstr, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strtok, (char *_s1, const char *_s2) );
_PROTOTYPE( void *memset, (void *_s, int _c, size_t _n) );
_PROTOTYPE( char *strerror, ( int _errnum) );
_PROTOTYPE( size_t strlen, (const char *_s) );
#ifdef _MINIX
/* For backward compatibility. */
_PROTOTYPE( char *index, (const char *_s, int _charwanted) );
_PROTOTYPE( char *rindex, (const char *_s, int _charwanted) );
_PROTOTYPE( void bcopy, (const char *_src, char *_dst, int _length) );
_PROTOTYPE( int bcmp, (const char *_s1, const char *_s2, int _length) );
_PROTOTYPE( void bzero, (char *_dst, int _length) );
_PROTOTYPE( void *memccpy, (char *_dst, const char *_src, int _ucharstop,
size_t _size) );
#endif
#endif /* _STRING_H */

66
lib/minix/include/time.h Normal file
View file

@ -0,0 +1,66 @@
/* The <time.h> header is used by the procedures that deal with time.
* Handling time is surprisingly complicated, what with GMT, local time
* and other factors. Although the Bishop of Ussher (1581-1656) once
* calculated that based on the Bible, the world began on 12 Oct. 4004 BC
* at 9 o'clock in the morning, in the UNIX world time begins at midnight,
* 1 Jan. 1970 GMT. Before that, all was NULL and (void).
*/
#ifndef _TIME_H
#define _TIME_H
#define CLOCKS_PER_SEC 60 /* MINIX always uses 60 Hz, even in Europe */
#ifdef _POSIX_SOURCE
#define CLK_TCK CLOCKS_PER_SEC
#endif
#define NULL ((void *)0)
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#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; /* time in ticks since process started */
#endif
struct tm {
int tm_sec; /* seconds after the minute [0, 59] */
int tm_min; /* minutes after the hour [0, 59] */
int tm_hour; /* hours since midnight [0, 23] */
int tm_mday; /* day of the month [1, 31] */
int tm_mon; /* months since January [0, 11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday [0, 6] */
int tm_yday; /* days since January 1 [0, 365] */
int tm_isdst; /* Daylight Saving Time flag */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( clock_t clock, (void) );
_PROTOTYPE( double difftime, (time_t _time1, time_t _time0) );
_PROTOTYPE( time_t mktime, (struct tm *_timeptr) );
_PROTOTYPE( time_t time, (time_t *_timeptr) );
_PROTOTYPE( char *asctime, (const struct tm *_timeptr) );
_PROTOTYPE( char *ctime, (const time_t *_timer) );
_PROTOTYPE( struct tm *gmtime, (const time_t *_timer) );
_PROTOTYPE( struct tm *localtime, (const time_t *_timer) );
_PROTOTYPE( size_t strftime, (char *_s, size_t _max, const char *_fmt,
const struct tm *_timep) );
#ifdef _POSIX_SOURCE
_PROTOTYPE( void tzset, (void) );
#endif
#endif /* _TIME_H */

19
lib/minix/include/utime.h Normal file
View file

@ -0,0 +1,19 @@
/* The <utime.h> header is used for the utime() system call. */
#ifndef _UTIME_H
#define _UTIME_H
struct utimbuf {
time_t actime; /* access time */
time_t modtime; /* modification time */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int utime, (char *_path, struct utimbuf *_times) );
#endif /* _UTIME_H */

View file

@ -1,4 +1,11 @@
ansi.h
fcntl.h
limits.h
lib.h
errno.h errno.h
minix minix
sgtty.h sgtty.h
signal.h signal.h
string.h
time.h
utime.h