-/* $Id: dirent.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
+/* $Id: dirent.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* dirent.h
/* INCLUDES */
#include <sys/types.h>
#include <stddef.h>
+#include <limits.h>
/* TYPES */
typedef void DIR;
struct dirent
{
- ino_t d_ino; /* file serial number */
- char *d_name; /* name of entry */
+ ino_t d_ino; /* file serial number */
+ char d_name[NAME_MAX + 1]; /* name of entry */
};
/* for Unicode filenames */
struct _Wdirent
{
- ino_t d_ino; /* file serial number */
- wchar_t *d_name; /* name of entry */
+ ino_t d_ino; /* file serial number */
+ wchar_t d_name[NAME_MAX + 1]; /* name of entry */
};
/* CONSTANTS */
-/* $Id: errno.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
+/* $Id: errno.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* errno.h
/* TYPES */
/* CONSTANTS */
-#define E2BIG ( 1) /* Argument list too long. */
-#define EACCES ( 2) /* Permission denied. */
-#define EADDRINUSE ( 3) /* Address in use. */
-#define EADDRNOTAVAIL ( 4) /* Address not available. */
-#define EAFNOSUPPORT ( 5) /* Address family not supported. */
-#define EAGAIN ( 6) /* Resource unavailable, try again */
-#define EALREADY ( 7) /* Connection already in progress. */
-#define EBADF ( 8) /* Bad file descriptor. */
-#define EBADMSG ( 9) /* Bad message. */
-#define EBUSY (10) /* Device or resource busy. */
-#define ECANCELED (11) /* Operation canceled. */
-#define ECHILD (12) /* No child processes. */
-#define ECONNABORTED (13) /* Connection aborted. */
-#define ECONNREFUSED (14) /* Connection refused. */
-#define ECONNRESET (15) /* Connection reset. */
-#define EDEADLK (16) /* Resource deadlock would occur. */
-#define EDESTADDRREQ (17) /* Destination address required. */
-#define EDOM (18) /* Mathematics argument out of domain of function. */
-#define EDQUOT (19) /* Reserved. */
-#define EEXIST (20) /* File exists. */
-#define EFAULT (21) /* Bad address. */
-#define EFBIG (22) /* File too large. */
-#define EHOSTUNREACH (23) /* Host is unreachable. */
-#define EIDRM (24) /* Identifier removed. */
-#define EILSEQ (25) /* Illegal byte sequence. */
-#define EINPROGRESS (26) /* Operation in progress. */
-#define EINTR (27) /* Interrupted function. */
-#define EINVAL (28) /* Invalid argument. */
-#define EIO (29) /* I/O error. */
-#define EISCONN (30) /* Socket is connected. */
-#define EISDIR (31) /* Is a directory. */
-#define ELOOP (32) /* Too many levels of symbolic links. */
-#define EMFILE (33) /* Too many open files. */
-#define EMLINK (34) /* Too many links. */
-#define EMSGSIZE (35) /* Message too large. */
-#define EMULTIHOP (36) /* Reserved. */
-#define ENAMETOOLONG (37) /* Filename too long. */
-#define ENETDOWN (38) /* Network is down. */
-#define ENETUNREACH (39) /* Network unreachable. */
-#define ENFILE (40) /* Too many files open in system. */
-#define ENOBUFS (41) /* No buffer space available. */
-#define ENODATA (42) /* No message is available on the STREAM head read queue. */
-#define ENODEV (43) /* No such device. */
-#define ENOENT (44) /* No such file or directory. */
-#define ENOEXEC (45) /* Executable file format error. */
-#define ENOLCK (46) /* No locks available. */
-#define ENOLINK (47) /* Reserved. */
-#define ENOMEM (48) /* Not enough space. */
-#define ENOMSG (49) /* No message of the desired type. */
-#define ENOPROTOOPT (50) /* Protocol not available. */
-#define ENOSPC (51) /* No space left on device. */
-#define ENOSR (52) /* No STREAM resources. */
-#define ENOSTR (53) /* Not a STREAM. */
-#define ENOSYS (54) /* Function not supported. */
-#define ENOTCONN (55) /* The socket is not connected. */
-#define ENOTDIR (56) /* Not a directory. */
-#define ENOTEMPTY (57) /* Directory not empty. */
-#define ENOTSOCK (58) /* Not a socket. */
-#define ENOTSUP (59) /* Not supported. */
-#define ENOTTY (60) /* Inappropriate I/O control operation. */
-#define ENXIO (61) /* No such device or address. */
-#define EOPNOTSUPP (62) /* Operation not supported on socket. */
-#define EOVERFLOW (63) /* Value too large to be stored in data type. */
-#define EPERM (64) /* Operation not permitted. */
-#define EPIPE (65) /* Broken pipe. */
-#define EPROTO (66) /* Protocol error. */
-#define EPROTONOSUPPORT (67) /* Protocol not supported. */
-#define EPROTOTYPE (68) /* Socket type not supported. */
-#define ERANGE (69) /* Result too large. */
-#define EROFS (70) /* Read-only file system. */
-#define ESPIPE (71) /* Invalid seek. */
-#define ESRCH (72) /* No such process. */
-#define ESTALE (73) /* Reserved. */
-#define ETIME (74) /* Streamioctl()timeout. */
-#define ETIMEDOUT (75) /* Connection timed out. */
-#define ETXTBSY (76) /* Text file busy. */
-#define EWOULDBLOCK (77) /* Operation would block */
-#define EXDEV (78) /* Cross-device link. */
+/* errors from 0 to 42 are the same as in Microsoft POSIX */
+#define EZERO ( 0) /* No error. */
+#define EPERM ( 1) /* Operation not permitted. */
+#define ENOENT ( 2) /* No such file or directory. */
+#define ESRCH ( 3) /* No such process. */
+#define EINTR ( 4) /* Interrupted function. */
+#define EIO ( 5) /* I/O error. */
+#define ENXIO ( 6) /* No such device or address. */
+#define E2BIG ( 7) /* Argument list too long. */
+#define ENOEXEC ( 8) /* Executable file format error. */
+#define EBADF ( 9) /* Bad file descriptor. */
+#define ECHILD ( 10) /* No child processes. */
+#define EAGAIN ( 11) /* Resource unavailable, try again */
+#define ENOMEM ( 12) /* Not enough space. */
+#define EACCES ( 13) /* Permission denied. */
+#define EFAULT ( 14) /* Bad address. */
+#define ENOTBLK ( 15) /* Reserved. */
+#define EBUSY ( 16) /* Device or resource 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) /* Too many files open in system. */
+#define EMFILE ( 24) /* Too many open files. */
+#define ENOTTY ( 25) /* Inappropriate I/O control operation. */
+#define ETXTBSY ( 26) /* Text file busy. */
+#define EFBIG ( 27) /* File too large. */
+#define ENOSPC ( 28) /* No space left on device. */
+#define ESPIPE ( 29) /* Invalid seek. */
+#define EROFS ( 30) /* Read-only file system. */
+#define EMLINK ( 31) /* Too many links. */
+#define EPIPE ( 32) /* Broken pipe. */
+#define EDOM ( 33) /* Mathematics argument out of domain of function. */
+#define ERANGE ( 34) /* Result too large. */
+#define EUCLEAN ( 35) /* Reserved. */
+#define EDEADLK ( 36) /* Resource deadlock would occur. */
+#define UNKNOWN ( 37) /* Reserved. */
+#define ENAMETOOLONG ( 38) /* Filename too long. */
+#define ENOLCK ( 39) /* No locks available. */
+#define ENOSYS ( 40) /* Function not supported. */
+#define ENOTEMPTY ( 41) /* Directory not empty. */
+#define EILSEQ ( 42) /* Illegal byte sequence. */
+/* from this point, constants are in no particular order */
+#define ENODATA ( 44) /* No message is available on the STREAM head read queue. */
+#define ENOSR ( 45) /* No STREAM resources. */
+#define ENOSTR ( 46) /* Not a STREAM. */
+#define ECANCELED ( 47) /* Operation canceled. */
+#define ENOBUFS ( 48) /* No buffer space available. */
+#define EOVERFLOW ( 49) /* Value too large to be stored in data type. */
+#define ENOTSUP ( 50) /* Not supported. */
+#define EADDRINUSE ( 51) /* Address in use. */
+#define EADDRNOTAVAIL ( 52) /* Address not available. */
+#define EAFNOSUPPORT ( 53) /* Address family not supported. */
+#define ECONNABORTED ( 54) /* Connection aborted. */
+#define ECONNREFUSED ( 55) /* Connection refused. */
+#define ECONNRESET ( 56) /* Connection reset. */
+#define EALREADY ( 57) /* Connection already in progress. */
+#define EDESTADDRREQ ( 58) /* Destination address required. */
+#define EHOSTUNREACH ( 59) /* Host is unreachable. */
+#define EISCONN ( 60) /* Socket is connected. */
+#define ENETDOWN ( 61) /* Network is down. */
+#define ENETUNREACH ( 62) /* Network unreachable. */
+#define ENOPROTOOPT ( 63) /* Protocol not available. */
+#define ENOTCONN ( 64) /* The socket is not connected. */
+#define ENOTSOCK ( 65) /* Not a socket. */
+#define EPROTO ( 66) /* Protocol error. */
+#define EPROTONOSUPPORT ( 67) /* Protocol not supported. */
+#define EPROTOTYPE ( 68) /* Socket type not supported. */
+#define EOPNOTSUPP ( 69) /* Operation not supported on socket. */
+#define ETIMEDOUT ( 70) /* Connection timed out. */
+#define EINPROGRESS ( 71) /* Operation in progress. */
+#define EBADMSG ( 72) /* Bad message. */
+#define EMSGSIZE ( 73) /* Message too large. */
+#define ENOMSG ( 74) /* No message of the desired type. */
+#define EDQUOT ( 75) /* Reserved. */
+#define EIDRM ( 76) /* Identifier removed. */
+#define ELOOP ( 77) /* Too many levels of symbolic links. */
+#define EMULTIHOP ( 78) /* Reserved. */
+#define ENOLINK ( 79) /* Reserved. */
+#define ESTALE ( 80) /* Reserved. */
+#define ETIME ( 81) /* Streamioctl() timeout. */
+#define EWOULDBLOCK ( 82) /* Operation would block */
+
+#define EDEADLOCK EDEADLK /* Resource deadlock avoided */
/* PROTOTYPES */
int * __PdxGetThreadErrNum(void); /* returns a pointer to the current thread's errno */
-/* $Id: fcntl.h,v 1.3 2002/03/21 22:50:06 hyperion Exp $
+/* $Id: fcntl.h,v 1.4 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* fcntl.h
{
F_DUPFD, /* duplicate file descriptor */
F_GETFD, /* get file descriptor flags */
+ F_GETLK, /* get record locking information */
F_SETFD, /* set file descriptor flags */
F_GETFL, /* get file status flags and file access modes */
F_SETFL, /* set file status flags */
- F_GETLK, /* get record locking information */
F_SETLK, /* set record locking information */
F_SETLKW, /* set record locking information; wait if blocked */
/* ReactOS-specific */
file flags used for open()
*/
/* Create file if it does not exist. */
-#define O_CREAT (0x00000001)
+#define O_CREAT (0x00000100)
+/* Truncate flag. */
+#define O_TRUNC (0x00000200)
/* Exclusive use flag. */
-#define O_EXCL (0x00000002)
+#define O_EXCL (0x00000400)
/* Do not assign controlling terminal. */
-#define O_NOCTTY (0x00000004)
-/* Truncate flag. */
-#define O_TRUNC (0x00000008)
+#define O_NOCTTY (0x00000800)
/* ReactOS-specific */
/* File must be a directory */
-#define _O_DIRFILE (0x00000010)
+#define _O_DIRFILE (0x00100000)
/*
file status flags used for open() and fcntl()
*/
/* Set append mode. */
-#define O_APPEND (0x00000100)
-/* Write according to synchronised I/O data integrity completion. */
-#define O_DSYNC (0x00000200)
+#define O_APPEND (0x00000008)
/* Non-blocking mode. */
-#define O_NONBLOCK (0x00000400)
+#define O_NONBLOCK (0x00001000)
+/* Write according to synchronised I/O data integrity completion. */
+#define O_DSYNC (0x00002000)
/* Synchronised read I/O operations. */
-#define O_RSYNC (0x00000800)
+#define O_RSYNC (0x00004000)
/* Write according to synchronised I/O file integrity completion. */
-#define O_SYNC (0x00001000)
+#define O_SYNC (0x00008000)
/*
file access modes used for open() and fcntl()
*/
/* Open for reading only. */
-#define O_RDONLY (0x01000000)
-/* Open for reading and writing. */
-#define O_RDWR (0x02000000)
+#define O_RDONLY (0x00000000)
/* Open for writing only. */
-#define O_WRONLY (0x04000000)
+#define O_WRONLY (0x00000001)
+/* Open for reading and writing. */
+#define O_RDWR (0x00000002)
/*
mask for use with file access modes
*/
-#define O_ACCMODE (O_RDONLY | O_RDWR | O_WRONLY)
+#define O_ACCMODE (0x00000007)
/* PROTOTYPES */
int creat(const char *, mode_t);
-/* $Id: signal.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
+/* $Id: signal.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* signal.h
typedef int sig_atomic_t; /* Integral type of an object that can be
accessed as an atomic entity, even in the
- presence of asynchronous interrupts */ /* FIXME? */
+ presence of asynchronous interrupts */
-typedef struct __tagsigset_t
-{
- int _dummy;
-} sigset_t; /* Integral or structure type of an object used to represent
- sets of signals. */ /* TODO */
+typedef unsigned long int sigset_t; /* Integral or structure type of an object
+ used to represent sets of signals. */
union sigval
{
{
void (* sa_handler)(int); /* what to do on receipt of signal */
sigset_t sa_mask; /* set of signals to be blocked during
- execution of the signal handling
- function */
+ execution of the signal handling function */
int sa_flags; /* special flags */
void (* sa_sigaction)(int, siginfo_t *, void *);
/* pointer to signal handler function
};
/* CONSTANTS */
-/* Request for default signal handling. */
-#define SIG_DFL ((void (*)(int))(0))
-/* Return value from signal() in case of error. */
-#define SIG_ERR ((void (*)(int))(1))
-/* Request that signal be held. */
-#define SIG_HOLD ((void (*)(int))(2))
-/* Request that signal be ignored. */
-#define SIG_IGN ((void (*)(int))(3))
-
-/* No asynchronous notification will be delivered when the event of
- interest occurs. */
-#define SIGEV_NONE (0)
-/* A queued signal, with an application-defined value, will be generated
- when the event of interest occurs. */
-#define SIGEV_SIGNAL (1)
-/* A notification function will be called to perform notification. */
-#define SIGEV_THREAD (2)
+#define SIG_DFL ((void (*)(int))(0xFFFFFFFF)) /* Request for default signal handling. */
+#define SIG_ERR ((void (*)(int))(0x00000000)) /* Return value from signal() in case of error. */
+#define SIG_IGN ((void (*)(int))(0x00000001)) /* Request that signal be ignored. */
+#define SIG_HOLD ((void (*)(int))(0x00000002)) /* Request that signal be held. */
+
+#define SIGEV_NONE (0) /* No asynchronous notification will be delivered \
+ when the event of interest occurs. */
+#define SIGEV_SIGNAL (1) /* A queued signal, with an application-defined \
+ value, will be generated when the event of \
+ interest occurs. */
+#define SIGEV_THREAD (2) /* A notification function will be called to perform \
+ notification. */
/* TODO: realtime features not supported yet */
#define SIGRTMIN (-1)
#define SIGRTMAX (-1)
-/* Process abort signal. */
-#define SIGABRT ( 1)
-/* Alarm clock. */
-#define SIGALRM ( 2)
-/* Erroneous arithmetic operation. */
-#define SIGFPE ( 3)
-/* Hangup. */
-#define SIGHUP ( 4)
-/* Illegal instruction. */
-#define SIGILL ( 5)
-/* Terminal interrupt signal. */
-#define SIGINT ( 6)
-/* Kill (cannot be caught or ignored). */
-#define SIGKILL ( 7)
-/* Write on a pipe with no one to read it. */
-#define SIGPIPE ( 8)
-/* Terminal quit signal. */
-#define SIGQUIT ( 9)
-/* Invalid memory reference. */
-#define SIGSEGV (10)
-/* Termination signal. */
-#define SIGTERM (11)
-/* User-defined signal 1. */
-#define SIGUSR1 (12)
-/* User-defined signal 2. */
-#define SIGUSR2 (13)
-/* Child process terminated or stopped. */
-#define SIGCHLD (14)
-/* Continue executing, if stopped. */
-#define SIGCONT (15)
-/* Stop executing (cannot be caught or ignored). */
-#define SIGSTOP (16)
-/* Terminal stop signal. */
-#define SIGTSTP (17)
-/* Background process attempting read. */
-#define SIGTTIN (18)
-/* Background process attempting write. */
-#define SIGTTOU (19)
-/* Access to an undefined portion of a memory object. */
-#define SIGBUS (20)
-/* Pollable event. */
-#define SIGPOLL (21)
-/* Profiling timer expired. */
-#define SIGPROF (22)
-/* Bad system call. */
-#define SIGSYS (23)
-/* Trace/breakpoint trap. */
-#define SIGTRAP (24)
-/* High bandwidth data is available at a socket. */
-#define SIGURG (25)
-/* Virtual timer expired. */
-#define SIGVTALRM (26)
-/* CPU time limit exceeded. */
-#define SIGXCPU (27)
-/* File size limit exceeded. */
-#define SIGXFSZ (28)
+#define SIGABRT ( 1) /* Process abort signal. */
+#define SIGALRM ( 2) /* Alarm clock. */
+#define SIGFPE ( 3) /* Erroneous arithmetic operation. */
+#define SIGHUP ( 4) /* Hangup. */
+#define SIGILL ( 5) /* Illegal instruction. */
+#define SIGINT ( 6) /* Terminal interrupt signal. */
+#define SIGKILL ( 7) /* Kill (cannot be caught or ignored). */
+#define SIGPIPE ( 8) /* Write on a pipe with no one to read it. */
+#define SIGQUIT ( 9) /* Terminal quit signal. */
+#define SIGSEGV (10) /* Invalid memory reference. */
+#define SIGTERM (11) /* Termination signal. */
+#define SIGUSR1 (12) /* User-defined signal 1. */
+#define SIGUSR2 (13) /* User-defined signal 2. */
+#define SIGCHLD (14) /* Child process terminated or stopped. */
+#define SIGCONT (15) /* Continue executing, if stopped. */
+#define SIGSTOP (16) /* Stop executing (cannot be caught or ignored). */
+#define SIGTSTP (17) /* Terminal stop signal. */
+#define SIGTTIN (18) /* Background process attempting read. */
+#define SIGTTOU (19) /* Background process attempting write. */
+#define SIGBUS (20) /* Access to an undefined portion of a memory object. */
+#define SIGPOLL (21) /* Pollable event. */
+#define SIGPROF (22) /* Profiling timer expired. */
+#define SIGSYS (23) /* Bad system call. */
+#define SIGTRAP (24) /* Trace/breakpoint trap. */
+#define SIGURG (25) /* High bandwidth data is available at a socket. */
+#define SIGVTALRM (26) /* Virtual timer expired. */
+#define SIGXCPU (27) /* CPU time limit exceeded. */
+#define SIGXFSZ (28) /* File size limit exceeded. */
/* FIXME: the following constants need to be reviewed */
/* Do not generate SIGCHLD when children stop. */
-/* $Id: stat.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
+/* $Id: stat.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* sys/stat.h
/* TYPES */
struct stat
{
- dev_t st_dev; /* ID of device containing file */
- ino_t st_ino; /* file serial number */
mode_t st_mode; /* mode of file (see below) */
+ ino_t st_ino; /* file serial number */
+ dev_t st_dev; /* ID of device containing file */
nlink_t st_nlink; /* number of links to the file */
uid_t st_uid; /* user ID of file */
gid_t st_gid; /* group ID of file */
- dev_t st_rdev; /* device ID (if file is character or block special) */
off_t st_size; /* file size in bytes (if file is a regular file) */
time_t st_atime; /* time of last access */
time_t st_mtime; /* time of last data modification */
time_t st_ctime; /* time of last status change */
+ dev_t st_rdev; /* device ID (if file is character or block special) */
blksize_t st_blksize; /* a filesystem-specific preferred I/O block size for
this object. In some filesystem types, this may
- vary from file to file */
+ vary from file to file */
blkcnt_t st_blocks; /* number of blocks allocated for this object */
};
/*
file type
*/
-#define S_IFBLK (1) /* block special */
-#define S_IFCHR (2) /* character special */
-#define S_IFIFO (3) /* FIFO special */
-#define S_IFREG (4) /* regular */
-#define S_IFDIR (5) /* directory */
-#define S_IFLNK (6) /* symbolic link */
+#define S_IFIFO (000010000) /* FIFO special */
+#define S_IFCHR (000020000) /* character special */
+#define S_IFDIR (000040000) /* directory */
+#define S_IFBLK (000060000) /* block special */
+#define S_IFREG (000100000) /* regular */
+#define S_IFLNK (000200000) /* symbolic link */
+#define S_IFSOCK (000400000) /* socket */
/* type of file */
-#define S_IFMT (S_IFBLK | S_IFCHR | S_IFIFO | S_IFREG | S_IFDIR | S_IFLNK)
+#define S_IFMT (000770000)
/*
file mode bits
*/
+#define S_IRUSR (000000400) /* read permission, owner */
+#define S_IWUSR (000000200) /* write permission, owner */
+#define S_IXUSR (000000100) /* execute/search permission, owner */
#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) /* read, write, execute/search by owner */
-#define S_IRUSR (0x00000001) /* read permission, owner */
-#define S_IWUSR (0x00000002) /* write permission, owner */
-#define S_IXUSR (0x00000004) /* execute/search permission, owner */
+#define S_IRGRP (000000040) /* read permission, group */
+#define S_IWGRP (000000020) /* write permission, group */
+#define S_IXGRP (000000010) /* execute/search permission, group */
#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) /* read, write, execute/search by group */
-#define S_IRGRP (0x00000010) /* read permission, group */
-#define S_IWGRP (0x00000020) /* write permission, group */
-#define S_IXGRP (0x00000040) /* execute/search permission, group */
+#define S_IROTH (000000004) /* read permission, others */
+#define S_IWOTH (000000002) /* write permission, others */
+#define S_IXOTH (000000001) /* execute/search permission, others */
#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) /* read, write, execute/search by others */
-#define S_IROTH (0x00000100) /* read permission, others */
-#define S_IWOTH (0x00000200) /* write permission, others */
-#define S_IXOTH (0x00000400) /* execute/search permission, others */
-#define S_ISUID (0x00001000) /* set-user-ID on execution */
-#define S_ISGID (0x00002000) /* set-group-ID on execution */
-#define S_ISVTX (0x00004000) /* on directories, restricted deletion flag */
+#define S_ISUID (000004000) /* set-user-ID on execution */
+#define S_ISGID (000002000) /* set-group-ID on execution */
+
+#define S_ISVTX (000010000) /* on directories, restricted deletion flag */
/*
the following macros will test whether a file is of the specified type
*/
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-/* $Id: types.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
+/* $Id: types.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* sys/types.h
#define __SYS_TYPES_H_INCLUDED__
/* INCLUDES */
-#include <inttypes.h>
/* OBJECTS */
typedef unsigned long int blksize_t; /* Used for block sizes */
typedef long long clock_t; /* Used for system times in clock ticks or CLOCKS_PER_SEC */
typedef int clockid_t; /* Used for clock ID type in the clock and timer functions. */
-typedef int dev_t; /* Used for device IDs. */
-typedef long long fsblkcnt_t; /* Used for file system block counts */
-typedef long long fsfilcnt_t; /* Used for file system file counts */
-typedef int gid_t; /* Used for group IDs. */
+typedef unsigned long int dev_t; /* Used for device IDs. */
+typedef unsigned long int fsblkcnt_t; /* Used for file system block counts */
+typedef unsigned long int fsfilcnt_t; /* Used for file system file counts */
+typedef unsigned long int gid_t; /* Used for group IDs. */
typedef int id_t; /* Used as a general identifier; can be used to contain at least a
pid_t, uid_t or a gid_t. */
-typedef uint64_t ino_t; /* Used for file serial numbers. */
+typedef unsigned long int ino_t; /* Used for file serial numbers. */
typedef int key_t; /* Used for interprocess communication. */
-typedef int mode_t; /* Used for some file attributes. */
-typedef int nlink_t; /* Used for link counts. */
-typedef int64_t off_t; /* Used for file sizes. */
-typedef unsigned long int pid_t; /* Used for process IDs and process group IDs. */
+typedef unsigned long int mode_t; /* Used for some file attributes. */
+typedef unsigned long int nlink_t; /* Used for link counts. */
+typedef long off_t; /* Used for file sizes. */
+typedef long int pid_t; /* Used for process IDs and process group IDs. */
/* pthread types */
typedef void * pthread_cond_t; /* Used for condition variables. */
typedef void * pthread_rwlockattr_t; /* Used for read-write lock attributes. */
typedef unsigned long int pthread_t; /* Used to identify a thread. */
-typedef unsigned long int size_t; /* Used for sizes of objects. */
-typedef long int ssize_t; /* Used for a count of bytes or an error indication. */
+typedef unsigned int size_t; /* Used for sizes of objects. */
+typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */
typedef long long suseconds_t; /* Used for time in microseconds */
-typedef unsigned long int time_t; /* Used for time in seconds. */
+typedef long int time_t; /* Used for time in seconds. */
typedef void * timer_t; /* Used for timer ID returned by timer_create(). */
typedef int uid_t; /* Used for user IDs. */
typedef unsigned long long useconds_t; /* Used for time in microseconds. */
+/*
+ additional types for sockets and streams - for compatibility with Microsoft POSIX
+ */
+typedef unsigned char u_char;
+typedef unsigned short int u_short;
+typedef unsigned short int ushort;
+typedef unsigned int u_int;
+typedef unsigned long int u_long;
+
+typedef unsigned int uint;
+typedef unsigned long ulong;
+typedef unsigned char unchar;
+
+typedef char *caddr_t;
+typedef int key_t;
+
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
+/* for compatibility with Microsoft POSIX */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
#endif /* __SYS_TYPES_H_INCLUDED__ */
-/* $Id: unistd.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
+/* $Id: unistd.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* unistd.h
constants for the access() function
*/
-/* Test for read permission. */
-#define R_OK (0x00000001)
-/* Test for write permission. */
-#define W_OK (0x00000002)
-/* Test for execute (search) permission. */
-#define X_OK (0x00000004)
-/* Test for existence of file. */
-#define F_OK (0)
+#define R_OK (0x00000004) /* Test for read permission. */
+#define W_OK (0x00000002) /* Test for write permission. */
+#define X_OK (0x00000001) /* Test for execute (search) permission. */
+#define F_OK (0) /* Test for existence of file. */
/*
constants for the confstr() function
constants for the lseek() and fcntl() functions
*/
-#define SEEK_SET (1) /* Set file offset to offset. */
-#define SEEK_CUR (2) /* Set file offset to current plus offset. */
-#define SEEK_END (3) /* Set file offset to EOF plus offset. */
+#define SEEK_SET (0) /* Set file offset to offset. */
+#define SEEK_CUR (1) /* Set file offset to current plus offset. */
+#define SEEK_END (2) /* Set file offset to EOF plus offset. */
+
+/*
+ constants for pathconf()
+ */
+/* constants 1 to 9 are the same as in Microsoft POSIX */
+#define _PC_LINK_MAX ( 1)
+#define _PC_MAX_CANON ( 2)
+#define _PC_MAX_INPUT ( 3)
+#define _PC_NAME_MAX ( 4)
+#define _PC_PATH_MAX ( 5)
+#define _PC_PIPE_BUF ( 6)
+#define _PC_CHOWN_RESTRICTED ( 7)
+#define _PC_NO_TRUNC ( 8)
+#define _PC_VDISABLE ( 9)
+/* from this point, constants are in no particular order */
+#define _PC_ALLOC_SIZE_MIN ( 10)
+#define _PC_ASYNC_IO ( 11)
+#define _PC_FILESIZEBITS ( 12)
+#define _PC_PRIO_IO ( 13)
+#define _PC_REC_INCR_XFER_SIZE ( 14)
+#define _PC_REC_MAX_XFER_SIZE ( 15)
+#define _PC_REC_MIN_XFER_SIZE ( 16)
+#define _PC_REC_XFER_ALIGN ( 17)
+#define _PC_SYNC_IO ( 18)
/*
constants for sysconf()
*/
-#define _SC_2_C_BIND (1)
-#define _SC_2_C_DEV (2)
-#define _SC_2_C_VERSION (3)
-#define _SC_2_FORT_DEV (4)
-#define _SC_2_FORT_RUN (5)
-#define _SC_2_LOCALEDEF (6)
-#define _SC_2_SW_DEV (7)
-#define _SC_2_UPE (8)
-#define _SC_2_VERSION (9)
-#define _SC_ARG_MAX (10)
-#define _SC_AIO_LISTIO_MAX (11)
-#define _SC_AIO_MAX (12)
-#define _SC_AIO_PRIO_DELTA_MAX (13)
-#define _SC_ASYNCHRONOUS_IO (14)
-#define _SC_ATEXIT_MAX (15)
-#define _SC_BC_BASE_MAX (16)
-#define _SC_BC_DIM_MAX (17)
-#define _SC_BC_SCALE_MAX (18)
-#define _SC_BC_STRING_MAX (19)
-#define _SC_CHILD_MAX (20)
-#define _SC_CLK_TCK (21)
-#define _SC_COLL_WEIGHTS_MAX (22)
-#define _SC_DELAYTIMER_MAX (23)
-#define _SC_EXPR_NEST_MAX (24)
-#define _SC_FSYNC (25)
-#define _SC_GETGR_R_SIZE_MAX (26)
-#define _SC_GETPW_R_SIZE_MAX (27)
-#define _SC_IOV_MAX (28)
-#define _SC_JOB_CONTROL (29)
-#define _SC_LINE_MAX (30)
-#define _SC_LOGIN_NAME_MAX (31)
-#define _SC_MAPPED_FILES (32)
-#define _SC_MEMLOCK (33)
-#define _SC_MEMLOCK_RANGE (34)
-#define _SC_MEMORY_PROTECTION (35)
-#define _SC_MESSAGE_PASSING (36)
-#define _SC_MQ_OPEN_MAX (37)
-#define _SC_MQ_PRIO_MAX (38)
-#define _SC_NGROUPS_MAX (39)
-#define _SC_OPEN_MAX (40)
-#define _SC_PAGE_SIZE (41)
-#define _SC_PASS_MAX (42) /* LEGACY */
-#define _SC_PRIORITIZED_IO (43)
-#define _SC_PRIORITY_SCHEDULING (44)
-#define _SC_RE_DUP_MAX (45)
-#define _SC_REALTIME_SIGNALS (46)
-#define _SC_RTSIG_MAX (47)
-#define _SC_SAVED_IDS (48)
-#define _SC_SEMAPHORES (49)
-#define _SC_SEM_NSEMS_MAX (50)
-#define _SC_SEM_VALUE_MAX (51)
-#define _SC_SHARED_MEMORY_OBJECTS (52)
-#define _SC_SIGQUEUE_MAX (53)
-#define _SC_STREAM_MAX (54)
-#define _SC_SYNCHRONIZED_IO (55)
-#define _SC_THREADS (56)
-#define _SC_THREAD_ATTR_STACKADDR (57)
-#define _SC_THREAD_ATTR_STACKSIZE (58)
-#define _SC_THREAD_DESTRUCTOR_ITERATIONS (59)
-#define _SC_THREAD_KEYS_MAX (60)
-#define _SC_THREAD_PRIORITY_SCHEDULING (61)
-#define _SC_THREAD_PRIO_INHERIT (62)
-#define _SC_THREAD_PRIO_PROTECT (63)
-#define _SC_THREAD_PROCESS_SHARED (64)
-#define _SC_THREAD_SAFE_FUNCTIONS (65)
-#define _SC_THREAD_STACK_MIN (66)
-#define _SC_THREAD_THREADS_MAX (67)
-#define _SC_TIMERS (68)
-#define _SC_TIMER_MAX (69)
-#define _SC_TTY_NAME_MAX (70)
-#define _SC_TZNAME_MAX (71)
-#define _SC_VERSION (72)
-#define _SC_XOPEN_VERSION (73)
-#define _SC_XOPEN_CRYPT (74)
-#define _SC_XOPEN_ENH_I18N (75)
-#define _SC_XOPEN_SHM (76)
-#define _SC_XOPEN_UNIX (77)
-#define _SC_XOPEN_XCU_VERSION (78)
-#define _SC_XOPEN_LEGACY (79)
-#define _SC_XOPEN_REALTIME (80)
-#define _SC_XOPEN_REALTIME_THREADS (81)
-#define _SC_XBS5_ILP32_OFF32 (82)
-#define _SC_XBS5_ILP32_OFFBIG (83)
-#define _SC_XBS5_LP64_OFF64 (84)
-#define _SC_XBS5_LPBIG_OFFBIG (85)
+/* constants 1 to 10 are the same as in Microsoft POSIX */
+#define _SC_ARG_MAX ( 1)
+#define _SC_CHILD_MAX ( 2)
+#define _SC_CLK_TCK ( 3)
+#define _SC_NGROUPS_MAX ( 4)
+#define _SC_OPEN_MAX ( 5)
+#define _SC_JOB_CONTROL ( 6)
+#define _SC_SAVED_IDS ( 7)
+#define _SC_STREAM_MAX ( 8)
+#define _SC_TZNAME_MAX ( 9)
+#define _SC_VERSION ( 10)
+/* from this point, constants are in no particular order */
+#define _SC_2_C_BIND ( 11)
+#define _SC_2_C_DEV ( 12)
+#define _SC_2_C_VERSION ( 13)
+#define _SC_2_FORT_DEV ( 14)
+#define _SC_2_FORT_RUN ( 15)
+#define _SC_2_LOCALEDEF ( 16)
+#define _SC_2_SW_DEV ( 17)
+#define _SC_2_UPE ( 18)
+#define _SC_2_VERSION ( 19)
+#define _SC_AIO_LISTIO_MAX ( 20)
+#define _SC_AIO_MAX ( 21)
+#define _SC_AIO_PRIO_DELTA_MAX ( 22)
+#define _SC_ASYNCHRONOUS_IO ( 23)
+#define _SC_ATEXIT_MAX ( 24)
+#define _SC_BC_BASE_MAX ( 25)
+#define _SC_BC_DIM_MAX ( 26)
+#define _SC_BC_SCALE_MAX ( 27)
+#define _SC_BC_STRING_MAX ( 28)
+#define _SC_COLL_WEIGHTS_MAX ( 29)
+#define _SC_DELAYTIMER_MAX ( 30)
+#define _SC_EXPR_NEST_MAX ( 31)
+#define _SC_FSYNC ( 32)
+#define _SC_GETGR_R_SIZE_MAX ( 33)
+#define _SC_GETPW_R_SIZE_MAX ( 34)
+#define _SC_IOV_MAX ( 35)
+#define _SC_LINE_MAX ( 36)
+#define _SC_LOGIN_NAME_MAX ( 37)
+#define _SC_MAPPED_FILES ( 38)
+#define _SC_MEMLOCK ( 39)
+#define _SC_MEMLOCK_RANGE ( 40)
+#define _SC_MEMORY_PROTECTION ( 41)
+#define _SC_MESSAGE_PASSING ( 42)
+#define _SC_MQ_OPEN_MAX ( 43)
+#define _SC_MQ_PRIO_MAX ( 44)
+#define _SC_PAGE_SIZE ( 45)
+#define _SC_PASS_MAX ( 46) /* LEGACY */
+#define _SC_PRIORITIZED_IO ( 47)
+#define _SC_PRIORITY_SCHEDULING ( 48)
+#define _SC_RE_DUP_MAX ( 49)
+#define _SC_REALTIME_SIGNALS ( 50)
+#define _SC_RTSIG_MAX ( 51)
+#define _SC_SEMAPHORES ( 52)
+#define _SC_SEM_NSEMS_MAX ( 53)
+#define _SC_SEM_VALUE_MAX ( 54)
+#define _SC_SHARED_MEMORY_OBJECTS ( 55)
+#define _SC_SIGQUEUE_MAX ( 56)
+#define _SC_SYNCHRONIZED_IO ( 57)
+#define _SC_THREADS ( 58)
+#define _SC_THREAD_ATTR_STACKADDR ( 59)
+#define _SC_THREAD_ATTR_STACKSIZE ( 60)
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS ( 61)
+#define _SC_THREAD_KEYS_MAX ( 62)
+#define _SC_THREAD_PRIORITY_SCHEDULING ( 63)
+#define _SC_THREAD_PRIO_INHERIT ( 64)
+#define _SC_THREAD_PRIO_PROTECT ( 65)
+#define _SC_THREAD_PROCESS_SHARED ( 66)
+#define _SC_THREAD_SAFE_FUNCTIONS ( 67)
+#define _SC_THREAD_STACK_MIN ( 68)
+#define _SC_THREAD_THREADS_MAX ( 69)
+#define _SC_TIMERS ( 70)
+#define _SC_TIMER_MAX ( 71)
+#define _SC_TTY_NAME_MAX ( 72)
+#define _SC_XOPEN_VERSION ( 73)
+#define _SC_XOPEN_CRYPT ( 74)
+#define _SC_XOPEN_ENH_I18N ( 75)
+#define _SC_XOPEN_SHM ( 76)
+#define _SC_XOPEN_UNIX ( 77)
+#define _SC_XOPEN_XCU_VERSION ( 78)
+#define _SC_XOPEN_LEGACY ( 79)
+#define _SC_XOPEN_REALTIME ( 80)
+#define _SC_XOPEN_REALTIME_THREADS ( 81)
+#define _SC_XBS5_ILP32_OFF32 ( 82)
+#define _SC_XBS5_ILP32_OFFBIG ( 83)
+#define _SC_XBS5_LP64_OFF64 ( 84)
+#define _SC_XBS5_LPBIG_OFFBIG ( 85)
+
#define _SC_PAGESIZE _SC_PAGE_SIZE
/* possible values for the function argument to the lockf() function */
-/* Lock a section for exclusive use. */
-#define F_LOCK (1)
-/* Unlock locked sections. */
-#define F_ULOCK (2)
-/* Test section for locks by other processes. */
-#define F_TEST (3)
-/* Test and lock a section for exclusive use. */
-#define F_TLOCK (4)
-
-/* File number of stdin. It is 0. */
-#define STDIN_FILENO (0)
-/* File number of stdout. It is 1. */
-#define STDOUT_FILENO (1)
-/* File number of stderr. It is 2. */
-#define STDERR_FILENO (2)
+#define F_LOCK (1) /* Lock a section for exclusive use. */
+#define F_ULOCK (2) /* Unlock locked sections. */
+#define F_TEST (3) /* Test section for locks by other processes. */
+#define F_TLOCK (4) /* Test and lock a section for exclusive use. */
+
+#define STDIN_FILENO (0) /* File number of stdin. */
+#define STDOUT_FILENO (1) /* File number of stdout. */
+#define STDERR_FILENO (2) /* File number of stderr. */
/* PROTOTYPES */
int access(const char *, int);