Initial revision

This commit is contained in:
eck 1989-12-18 13:50:55 +00:00
parent c98a786cc4
commit 09a352c151
5 changed files with 321 additions and 0 deletions

View file

@ -0,0 +1,4 @@
dirent.h
errno.h
stat.h
types.h

View file

@ -0,0 +1,34 @@
/*
<sys/dirent.h> -- file system independent directory entry (SVR3)
last edit: 25-Apr-1987 D A Gwyn
prerequisite: <sys/types.h>
*/
#if !defined(_SYS_DIRENT_H)
#define _SYS_DIRENT_H
struct dirent /* data from getdents()/readdir() */
{
long d_ino; /* inode number of entry */
off_t d_off; /* offset of disk directory entry */
unsigned short d_reclen; /* length of this record */
char d_name[1]; /* name of file */ /* non-POSIX */
};
/* The following nonportable ugliness could have been avoided by defining
DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments. */
#define DIRENTBASESIZ (((struct dirent *)0)->d_name \
- (char *)&((struct dirent *)0)->d_ino)
#define DIRENTSIZ( namlen ) ((DIRENTBASESIZ + sizeof(long) + (namlen)) \
/ sizeof(long) * sizeof(long))
/* DAG -- the following was moved from <dirent.h>, which was the wrong place */
#define MAXNAMLEN 512 /* maximum filename length */
#if !defined(NAME_MAX)
#define NAME_MAX (MAXNAMLEN - 1) /* DAG -- added for POSIX */
#endif
#endif /* _SYS_DIRENT_H */

View file

@ -0,0 +1,131 @@
/*
* sys/errno.h - error numbers
*/
/* $Header$ */
#if !defined(_SYS_ERRNO_H)
#define _SYS_ERRNO_H
#define EPERM 1 /* Not owner */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No children */
#define EAGAIN 11 /* No more processes */
#define ENOMEM 12 /* Not enough core */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Mount device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory*/
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#if defined(__USG)
/* Only ENOMSG, EIDRM and EDEADLK are documented */
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier Removed */
#define ECHRNG 37 /* Channel number out of range */
#define EL2NSYNC 38 /* Level 2 not synchronized */
#define EL3HLT 39 /* Level 3 halted */
#define EL3RST 40 /* Level 3 reset */
#define ELNRNG 41 /* Link number out of range */
#define EUNATCH 42 /* Protocol driver not attached */
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
#define EDEADLK 45 /* DeadLock */
#endif /* __USG */
#if defined(__BDS4_2)
/* non-blocking and interrupt i/o */
#define EWOULDBLOCK 35 /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
/* ipc/network software */
/* argument errors */
#define ENOTSOCK 38 /* Socket operation on non-socket */
#define EDESTADDRREQ 39 /* Destination address required */
#define EMSGSIZE 40 /* Message too long */
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
#define EOPNOTSUPP 45 /* Operation not supported on socket */
#define EPFNOSUPPORT 46 /* Protocol family not supported */
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
#define EADDRINUSE 48 /* Address already in use */
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
/* operational errors */
#define ENETDOWN 50 /* Network is down */
#define ENETUNREACH 51 /* Network is unreachable */
#define ENETRESET 52 /* Network dropped connection on reset */
#define ECONNABORTED 53 /* Software caused connection abort */
#define ECONNRESET 54 /* Connection reset by peer */
#define ENOBUFS 55 /* No buffer space available */
#define EISCONN 56 /* Socket is already connected */
#define ENOTCONN 57 /* Socket is not connected */
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
/* ETOOMANYREFS is not documented */
#define ETOOMANYREFS 59 /* Too many references: can't splice */
#define ETIMEDOUT 60 /* Connection timed out */
#define ECONNREFUSED 61 /* Connection refused */
/* */
#define ELOOP 62 /* Too many levels of symbolic links */
#define ENAMETOOLONG 63 /* File name too long */
/* In BSD4.2, ENOTEMPTY is defined as 64. */
/* Just use BSD4.3 & Sun UNIX 4.2 definitions */
#define EHOSTDOWN 64 /* Host is down */
#define EHOSTUNREACH 65 /* No route to host */
#define ENOTEMPTY 66 /* Directory not empty */
/* quotas & mush */
/* EPROCLIM and EUSERS are not documented */
#define EPROCLIM 67 /* Too many processes */
#define EUSERS 68 /* Too many users */
#define EDQUOT 69 /* Disc quota exceeded */
/* Network File System */
#define ESTALE 70 /* Stale NFS file handle */
#define EREMOTE 71 /* Too many levels of remote in path */
/* streams */
/* only ENOMSG is documented */
#define ENOSTR 72 /* Device is not a stream */
#define ETIME 73 /* Timer expired */
#define ENOSR 74 /* Out of streams resources */
#define ENOMSG 75 /* No message of desired type */
#define EBADMSG 76 /* Trying to read unreadable message */
#define EIDRM 77 /* Identifier removed */
/* SystemV Record Locking */
#define EDEADLK 78 /* Deadlock condition. */
#define ENOLCK 79 /* No record locks available. */
#endif /* __BSD4_2 */
extern int errno; /* error number */
#endif /* _SYS_ERRNO_H */

View file

@ -0,0 +1,85 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#if !defined(_SYS_STAT_H)
#define _SYS_STAT_H
struct stat {
dev_t st_dev;
ino_t st_ino;
u_short st_mode;
short st_nlink;
short st_uid;
short st_gid;
dev_t st_rdev;
off_t st_size;
time_t st_atime;
#if defined(__BSD4_2)
long st_spare1;
#endif
time_t st_mtime;
#if defined(__BSD4_2)
long st_spare2;
#endif
time_t st_ctime;
#if defined(__BSD4_2)
long st_spare3;
long st_blksize;
long st_blocks;
long st_spare4[2];
#endif
};
#define S_IFMT 0170000
#define S_IFDIR 0040000
#define S_IFCHR 0020000
#define S_IFBLK 0060000
#define S_IFREG 0100000
#if !defined(__BSD4_2)
#if !defined(__USG) && !defined(_POSIX_SOURCE)
#define S_IFMPC 0030000
#define S_IFMPB 0070000
#else
#define S_IFIFO 0010000
#endif
#else
#define S_IFLNK 0120000
#define S_IFSOCK 0140000
#endif
#define S_ISUID 0004000
#define S_ISGID 0002000
#define S_ISVTX 0001000
#define S_IREAD 0000400
#define S_IWRITE 0000200
#define S_IEXEC 0000100
#if defined(__BSD4_2) || defined(_POSIX_SOURCE)
#define S_IRWXU 00700 /* owner: rwx------ */
#define S_IRUSR 00400 /* owner: r-------- */
#define S_IWUSR 00200 /* owner: -w------- */
#define S_IXUSR 00100 /* owner: --x------ */
#define S_IRWXG 00070 /* group: ---rwx--- */
#define S_IRGRP 00040 /* group: ---r----- */
#define S_IWGRP 00020 /* group: ----w---- */
#define S_IXGRP 00010 /* group: -----x--- */
#define S_IRWXO 00007 /* others: ------rwx */
#define S_IROTH 00004 /* others: ------r-- */
#define S_IWOTH 00002 /* others: -------w- */
#define S_IXOTH 00001 /* others: --------x */
#if defined(_POSIX_SOURCE)
/* The following macros test st_mode (from POSIX Sec. 5.6.1.1.) */
#define S_ISREG(m) ((m & S_IFMT) == S_IFREG) /* is a reg file */
#define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) /* is a directory */
#define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR) /* is a char spec */
#define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK) /* is a block spec */
#define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO) /* is a pipe/FIFO */
#endif /* _POSIX_SOURCE */
#endif /* BSD4_2 || _POSIX_SOURCE */
#endif /* _SYS_STAT_H */

View file

@ -0,0 +1,67 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/*
* Basic system types and major/minor device constructing/busting macros.
*/
/* $Header$ */
#if !defined(_SYS_TYPES_H)
#define _SYS_TYPES_H
/* major part of a device */
#define major(x) ((int)(((unsigned)(x)>>8)&0377))
/* minor part of a device */
#define minor(x) ((int)((x)&0377))
/* make a device number */
#define makedev(x,y) ((dev_t)(((x)<<8) | (y)))
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef struct _physadr { int r[1]; } *physadr;
typedef long daddr_t;
typedef char * caddr_t;
#if defined(__BSD4_2)
typedef u_long ino_t;
#else
typedef u_short ino_t;
#endif
typedef long swblk_t;
#if !defined(_SIZE_T)
#define _SIZE_T
#if _EM_WSIZE == _EM_PSIZE
typedef unsigned int size_t; /* type returned by sizeof */
#else
typedef unsigned long size_t; /* type returned by sizeof */
#endif
#endif /* _SIZE_T */
#if !defined(_TIME_T)
#define _TIME_T
typedef unsigned long time_t;
#endif /* TIME_T */
typedef long label_t[14];
typedef short dev_t;
#if defined(__BSD4_2)
typedef int off_t; /* see lseek(2) */
#else
typedef long off_t;
#endif
/* system V compatibility: */
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned char uchar_t;
typedef short cnt_t;
typedef long paddr_t;
typedef long key_t;
#endif /* _SYS_TYPES_H */