From: KJK::Hyperion Date: Wed, 20 Feb 2002 07:13:22 +0000 (+0000) Subject: whoops - forgot to commit header files X-Git-Tag: ReactOS-0.0.19~10 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=e858ec180136a0afc287589a5f811f3779fdfbb3 whoops - forgot to commit header files svn path=/trunk/; revision=2635 --- diff --git a/posix/include/aio.h b/posix/include/aio.h new file mode 100644 index 00000000000..8911cb6f6e9 --- /dev/null +++ b/posix/include/aio.h @@ -0,0 +1,80 @@ +/* + * aio.h + * + * asynchronous input and output (REALTIME). Based on the Single UNIX(r) + * Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __AIO_H_INCLUDED__ +#define __AIO_H_INCLUDED__ + +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ +#include +#include +#include +#include + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ +#include +#include +#include +#include + +#endif + +/* types */ +typedef struct _tag_aiocb +{ + int aio_fildes /* file descriptor */ + off_t aio_offset /* file offset */ + volatile void* aio_buf /* location of buffer + size_t aio_nbytes /* length of transfer */ + int aio_reqprio /* request priority offset */ + struct sigevent aio_sigevent /* signal number and value */ + int aio_lio_opcode /* operation to be performed */ +} aiocb; + +/* constants */ +#define AIO_CANCELED 0 +#define AIO_NOTCANCELED 1 +#define AIO_ALLDONE 2 + +#define LIO_WAIT 0 +#define LIO_NOWAIT 1 +#define LIO_READ 2 +#define LIO_WRITE 3 +#define LIO_NOP 4 + +/* prototypes */ +int aio_cancel(int, struct aiocb *); +int aio_error(const struct aiocb *); +int aio_fsync(int, struct aiocb *); +int aio_read(struct aiocb *); +ssize_t aio_return(struct aiocb *); +int aio_suspend(const struct aiocb *const[], int, const struct timespec *); +int aio_write(struct aiocb *); +int lio_listio(int, struct aiocb *const[], int, struct sigevent *); + +#endif /* __AIO_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/arpa/inet.h b/posix/include/arpa/inet.h new file mode 100644 index 00000000000..f47026edb10 --- /dev/null +++ b/posix/include/arpa/inet.h @@ -0,0 +1,62 @@ +/* + * arpa/inet.h + * + * definitions for internet operations. Based on the Single UNIX(r) + * Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __ARPA_INET_H_INCLUDED__ +#define __ARPA_INET_H_INCLUDED__ + +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ +#include +#include + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ +#include +#include + +#endif + +/* types */ + +/* constants */ + +/* prototypes */ +uint32_t htonl(uint32_t hostlong); +uint16_t htons(uint16_t hostshort); +uint32_t ntohl(uint32_t netlong); +uint16_t ntohs(uint16_t netshort); + +in_addr_t inet_addr(const char *cp); +in_addr_t inet_lnaof(struct in_addr in); +struct in_addr inet_makeaddr(in_addr_t net, in_addr_t lna); +in_addr_t inet_netof(struct in_addr in); +in_addr_t inet_network(const char *cp); +char *inet_ntoa(struct in_addr in); + +/* macros */ + +#endif /* __ARPA_INET_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/assert.h b/posix/include/assert.h new file mode 100644 index 00000000000..1552348205a --- /dev/null +++ b/posix/include/assert.h @@ -0,0 +1,63 @@ +/* + * assert.h + * + * verify program assertion. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __ASSERT_H_INCLUDED__ +#define __ASSERT_H_INCLUDED__ + +/* types */ + +/* constants */ + +/* prototypes */ + +/* macros */ +#ifdef NDEBUG +#define assert(ignore) ((void) 0) +#else /* !NDEBUG */ + +#define assert(expression) \ +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ +#include +#include + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ +#include +#include + +#endif + + if(!(expression)) \ + { \ + fputs("__FILE__, line __LINE__: assertion \"expression\" failed\n", stderr); \ + abort(); \ + } + +#endif /* NDEBUG */ + +#endif /* __ASSERT_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/cpio.h b/posix/include/cpio.h new file mode 100644 index 00000000000..8a9aef9f83b --- /dev/null +++ b/posix/include/cpio.h @@ -0,0 +1,69 @@ +/* + * cpio.h + * + * cpio archive values. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __CPIO_H_INCLUDED__ +#define __CPIO_H_INCLUDED__ + +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ + +#endif + +/* types */ + +/* constants */ +#define C_IRUSR (0000400) /* read by owner */ +#define C_IWUSR (0000200) /* write by owner */ +#define C_IXUSR (0000100) /* execute by owner */ +#define C_IRGRP (0000040) /* read by group */ +#define C_IWGRP (0000020) /* write by group */ +#define C_IXGRP (0000010) /* execute by group */ +#define C_IROTH (0000004) /* read by others */ +#define C_IWOTH (0000002) /* write by others */ +#define C_IXOTH (0000001) /* execute by others */ +#define C_ISUID (0004000) /* set user ID */ +#define C_ISGID (0002000) /* set group ID */ +#define C_ISVTX (0001000) /* on directories, restricted deletion flag */ +#define C_ISDIR (0040000) /* directory */ +#define C_ISFIFO (0010000) /* FIFO */ +#define C_ISREG (0100000) /* regular file */ +#define C_ISBLK (0060000) /* block special */ +#define C_ISCHR (0020000) /* character special */ +#define C_ISCTG (0110000) /* reserved */ +#define C_ISLNK (0120000) /* symbolic link */ +#define C_ISSOCK (0140000) /* socket */ + +#define MAGIC "070707" + +/* prototypes */ + +/* macros */ + +#endif /* __CPIO_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/ctype.h b/posix/include/ctype.h new file mode 100644 index 00000000000..aba48349920 --- /dev/null +++ b/posix/include/ctype.h @@ -0,0 +1,64 @@ +/* + * ctype.h + * + * character types. Based on the Single UNIX(r) Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __CTYPE_H_INCLUDED__ +#define __CTYPE_H_INCLUDED__ + +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ + +#endif + +/* types */ + +/* constants */ + +/* prototypes */ +int isalnum(int); +int isalpha(int); +int isascii(int); +int iscntrl(int); +int isdigit(int); +int isgraph(int); +int islower(int); +int isprint(int); +int ispunct(int); +int isspace(int); +int isupper(int); +int isxdigit(int); +int toascii(int); +int tolower(int); +int toupper(int); + +/* macros */ +/* FIXME: the standard isn't clear about these */ +#define _toupper(c) (toupper(c)) +#define _tolower(c) (tolower(c)) + +#endif /* __CTYPE_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/dirent.h b/posix/include/dirent.h new file mode 100644 index 00000000000..25ff8634dd6 --- /dev/null +++ b/posix/include/dirent.h @@ -0,0 +1,68 @@ +/* + * dirent.h + * + * format of directory entries. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __DIRENT_H_INCLUDED__ +#define __DIRENT_H_INCLUDED__ + +/* INCLUDES */ +#include +#include + +/* TYPES */ +typedef void DIR; + +struct dirent +{ + ino_t d_ino; /* file serial number */ + char *d_name; /* name of entry */ +}; + +/* for Unicode filenames */ +struct _Wdirent +{ + ino_t d_ino; /* file serial number */ + wchar_t *d_name; /* name of entry */ +}; + +/* CONSTANTS */ + +/* PROTOTYPES */ +int closedir(DIR *); +DIR *opendir(const char *); +struct dirent *readdir(DIR *); +int readdir_r(DIR *, struct dirent *, struct dirent **); +void rewinddir(DIR *); +void seekdir(DIR *, long int); +long int telldir(DIR *); + +/* for Unicode filenames */ +DIR *_Wopendir(const wchar_t *); +struct _Wdirent *_Wreaddir(DIR *); +int _Wreaddir_r(DIR *, struct _Wdirent *, struct _Wdirent **); + + +/* MACROS */ + +#endif /* __DIRENT_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/dlfcn.h b/posix/include/dlfcn.h new file mode 100644 index 00000000000..5d87d4582d8 --- /dev/null +++ b/posix/include/dlfcn.h @@ -0,0 +1,55 @@ +/* + * dlfcn.h + * + * dynamic linking. Based on the Single UNIX(r) Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __DLFCN_H_INCLUDED__ +#define __DLFCN_H_INCLUDED__ + +/* INCLUDES */ + +/* TYPES */ + +/* CONSTANTS */ +#define RTLD_LAZY (0x00000000) /* Relocations are performed at an + implementation-dependent time. */ +#define RTLD_NOW (0x00000001) /* Relocations are performed when + the object is loaded. */ + +#define RTLD_GLOBAL (0x00000010) /* All symbols are available for + relocation processing of other + modules. */ +#define RTLD_LOCAL (0x00000020) /* All symbols are not made available + for relocation processing by other + modules. */ + +#define RTLD_NEXT ((void *)(-1)) + +/* PROTOTYPES */ +void *dlopen(const char *, int); +void *dlsym(void *, const char *); +int dlclose(void *); +char *dlerror(void); + +/* MACROS */ + +#endif /* __DLFCN_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/errno.h b/posix/include/errno.h new file mode 100644 index 00000000000..bc664daeda0 --- /dev/null +++ b/posix/include/errno.h @@ -0,0 +1,121 @@ +/* + * errno.h + * + * system error numbers. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __ERRNO_H_INCLUDED__ +#define __ERRNO_H_INCLUDED__ + +/* INCLUDES */ + +/* OBJECTS */ + +/* 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. */ + +/* PROTOTYPES */ +int * __PdxGetThreadErrNum(void); /* returns a pointer to the current thread's errno */ + +/* MACROS */ +#define errno (*__PdxGetThreadErrNum()) + +#endif /* __ERRNO_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/fcntl.h b/posix/include/fcntl.h new file mode 100644 index 00000000000..19f97f81b91 --- /dev/null +++ b/posix/include/fcntl.h @@ -0,0 +1,149 @@ +/* $Id: + */ +/* + * fcntl.h + * + * file control options. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __FCNTL_H_INCLUDED__ +#define __FCNTL_H_INCLUDED__ + +/* INCLUDES */ +#include +#include +#include + +/* OBJECTS */ + +/* TYPES */ +/* + the structure flock describes a file lock + */ +struct flock +{ + short l_type; /* type of lock; F_RDLCK, F_WRLCK, 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 process holding the lock; + returned with F_GETLK */ +}; + +/* CONSTANTS */ +/* + values for cmd used by fcntl() + */ +enum __fcntl_cmd +{ + F_DUPFD, /* duplicate file descriptor */ + F_GETFD, /* get file descriptor flags */ + 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 */ + F_NEWFD, /* create new file descriptor */ + F_DELFD, /* delete file descriptor */ + F_GETALL, /* get a copy of the internal descriptor object */ + F_SETALL, /* initialize internal descriptor object */ + F_GETXP, /* get file descriptor extra data pointer */ + F_SETXP, /* set file descriptor extra data pointer */ + F_GETXS, /* get file descriptor extra data size */ + F_SETXS, /* set file descriptor extra data size */ + F_GETFH, /* get file handle */ + F_SETFH /* set file handle */ +}; + +/* + file descriptor flags used for fcntl() + */ +/* Close the file descriptor upon execution of an exec family function. */ +#define FD_CLOEXEC (0x00000001) + +/* + values for l_type used for record locking with fcntl() + */ +/* Shared or read lock. */ +#define F_RDLCK (1) +/* Unlock. */ +#define F_UNLCK (2) +/* Exclusive or write lock. */ +#define F_WRLCK (3) + +/* + file flags used for open() + */ +/* Create file if it does not exist. */ +#define O_CREAT (0x00000001) +/* Exclusive use flag. */ +#define O_EXCL (0x00000002) +/* Do not assign controlling terminal. */ +#define O_NOCTTY (0x00000004) +/* Truncate flag. */ +#define O_TRUNC (0x00000008) +/* ReactOS-specific */ +/* File must be a directory */ +#define _O_DIRFILE (0x00000010) + +/* + 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) +/* Non-blocking mode. */ +#define O_NONBLOCK (0x00000400) +/* Synchronised read I/O operations. */ +#define O_RSYNC (0x00000800) +/* Write according to synchronised I/O file integrity completion. */ +#define O_SYNC (0x00001000) + +/* + 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) +/* Open for writing only. */ +#define O_WRONLY (0x04000000) + +/* + mask for use with file access modes + */ +#define O_ACCMODE (O_RDONLY | O_RDWR | O_WRONLY) + +/* PROTOTYPES */ +int creat(const char *, mode_t); +int fcntl(int, int, ...); +int open(const char *, int, ...); + +int _Wcreat(const wchar_t *, mode_t); +int _Wopen(const wchar_t *, int, ...); + +/* MACROS */ + +#endif /* __FCNTL_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/fmtmsg.h b/posix/include/fmtmsg.h new file mode 100644 index 00000000000..1d700dc550a --- /dev/null +++ b/posix/include/fmtmsg.h @@ -0,0 +1,100 @@ +/* + * fmtmsg.h + * + * message display structures. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __FMTMSG_H_INCLUDED__ +#define __FMTMSG_H_INCLUDED__ + +/* INCLUDES */ +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ + +#endif + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ +/* Major Classifications */ +/* NOTE: these are unique values, not flags. Their bits can overlap, but + cannot overlap with those of other categories */ +#define MM_HARD (0x00000001) /* Source of the condition is hardware. */ +#define MM_SOFT (0x00000002) /* Source of the condition is software. */ +#define MM_FIRM (0x00000003) /* Source of the condition is firmware. */ + +/* Message Source Subclassifications */ +/* NOTE: these are unique values, not flags. Their bits can overlap, but + cannot overlap with those of other categories */ +#define MM_APPL (0x00000010) /* Condition detected by application. */ +#define MM_UTIL (0x00000020) /* Condition detected by utility. */ +#define MM_OPSYS (0x00000030) /* Condition detected by operating system. */ + +/* Status Subclassifications */ +/* NOTE: these are unique values, not flags. Their bits can overlap, but + cannot overlap with those of other categories */ +#define MM_RECOVER (0x00000100) /* Recoverable error. */ +#define MM_NRECOV (0x00000200) /* Non-recoverable error. */ + +/* Display Subclassifications */ +/* NOTE: these, unlike other classification constants, are flags. Their + bits must be distinct */ +#define MM_PRINT (0x00001000) /* Display message on standard error. */ +#define MM_CONSOLE (0x00002000) /* Display message on system console. */ + +/* Identifiers for the levels of severity */ +#define MM_NOSEV (0) /* No severity level provided for the message. */ +#define MM_INFO (1) /* Informative message. */ +#define MM_WARNING (2) /* Application has detected unusual non-error + condition. */ +#define MM_ERROR (3) /* Application has encountered a non-fatal fault. */ +#define MM_HALT (4) /* Error causing application to halt. */ + +/* Null values and identifiers */ +#define MM_NULLLBL ((char *)0) /* Null label */ +#define MM_NULLSEV (0) /* Null severity */ +#define MM_NULLMC (0L) /* Null class */ +#define MM_NULLTXT ((char *)0) /* Null text */ +#define MM_NULLACT ((char *)0) /* Null action */ +#define MM_NULLTAG ((char *)0) /* Null tag */ + +/* Return values */ +#define MM_OK ( 0) /* The function succeeded. */ +#define MM_NOTOK (-1) /* The function failed completely. */ +#define MM_NOMSG (-2) /* The function was unable to generate a message on + standard error, but otherwise succeeded. */ +#define MM_NOCON (-3) /* The function was unable to generate a console + message, but otherwise succeeded. */ + +/* PROTOTYPES */ +int fmtmsg(long, const char*, int, const char*, const char*, const char*); + +/* MACROS */ + +#endif /* __FMTMSG_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/fnmatch.h b/posix/include/fnmatch.h new file mode 100644 index 00000000000..b571045a5e3 --- /dev/null +++ b/posix/include/fnmatch.h @@ -0,0 +1,64 @@ +/* + * fnmatch.h + * + * filename-matching types. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __FNMATCH_H_INCLUDED__ +#define __FNMATCH_H_INCLUDED__ + +/* INCLUDES */ +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ + +#endif + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ +/* Flags */ +#define FNM_PATHNAME (0x00000001) /* Slash in string only matches slash + in pattern. */ +#define FNM_PERIOD (0x00000002) /* Leading period in string must be + exactly matched by period in + pattern. */ +#define FNM_NOESCAPE (0x00000004) /* Disable backslash escaping. */ + +/* Return values */ +#define FNM_NOMATCH (1) /* The string does not match the specified + pattern. */ +#define FNM_NOSYS (2) /* The implementation does not support this + function. */ + +/* PROTOTYPES */ +int fnmatch(const char *, const char *, int); + +/* MACROS */ + +#endif /* __FNMATCH_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/ftw.h b/posix/include/ftw.h new file mode 100644 index 00000000000..f7d55dc7ad8 --- /dev/null +++ b/posix/include/ftw.h @@ -0,0 +1,80 @@ +/* + * ftw.h + * + * file tree traversal. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __FTW_H_INCLUDED__ +#define __FTW_H_INCLUDED__ + +/* INCLUDES */ +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ + +#endif + +/* OBJECTS */ + +/* TYPES */ +struct FTW +{ + int base + int level +} + +/* CONSTANTS */ +/* Values of the third argument to the application-supplied function + that is passed as the second argument to ftw() and nftw() */ +#define FTW_F (1) /* File. */ +#define FTW_D (2) /* Directory. */ +#define FTW_DNR (3) /* Directory without read permission. */ +#define FTW_DP (4) /* Directory with subdirectories visited. */ +#define FTW_NS (5) /* Unknown type, stat() failed. */ +#define FTW_SL (6) /* Symbolic link. */ +#define FTW_SLN (7) /* Symbolic link that names a non-existent file. */ + +/* Values of the fourth argument to nftw() */ +#define FTW_PHYS (0x00000001) /* Physical walk, does not follow symbolic + links. Otherwise, nftw() will follow + links but will not walk down any path + that crosses itself. */ +#define FTW_MOUNT (0x00000002) /* The walk will not cross a mount point. */ +#define FTW_DEPTH (0x00000004) /* All subdirectories will be visited before + the directory itself. */ +#define FTW_CHDIR (0x00000008) /* The walk will change to each directory + before reading it. */ + +/* PROTOTYPES */ +int ftw(const char *, + int (*)(const char *, const struct stat *, int), int); +int nftw(const char *, int (*) + (const char *, const struct stat *, int, struct FTW*), + int, int); + +/* MACROS */ + +#endif /* __FTW_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/glob.h b/posix/include/glob.h new file mode 100644 index 00000000000..08248bdb9a0 --- /dev/null +++ b/posix/include/glob.h @@ -0,0 +1,80 @@ +/* + * glob.h + * + * pathname pattern-matching types. Based on the Single UNIX(r) + * Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __GLOB_H_INCLUDED__ +#define __GLOB_H_INCLUDED__ + +/* INCLUDES */ +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ + +#endif + +/* OBJECTS */ + +/* TYPES */ +typedef struct _tag_glob_t +{ + size_t gl_pathc /* count of paths matched by pattern */ + char **gl_pathv /* pointer to a list of matched pathnames */ + size_t gl_offs /* slots to reserve at the beginning of gl_pathv */ +} glob_t; + +/* CONSTANTS */ +/* Values for the flags argument */ +#define GLOB_APPEND (0x00000001) /* Append generated pathnames to + those previously obtained. */ +#define GLOB_DOOFFS (0x00000002) /* Specify how many null pointers to + add to the beginning of */ +#define GLOB_ERR (0x00000004) /* Cause glob() to return on error. */ +#define GLOB_MARK (0x00000008) /* Each pathname that is a directory + that matches pattern has a slash + appended. */ +#define GLOB_NOCHECK (0x00000010) /* If pattern does not match any pathname, + then return a list consisting of only + pattern. */ +#define GLOB_NOESCAPE (0x00000020) /* Disable backslash escaping. */ +#define GLOB_NOSORT (0x00000040) /* Do not sort the pathnames returned. */ + +/* Error return values */ +#define GLOB_ABORTED (-1) /* The scan was stopped because GLOB_ERR was set + or errfunc returned non-zero. */ +#define GLOB_NOMATCH (-2) /* The pattern does not match any existing pathname, + and GLOB_NOCHECK was not set in flags. */ +#define GLOB_NOSPACE (-3) /* An attempt to allocate memory failed. */ +#define GLOB_NOSYS (-4) /* The implementation does not support this function. */ + +/* PROTOTYPES */ +int glob(const char *, int, int (*)(const char *, int), glob_t *); +void globfree (glob_t *); + +/* MACROS */ + +#endif /* __GLOB_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/grp.h b/posix/include/grp.h new file mode 100644 index 00000000000..35d1e11c3e4 --- /dev/null +++ b/posix/include/grp.h @@ -0,0 +1,56 @@ +/* + * grp.h + * + * group structure. Based on the Single UNIX(r) Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __GRP_H_INCLUDED__ +#define __GRP_H_INCLUDED__ + +/* INCLUDES */ + +/* OBJECTS */ + +/* TYPES */ +struct group +{ + char *gr_name; /* the name of the group */ + gid_t gr_gid; /* numerical group ID */ + char **gr_mem; /* pointer to a null-terminated array of character + pointers to member names */ +}; + +/* CONSTANTS */ + +/* PROTOTYPES */ +struct group *getgrgid(gid_t); +struct group *getgrnam(const char *); +int getgrgid_r(gid_t, struct group *, char *, + size_t, struct group **); +int getgrnam_r(const char *, struct group *, char *, + size_t , struct group **); +struct group *getgrent(void); +void endgrent(void); +void setgrent(void); + +/* MACROS */ + +#endif /* __GRP_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/iconv.h b/posix/include/iconv.h new file mode 100644 index 00000000000..0e076f9c41e --- /dev/null +++ b/posix/include/iconv.h @@ -0,0 +1,54 @@ +/* + * iconv.h + * + * codeset conversion facility. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __ICONV_H_INCLUDED__ +#define __ICONV_H_INCLUDED__ + +/* INCLUDES */ +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ + +#endif + +/* OBJECTS */ + +/* TYPES */ +typedef (void *) iconv_t; + +/* CONSTANTS */ + +/* PROTOTYPES */ +iconv_t iconv_open(const char *, const char *); +size_t iconv(iconv_t, char **, size_t *, char **, size_t *); +int iconv_close(iconv_t); + +/* MACROS */ + +#endif /* __ICONV_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/inttypes.h b/posix/include/inttypes.h new file mode 100644 index 00000000000..fb2bfcac5a7 --- /dev/null +++ b/posix/include/inttypes.h @@ -0,0 +1,58 @@ +/* + * inttypes.h + * + * fixed size integral types. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __INTTYPES_H_INCLUDED__ +#define __INTTYPES_H_INCLUDED__ + +/* INCLUDES */ + +/* OBJECTS */ + +/* TYPES */ +/* signed */ +typedef signed char int8_t; /* 8-bit signed integral type. */ +typedef signed short int int16_t; /* 16-bit signed integral type. */ +typedef signed long int int32_t; /* 32-bit signed integral type. */ +typedef signed long long int64_t; /* 64-bit signed integral type. */ + +/* unsigned */ +typedef unsigned char uint8_t; /* 8-bit unsigned integral type. */ +typedef unsigned short int uint16_t; /* 16-bit unsigned integral type. */ +typedef unsigned long int uint32_t; /* 32-bit unsigned integral type. */ +typedef unsigned long long uint64_t; /* 64-bit unsigned integral type. */ + +/* pointer-sized */ +typedef signed long int intptr_t; /* Signed integral type large enough + to hold any pointer. */ +typedef unsigned long int uintptr_t; /* Unsigned integral type large + enough to hold any pointer. */ + +/* CONSTANTS */ + +/* PROTOTYPES */ + +/* MACROS */ + +#endif /* __INTTYPES_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/iso646.h b/posix/include/iso646.h new file mode 100644 index 00000000000..dccb48fe677 --- /dev/null +++ b/posix/include/iso646.h @@ -0,0 +1,61 @@ +/* + * iso646.h + * + * alternative spellings. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __ISO646_H_INCLUDED__ +#define __ISO646_H_INCLUDED__ + +/* INCLUDES */ +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ + +#endif + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ + +/* PROTOTYPES */ + +/* MACROS */ +#define and && +#define and_eq &= +#define bitand & +#define bitor | +#define compl ~ +#define not ! +#define not_eq != +#define or || +#define or_eq |= +#define xor ^ +#define xor_eq ^= + +#endif /* __ISO646_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/libgen.h b/posix/include/libgen.h new file mode 100644 index 00000000000..692baef84d6 --- /dev/null +++ b/posix/include/libgen.h @@ -0,0 +1,50 @@ +/* + * libgen.h + * + * definitions for pattern matching functions. Conforming to the Single + * UNIX(r) Specification Version 2, System Interface & Headers Issue 5 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __LIBGEN_H_INCLUDED__ +#define __LIBGEN_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ +extern char *__loc1; /* LEGACY */ + +/* TYPES */ + +/* CONSTANTS */ + +/* PROTOTYPES */ +char *basename(char *); +char *dirname(char *); +char *regcmp(const char *, ...); /* LEGACY */ +char *regex(const char *, const char *, ...); /* LEGACY */ + +wchar_t *_Wbasename(wchar_t *); +wchar_t *_Wdirname(wchar_t *); + +/* MACROS */ + +#endif /* __LIBGEN_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/limits.h b/posix/include/limits.h new file mode 100644 index 00000000000..c81dfb6b390 --- /dev/null +++ b/posix/include/limits.h @@ -0,0 +1,43 @@ +/* TODO */ +/* + * limits.h + * + * implementation-dependent constants. Based on the Single UNIX(r) + * Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __LIMITS_H_INCLUDED__ +#define __LIMITS_H_INCLUDED__ + +/* INCLUDES */ + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ +#define OPEN_MAX (256) + +/* PROTOTYPES */ + +/* MACROS */ + +#endif /* __LIMITS_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/math.h b/posix/include/math.h new file mode 100644 index 00000000000..b14e4fb13b1 --- /dev/null +++ b/posix/include/math.h @@ -0,0 +1,63 @@ +/* + * math.h + * + * mathematical declarations. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __MATH_H_INCLUDED__ +#define __MATH_H_INCLUDED__ + +/* INCLUDES */ +#ifdef __PSXDLL__ + +/* headers for internal usage by psxdll.dll and ReactOS */ + +#else /* ! __PSXDLL__ */ + +/* standard POSIX headers */ + +#endif + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ +#define M_E ((double) 2.7182818285) /* Value of e */ +#define M_LOG2E ((double) 1.4426950419) /* Value of log2(e) */ +#define M_LOG10E ((double) 0.4342944819) /* Value of log10(e) */ +#define M_LN2 ((double)-0.6931471806) /* Value of loge2 */ +#define M_LN10 ((double) 2.3025850929) /* Value of loge10 */ +#define M_PI ((double) 3.1415926536) /* Value of Pi */ +#define M_PI_2 ((double) 1.5707963268) /* Value of Pi/2 */ +#define M_PI_4 ((double) 0.7853981634) /* Value of Pi/4 */ +#define M_1_PI ((double) 0.3183098862) /* Value of 1/Pi */ +#define M_2_PI ((double) 0.6366197724) /* Value of 2/Pi */ +#define M_2_SQRTPI ((double) 1.1283791671) /* Value of 2/Sqrt(Pi) */ +#define M_SQRT2 ((double) 1.4142135624) /* Value of Sqrt(2) */ +#define M_SQRT1_2 ((double) 0.7071067812) /* Value of Sqrt(1/2) */ + +/* PROTOTYPES */ + +/* MACROS */ + +#endif /* __MATH_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/netinet/in.h b/posix/include/netinet/in.h new file mode 100644 index 00000000000..dff9b64edcc --- /dev/null +++ b/posix/include/netinet/in.h @@ -0,0 +1,7 @@ +#ifndef __NETINET_IN_H_INCLUDED__ +#define __NETINET_IN_H_INCLUDED__ + +#endif /* __NETINET_IN_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/debug.h b/posix/include/psx/debug.h new file mode 100644 index 00000000000..4ac86dbb5a0 --- /dev/null +++ b/posix/include/psx/debug.h @@ -0,0 +1,144 @@ +/* + * psx/debug.h + * + * debugging utilities + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_DEBUG_H_INCLUDED__ +#define __PSX_DEBUG_H_INCLUDED__ + +/* INCLUDES */ +#ifdef __PSX_DEBUG_TO_STDERR__ +#include +#else /* !defined(__PSX_DEBUG_TO_STDERR__) */ +#include +#endif /* defined(__PSX_DEBUG_TO_STDERR__) */ + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ + +/* PROTOTYPES */ + +/* MACROS */ + +#define __PSX_MODULE__ "psxdll.dll" + +#ifndef NDEBUG + +#ifdef __PSX_DEBUG_TO_STDERR__ + +#if 0 +#define DEBUGOUT(MODULE,TYPE,ARGS...) \ +do{ \ + fprintf(stderr,"%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \ + fprintf(stderr,ARGS); \ + fprintf("\n"); \ +} \ +while(0) +#endif + +#define DEBUGOUT(MODULE,TYPE,ARGS...) \ +do{ \ + printf("%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \ + printf(ARGS); \ + printf("\n"); \ +} \ +while(0) + + +#else /* !defined(__PSX_DEBUG_TO_STDERR__) */ + +#define DEBUGOUT(MODULE,TYPE,ARGS...) \ +do{ \ + DbgPrint("%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \ + DbgPrint(ARGS); \ + DbgPrint("\n"); \ +} \ +while(0) + +#endif /* defined(__PSX_DEBUG_TO_STDERR__) */ + +#define DEBUGOUTIF(CONDITION,MODULE,TYPE,ARGS...) \ +if((CONDITION)) \ +{ \ + DEBUGOUT((MODULE),(TYPE),ARGS); \ +} + +#else /* defined(NDEBUG) */ + +#define DEBUGOUTIF(c,m,t,args...) +#define DEBUGOUT(m,t,args...) + +#endif /* !defined(NDEBUG) */ + +#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_HINTS__) +#define HINT(args...) DEBUGOUT(__PSX_MODULE__,"HINT",args) +#define HINTIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"HINT",args) +#else +#define HINT(args...) +#define HINTIF(c,args...) +#endif + +#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_INFOS__) +#define INFO(args...) DEBUGOUT(__PSX_MODULE__,"INFO",args) +#define INFOIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"INFO",args) +#else +#define INFO(args...) +#define INFOIF(c,args...) +#endif + +#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_WARNS__) +#define WARN(args...) DEBUGOUT(__PSX_MODULE__,"WARN",args) +#define WARNIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"WARN",args) +#else +#define WARN(args...) +#define WARNIF(c,args...) +#endif + +#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_ERRS__) +#define ERR(args...) DEBUGOUT(__PSX_MODULE__,"ERR",args) +#define ERRIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"ERR",args) +#else +#define ERR(args...) +#define ERRIF(c,args...) +#endif + +#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_TODOS__) +#define TODO(args...) DEBUGOUT(__PSX_MODULE__,"TODO",args) +#define TODOIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"TODO",args) +#else +#define TODO(args...) +#define TODOIF(c,args...) +#endif + +#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_FIXMES__) +#define FIXME(args...) DEBUGOUT(__PSX_MODULE__,"FIXME",args) +#define FIXMEIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"FIXME",args) +#else +#define FIXME(args...) +#define FIXMEIF(c,args...) +#endif + + +#endif /* __PSX_DEBUG_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/dirent.h b/posix/include/psx/dirent.h new file mode 100644 index 00000000000..e9e99ea4624 --- /dev/null +++ b/posix/include/psx/dirent.h @@ -0,0 +1,55 @@ +/* + * psx/dirent.h + * + * internal dirent.h + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_DIRENT_H_INCLUDED__ +#define __PSX_DIRENT_H_INCLUDED__ + +/* INCLUDES */ +#include +#include +#include + +/* OBJECTS */ + +/* TYPES */ +struct __internal_DIR +{ + __magic_t signature; /* signature to verify object's validity across calls */ + union __any_dirent{ + struct dirent de_ansi; + struct _Wdirent de_unicode; + } ent; /* storage for return buffer of readdir() */ + int fildes; /* file descriptor of the directory */ + FILE_DIRECTORY_INFORMATION info; /* directory entry information */ + WCHAR name[MAX_PATH]; /* filename buffer */ +}; + +/* CONSTANTS */ +#define __IDIR_MAGIC MAGIC('I', 'D', 'I', 'R') + +/* PROTOTYPES */ + +/* MACROS */ + +#endif /* __PSX_DIRENT_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/dlfcn.h b/posix/include/psx/dlfcn.h new file mode 100644 index 00000000000..b2d96feb6ab --- /dev/null +++ b/posix/include/psx/dlfcn.h @@ -0,0 +1,51 @@ +/* + * psx/dlfcn.h + * + * internal dlfcn.h + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_DLFCN_H_INCLUDED__ +#define __PSX_DLFCN_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ +/* internal representation for loaded DLLs */ +/* TODO: get rid of this. The handle should be enough, with a proper PE loader */ +struct __dlobj +{ + int global; /* if non-zero, all the other fields have no meaning */ + void *handle; /* pointer to the module mapping */ +}; + +/* CONSTANTS */ + +/* PROTOTYPES */ +void __dl_set_last_error(int); + +/* MACROS */ +#define __dl_get_reloc_flag(m) ((m) & (RTLD_LAZY | RTLD_NOW)) +#define __dl_get_scope_flag(m) ((m) & (RTLD_GLOBAL | RTLD_LOCAL)) + +#endif /* __PSX_DLFCN_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/errno.h b/posix/include/psx/errno.h new file mode 100644 index 00000000000..fb0c89c453e --- /dev/null +++ b/posix/include/psx/errno.h @@ -0,0 +1,43 @@ +/* + * psx/errno.h + * + * internal errno.h + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_ERRNO_H_INCLUDED__ +#define __PSX_ERRNO_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ + +/* PROTOTYPES */ + +/* MACROS */ +#define __status_to_errno(s) (s) +#define __set_errno_from_status(s) (errno = __status_to_errno((s))) + +#endif /* __PSX_ERRNO_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/fdtable.h b/posix/include/psx/fdtable.h new file mode 100644 index 00000000000..99fdba5c6b1 --- /dev/null +++ b/posix/include/psx/fdtable.h @@ -0,0 +1,72 @@ +/* $Id: + */ +/* + * psx/fdtable.h + * + * POSIX subsystem file descriptor table data structure + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_FDTABLE_H_INCLUDED__ +#define __PSX_FDTABLE_H_INCLUDED__ + +/* INCLUDES */ +#include +#include +#include + +/* OBJECTS */ + +/* TYPES */ +typedef struct __tagfildes_t +{ + void *FileHandle; + int OpenFlags; + int FdFlags; + size_t ExtraDataSize; + void *ExtraData; +} __fildes_t; + +typedef struct __tagfdtable_t +{ + __magic_t Signature; + int32_t LowestUnusedFileNo; + int32_t UsedDescriptors; + int32_t AllocatedDescriptors; + uint32_t DescriptorsBitmap[OPEN_MAX / 32]; + __fildes_t *Descriptors; +} __fdtable_t; + +/* CONSTANTS */ + +/* PROTOTYPES */ +int __fdtable_init(__fdtable_t *); +int __fdtable_free(__fdtable_t *); + +int __fdtable_entry_isavail(__fdtable_t *, int); +int __fdtable_entry_nextavail(__fdtable_t *, int); +int __fdtable_entry_add(__fdtable_t *, int, __fildes_t *, __fildes_t **); +int __fdtable_entry_remove(__fdtable_t *, int); +__fildes_t *__fdtable_entry_get(__fdtable_t *, int); + +/* MACROS */ +#define __FDTABLE_MAGIC MAGIC('F', 'D', 'T', 'B') + +#endif /* __PSX_FDTABLE_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/interlock.h b/posix/include/psx/interlock.h new file mode 100644 index 00000000000..475e9dbce90 --- /dev/null +++ b/posix/include/psx/interlock.h @@ -0,0 +1,43 @@ +/* + * psx/interlock.h + * + * inter-locked increment/decrement + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_INTERLOCK_H_INCLUDED__ +#define __PSX_INTERLOCK_H_INCLUDED__ + +/* INCLUDES */ + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ + +/* PROTOTYPES */ +int __interlock_inc(int *); +int __interlock_dec(int *); +int __interlock_add(int *, int); + +/* MACROS */ + +#endif /* __PSX_INTERLOCK_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/path.h b/posix/include/psx/path.h new file mode 100644 index 00000000000..369f3e06eed --- /dev/null +++ b/posix/include/psx/path.h @@ -0,0 +1,110 @@ +/* + * psx/path.h + * + * POSIX subsystem path functions + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_PATH_H_INCLUDED__ +#define __PSX_PATH_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ + +/* PROTOTYPES */ +BOOLEAN +__PdxPosixPathGetNextComponent_U +( + IN UNICODE_STRING PathName, + IN OUT PUNICODE_STRING PathComponent, + OUT PBOOLEAN TrailingDelimiter OPTIONAL +); + +BOOLEAN +__PdxPosixPathResolve_U +( + IN UNICODE_STRING PathName, + OUT PUNICODE_STRING ResolvedPathName, + IN WCHAR PathDelimiter OPTIONAL +); + +BOOLEAN +__PdxPosixPathGetNextComponent_A +( + IN ANSI_STRING PathName, + IN OUT PANSI_STRING PathComponent, + OUT PBOOLEAN TrailingDelimiter OPTIONAL +); + +BOOLEAN +__PdxPosixPathResolve_A +( + IN ANSI_STRING PathName, + OUT PANSI_STRING ResolvedPathName, + IN CHAR PathDelimiter OPTIONAL +); + +BOOLEAN +__PdxPosixPathNameToNtPathName +( + IN PWCHAR PosixPath, + OUT PUNICODE_STRING NativePath, + IN PUNICODE_STRING CurDir OPTIONAL, + IN PUNICODE_STRING RootDir OPTIONAL +); + +/* MACROS */ +/* returns non-zero if the argument is a path delimiter */ +#define IS_CHAR_DELIMITER_U(WCH) (((WCH) == L'/') || ((WCH) == L'\\')) +#define IS_CHAR_DELIMITER_A(CH) (((CH) == '/') || ((CH) == '\\')) + +/* returns non-zero if the argument is an empty path component */ +#define IS_COMPONENT_EMPTY_U(WCOMPONENT) (WCOMPONENT.Length == 0) +#define IS_COMPONENT_EMPTY_A(COMPONENT) (COMPONENT.Length == 0) + +/* returns non-zero if the argument is "." */ +#define IS_COMPONENT_DOT_U(WCOMPONENT) \ +((WCOMPONENT.Length == sizeof(WCHAR)) && (WCOMPONENT.Buffer[0] == L'.')) + +#define IS_COMPONENT_DOT_A(COMPONENT) \ +((COMPONENT.Length == 1) && (COMPONENT.Buffer[0] == '.')) + +/* returns non-zero if the argument is ".." */ +#define IS_COMPONENT_DOTDOT_U(WCOMPONENT) \ +( \ + (WCOMPONENT.Length == (sizeof(WCHAR) * 2)) && \ + (WCOMPONENT.Buffer[0] == L'.') && \ + (WCOMPONENT.Buffer[1] == L'.') \ +) + +#define IS_COMPONENT_DOTDOT_A(COMPONENT) \ +( \ + (COMPONENT.Length == 2) && \ + (COMPONENT.Buffer[0] == '.') && \ + (COMPONENT.Buffer[1] == '.') \ +) + +#endif /* __PSX_PATH_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/pdata.h b/posix/include/psx/pdata.h new file mode 100644 index 00000000000..523d278dac9 --- /dev/null +++ b/posix/include/psx/pdata.h @@ -0,0 +1,71 @@ +/* $Id: + */ +/* + * psx/pdata.h + * + * POSIX subsystem process environment data structure + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_PDATA_H_INCLUDED__ +#define __PSX_PDATA_H_INCLUDED__ + +/* INCLUDES */ +#include +#include +#include +#include + +/* OBJECTS */ + +/* TYPES */ +typedef struct __tagPDX_PDATA +{ + UNICODE_STRING NativePathBuffer; + UNICODE_STRING CurDir; + UNICODE_STRING RootPath; + HANDLE RootHandle; + __fdtable_t *FdTable; +} __PDX_PDATA, * __PPDX_PDATA; + +/* CONSTANTS */ + +/* PROTOTYPES */ + +/* MACROS */ +#define __PdxAcquirePdataLock() (RtlAcquirePebLock()) +#define __PdxReleasePdataLock() (RtlReleasePebLock()) + +#define __PdxSetProcessData()(PPDATA) ((void)((NtCurrentPeb()->SubSystemData) = (PPDATA))) +#define __PdxGetProcessData() ((__PPDX_PDATA)(&(NtCurrentPeb()->SubSystemData))) + +#define __PdxGetNativePathBuffer() ((PUNICODE_STRING)(&(__PdxGetProcessData()->NativePathBuffer))) +#define __PdxGetCurDir() ((PUNICODE_STRING)(&(__PdxGetProcessData()->CurDir))) +#define __PdxGetRootPath() ((PUNICODE_STRING)(&(__PdxGetProcessData()->RootPath))) +#define __PdxGetRootHandle() ((HANDLE)(__PdxGetProcessData()->RootHandle)) +#define __PdxGetFdTable() ((__fdtable_t *)(__PdxGetProcessData()->FdTable)) + +#define __PdxSetNativePathBuffer(BUF) ((void)((__PdxGetProcessData()->NativePathBuffer) = (BUF))) +#define __PdxSetCurDir(CURDIR) ((void)((__PdxGetProcessData()->CurDir) = (CURDIR))) +#define __PdxSetRootPath(ROOTPATH) ((void)((__PdxGetProcessData()->RootPath) = (ROOTPATH))) +#define __PdxSetRootHandle(ROOTHANDLE) ((void)((__PdxGetProcessData()->RootHandle) = (ROOTHANDLE))) +#define __PdxSetFdTable(FDTABLE) ((void)((__PdxGetProcessData()->FdTable) = (FDTABLE))) + +#endif /* __PSX_PDATA_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/pthread.h b/posix/include/psx/pthread.h new file mode 100644 index 00000000000..5168388b274 --- /dev/null +++ b/posix/include/psx/pthread.h @@ -0,0 +1,59 @@ +/* + * psx/pthread.h + * + * internal pthread.h + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_PTHREAD_H_INCLUDED__ +#define __PSX_PTHREAD_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ + +struct __mutexattr +{ + __magic_t signature; + int pshared; + int protocol; + int type; +}; + +struct __mutex +{ + __magic_t signature; + void * handle; + int protocol; + int type; +}; + +/* CONSTANTS */ +#define __PTHREAD_MUTEX_MAGIC (MAGIC('P', 'T', 'M', 'X')) +#define __PTHREAD_MUTEX_ATTR_MAGIC (MAGIC('P', 'T', 'M', 'A')) + +/* PROTOTYPES */ + +/* MACROS */ + +#endif /* __PSX_PTHREAD_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/safeobj.h b/posix/include/psx/safeobj.h new file mode 100644 index 00000000000..6f8da3df2e0 --- /dev/null +++ b/posix/include/psx/safeobj.h @@ -0,0 +1,57 @@ +/* + * psx/safeobj.h + * + * types and definitions for safe checking of user-provided objects + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_SAFEOBJ_H_INCLUDED__ +#define __PSX_SAFEOBJ_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ +typedef uint32_t __magic_t; + +/* CONSTANTS */ + +/* PROTOTYPES */ +int __safeobj_validate(void *, __magic_t); + +/* MACROS */ +/* builds a magic number from 4 characters */ +#define MAGIC(a,b,c,d) ( \ + (((uint32_t)(uint8_t)(a)) << 24) | \ + (((uint32_t)(uint8_t)(b)) << 16) | \ + (((uint32_t)(uint8_t)(c)) << 8) | \ + (((uint32_t)(uint8_t)(d)) << 0) \ +) + +/* retrieves a comma-separated list of the 4 characters in a magic number */ +#define MAGIC_DECOMPOSE(m) \ + ((uint8_t)(m >> 24)), \ + ((uint8_t)(m >> 16)), \ + ((uint8_t)(m >> 8)), \ + ((uint8_t)(m >> 0)) + +#endif /* __PSX_SAFEOBJ_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/stdlib.h b/posix/include/psx/stdlib.h new file mode 100644 index 00000000000..5367d8c05bd --- /dev/null +++ b/posix/include/psx/stdlib.h @@ -0,0 +1,49 @@ +/* + * psx/stdlib.h + * + * internal stdlib.h + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_STDLIB_H_INCLUDED__ +#define __PSX_STDLIB_H_INCLUDED__ + +/* INCLUDES */ +#include +#include +#include + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ + +/* PROTOTYPES */ + +/* MACROS */ +/* FIXME? Windows NT's ntdll doesn't export RtlGetProcessHeap() */ +#define RtlGetProcessHeap() ((HANDLE)NtCurrentPeb()->ProcessHeap) + +#define __malloc(SIZE) (RtlAllocateHeap(RtlGetProcessHeap(), 0, (SIZE))) +#define __realloc(PTR,SIZE) (RtlReAllocateHeap(RtlGetProcessHeap(), 0, (PTR), (SIZE))) +#define __free(PTR) (RtlFreeHeap(RtlGetProcessHeap(), 0, (PTR))) + +#endif /* __PSX_STDLIB_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/psx/template.h b/posix/include/psx/template.h new file mode 100644 index 00000000000..998153ece09 --- /dev/null +++ b/posix/include/psx/template.h @@ -0,0 +1,40 @@ +/* + * psx/template.h + * + * template for POSIX headers + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PSX_TEMPLATE_H_INCLUDED__ /* FIXME: replace with the appropriate tag */ +#define __PSX_TEMPLATE_H_INCLUDED__ /* FIXME: replace with the appropriate tag */ + +/* INCLUDES */ + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ + +/* PROTOTYPES */ + +/* MACROS */ + +#endif /* __PSX_TEMPLATE_H_INCLUDED__ */ /* FIXME: replace with the appropriate tag */ + +/* EOF */ + diff --git a/posix/include/pthread.h b/posix/include/pthread.h new file mode 100644 index 00000000000..29f3a84714f --- /dev/null +++ b/posix/include/pthread.h @@ -0,0 +1,139 @@ +/* + * pthread.h + * + * threads. Conforming to the Single UNIX(r) Specification Version 2, + * System Interface & Headers Issue 5 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PTHREAD_H_INCLUDED__ +#define __PTHREAD_H_INCLUDED__ + +/* INCLUDES */ +#include +#include + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ +#define PTHREAD_MUTEX_NORMAL (1) +#define PTHREAD_MUTEX_ERRORCHECK (2) +#define PTHREAD_MUTEX_RECURSIVE (3) + +#define PTHREAD_MUTEX_DEFAULT (PTHREAD_MUTEX_NORMAL) + +#define PTHREAD_PROCESS_PRIVATE (1) +#define PTHREAD_PROCESS_SHARED (2) + +#define PTHREAD_PRIO_NONE (1) + +/* PROTOTYPES */ +int pthread_attr_destroy(pthread_attr_t *); +int pthread_attr_getdetachstate(const pthread_attr_t *, int *); +int pthread_attr_getguardsize(const pthread_attr_t *, size_t *); +int pthread_attr_getinheritsched(const pthread_attr_t *, int *); +int pthread_attr_getschedparam(const pthread_attr_t *, + struct sched_param *); +int pthread_attr_getschedpolicy(const pthread_attr_t *, int *); +int pthread_attr_getscope(const pthread_attr_t *, int *); +int pthread_attr_getstackaddr(const pthread_attr_t *, void **); +int pthread_attr_getstacksize(const pthread_attr_t *, size_t *); +int pthread_attr_init(pthread_attr_t *); +int pthread_attr_setdetachstate(pthread_attr_t *, int); +int pthread_attr_setguardsize(pthread_attr_t *, size_t); +int pthread_attr_setinheritsched(pthread_attr_t *, int); +int pthread_attr_setschedparam(pthread_attr_t *, + const struct sched_param *); +int pthread_attr_setschedpolicy(pthread_attr_t *, int); +int pthread_attr_setscope(pthread_attr_t *, int); +int pthread_attr_setstackaddr(pthread_attr_t *, void *); +int pthread_attr_setstacksize(pthread_attr_t *, size_t); +int pthread_cancel(pthread_t); +void pthread_cleanup_push(void (*)(void *), void *); +void pthread_cleanup_pop(int); +int pthread_cond_broadcast(pthread_cond_t *); +int pthread_cond_destroy(pthread_cond_t *); +int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *); +int pthread_cond_signal(pthread_cond_t *); +int pthread_cond_timedwait(pthread_cond_t *, + pthread_mutex_t *, const struct timespec *); +int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); +int pthread_condattr_destroy(pthread_condattr_t *); +int pthread_condattr_getpshared(const pthread_condattr_t *, int *); +int pthread_condattr_init(pthread_condattr_t *); +int pthread_condattr_setpshared(pthread_condattr_t *, int); +int pthread_create(pthread_t *, const pthread_attr_t *, + void *(*)(void *), void *); +int pthread_detach(pthread_t); +int pthread_equal(pthread_t, pthread_t); +void pthread_exit(void *); +int pthread_getconcurrency(void); +int pthread_getschedparam(pthread_t, int *, struct sched_param *); +void *pthread_getspecific(pthread_key_t); +int pthread_join(pthread_t, void **); +int pthread_key_create(pthread_key_t *, void (*)(void *)); +int pthread_key_delete(pthread_key_t); +int pthread_mutex_destroy(pthread_mutex_t *); +int pthread_mutex_getprioceiling(const pthread_mutex_t *, int *); +int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *); +int pthread_mutex_lock(pthread_mutex_t *); +int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *); +int pthread_mutex_trylock(pthread_mutex_t *); +int pthread_mutex_unlock(pthread_mutex_t *); +int pthread_mutexattr_destroy(pthread_mutexattr_t *); +int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, + int *); +int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *); +int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *); +int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *); +int pthread_mutexattr_init(pthread_mutexattr_t *); +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); +int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); +int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); +int pthread_mutexattr_settype(pthread_mutexattr_t *, int); +int pthread_once(pthread_once_t *, void (*)(void)); +int pthread_rwlock_destroy(pthread_rwlock_t *); +int pthread_rwlock_init(pthread_rwlock_t *, + const pthread_rwlockattr_t *); +int pthread_rwlock_rdlock(pthread_rwlock_t *); +int pthread_rwlock_tryrdlock(pthread_rwlock_t *); +int pthread_rwlock_trywrlock(pthread_rwlock_t *); +int pthread_rwlock_unlock(pthread_rwlock_t *); +int pthread_rwlock_wrlock(pthread_rwlock_t *); +int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); +int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, + int *); +int pthread_rwlockattr_init(pthread_rwlockattr_t *); +int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); +pthread_t + pthread_self(void); +int pthread_setcancelstate(int, int *); +int pthread_setcanceltype(int, int *); +int pthread_setconcurrency(int); +int pthread_setschedparam(pthread_t, int , + const struct sched_param *); +int pthread_setspecific(pthread_key_t, const void *); +void pthread_testcancel(void); + +/* MACROS */ + +#endif /* __PTHREAD_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/pwd.h b/posix/include/pwd.h new file mode 100644 index 00000000000..ed06873cf00 --- /dev/null +++ b/posix/include/pwd.h @@ -0,0 +1,57 @@ +/* + * pwd.h + * + * password structure. Based on the Single UNIX(r) Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __PWD_H_INCLUDED__ +#define __PWD_H_INCLUDED__ + +/* INCLUDES */ + +/* OBJECTS */ + +/* TYPES */ +struct passwd +{ + char *pw_name; /* user's login name */ + uid_t pw_uid; /* numerical user ID */ + gid_t pw_gid; /* numerical group ID */ + char *pw_dir; /* initial working directory */ + char *pw_shell; /* program to use as shell */ +}; + +/* CONSTANTS */ + +/* PROTOTYPES */ +struct passwd *getpwnam(const char *); +struct passwd *getpwuid(uid_t); +int getpwnam_r(const char *, struct passwd *, char *, + size_t, struct passwd **); +int getpwuid_r(uid_t, struct passwd *, char *, + size_t, struct passwd **); +void endpwent(void); +struct passwd *getpwent(void); +void setpwent(void); + +/* MACROS */ + +#endif /* __PWD_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sched.h b/posix/include/sched.h new file mode 100644 index 00000000000..d0f77935cfd --- /dev/null +++ b/posix/include/sched.h @@ -0,0 +1,60 @@ +/* + * sched.h + * + * execution scheduling (REALTIME). Conforming to the Single UNIX(r) + * Specification Version 2, System Interface & Headers Issue 5 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __SCHED_H_INCLUDED__ +#define __SCHED_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ +struct sched_param +{ + int sched_priority; /* process execution scheduling priority */ +}; + +/* CONSTANTS */ +/* First in-first out (FIFO) scheduling policy */ +#define SCHED_FIFO (1) +/* Round robin scheduling policy */ +#define SCHED_RR (2) +/* Another scheduling policy */ +#define SCHED_OTHER (3) + +/* PROTOTYPES */ +int sched_get_priority_max(int); +int sched_get_priority_min(int); +int sched_getparam(pid_t, struct sched_param *); +int sched_getscheduler(pid_t); +int sched_rr_get_interval(pid_t, struct timespec *); +int sched_setparam(pid_t, const struct sched_param *); +int sched_setscheduler(pid_t, int, const struct sched_param *); +int sched_yield(void); + +/* MACROS */ + +#endif /* __SCHED_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/signal.h b/posix/include/signal.h new file mode 100644 index 00000000000..c7afdc63da8 --- /dev/null +++ b/posix/include/signal.h @@ -0,0 +1,357 @@ +/* + * signal.h + * + * signals. Conforming to the Single UNIX(r) Specification Version 2, + * System Interface & Headers Issue 5 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __SIGNAL_H_INCLUDED__ +#define __SIGNAL_H_INCLUDED__ + +/* INCLUDES */ +#include +#include + +/* OBJECTS */ + +/* TYPES */ +/* pre-declaration of time.h types to suppress warnings caused by circular + dependencies */ +struct timespec; + +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? */ + +typedef struct __tagsigset_t +{ + int _dummy; +} sigset_t; /* Integral or structure type of an object used to represent + sets of signals. */ /* TODO */ + +union sigval +{ + int sival_int; /* integer signal value */ + void* sival_ptr; /* pointer signal value */ +}; + +struct sigevent +{ + int sigev_notify; /* notification type */ + int sigev_signo; /* signal number */ + union sigval sigev_value; /* signal value */ + void (* sigev_notify_function)(union sigval); /* notification function */ + pthread_attr_t * sigev_notify_attributes; /* notification attributes */ +}; + + +typedef struct __tagsiginfo_t +{ + int si_signo; /* signal number */ + int si_errno; /* if non-zero, an errno value associated with + this signal, as defined in */ + int si_code; /* signal code */ + pid_t si_pid; /* sending process ID */ + uid_t si_uid; /* real user ID of sending process */ + void *si_addr; /* address of faulting instruction */ + int si_status; /* exit value or signal */ + long si_band; /* band event for SIGPOLL */ + union sigval si_value; /* signal value */ +} siginfo_t; + +struct sigaction +{ + 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 */ + int sa_flags; /* special flags */ + void (* sa_sigaction)(int, siginfo_t *, void *); + /* pointer to signal handler function + or one of the macros SIG_IGN or SIG_DFL */ +}; + +typedef struct __tagstack_t +{ + void *ss_sp; /* stack base or pointer */ + size_t ss_size; /* stack size */ + int ss_flags; /* flags */ +} stack_t; + +struct sigstack +{ + int ss_onstack; /* non-zero when signal stack is in use */ + void *ss_sp; /* signal stack pointer */ +}; + +/* 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) + +/* 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) + +/* FIXME: the following constants need to be reviewed */ +/* Do not generate SIGCHLD when children stop. */ +#define SA_NOCLDSTOP (0x00000001) +/* The resulting set is the union of the current set and the signal set + pointed to by the argument set. */ +#define SA_ONSTACK (0x00000002) +/* Causes signal dispositions to be set to SIG_DFL on entry to signal + handlers. */ +#define SA_RESETHAND (0x00000004) +/* Causes certain functions to become restartable. */ +#define SA_RESTART (0x00000008) +/* Causes extra information to be passed to signal handlers at the time + of receipt of a signal. */ +#define SA_SIGINFO (0x00000010) +/* Causes implementations not to create zombie processes on child death. */ +#define SA_NOCLDWAIT (0x00000020) +/* Causes signal not to be automatically blocked on entry to signal + handler. */ +#define SA_NODEFER (0x00000040) + +/* FIXME: the following constants need to be reviewed */ +/* The resulting set is the intersection of the current set and the + complement of the signal set pointed to by the argument set. */ +#define SIG_BLOCK (1) +/* The resulting set is the signal set pointed to by the argument + set. */ +#define SIG_UNBLOCK (2) +/* Causes signal delivery to occur on an alternate stack. */ +#define SIG_SETMASK (3) + +/* FIXME: the following constants need to be reviewed */ +/* Process is executing on an alternate signal stack. */ +#define SS_ONSTACK (1) +/* Alternate signal stack is disabled. */ +#define SS_DISABLE (2) + +/* Minimum stack size for a signal handler. */ /* FIXME */ +#define MINSIGSTKSZ (0) +/* Default size in bytes for the alternate signal stack. */ /* FIXME */ +#define SIGSTKSZ (0) + +/* + signal-specific reasons why the signal was generated + */ +/* SIGILL */ +/* illegal opcode */ +#define ILL_ILLOPC (1) +/* illegal operand */ +#define ILL_ILLOPN (2) +/* illegal addressing mode */ +#define ILL_ILLADR (3) +/* illegal trap */ +#define ILL_ILLTRP (4) +/* privileged opcode */ +#define ILL_PRVOPC (5) +/* privileged register */ +#define ILL_PRVREG (6) +/* coprocessor error */ +#define ILL_COPROC (7) +/* internal stack error */ +#define ILL_BADSTK (8) + +/* SIGFPE */ +/* integer divide by zero */ +#define FPE_INTDIV +/* integer overflow */ +#define FPE_INTOVF +/* floating point divide by zero */ +#define FPE_FLTDIV +/* floating point overflow */ +#define FPE_FLTOVF +/* floating point underflow */ +#define FPE_FLTUND +/* floating point inexact result */ +#define FPE_FLTRES +/* invalid floating point operation */ +#define FPE_FLTINV +/* subscript out of range */ +#define FPE_FLTSUB + +/* SIGSEGV */ +/* address not mapped to object */ +#define SEGV_MAPERR +/* invalid permissions for mapped object */ +#define SEGV_ACCERR + +/* SIGBUS */ +/* invalid address alignment */ +#define BUS_ADRALN +/* non-existent physical address */ +#define BUS_ADRERR +/* object specific hardware error */ +#define BUS_OBJERR + +/* SIGTRAP */ +/* process breakpoint */ +#define TRAP_BRKPT +/* process trace trap */ +#define TRAP_TRACE + +/* SIGCHLD */ +/* child has exited */ +#define CLD_EXITED +/* child has terminated abnormally and did not create a core file */ +#define CLD_KILLED +/* child has terminated abnormally and created a core file */ +#define CLD_DUMPED +/* traced child has trapped */ +#define CLD_TRAPPED +/* child has stopped */ +#define CLD_STOPPED +/* stopped child has continued */ +#define CLD_CONTINUED + +/* SIGPOLL */ +/* data input available */ +#define POLL_IN +/* output buffers available */ +#define POLL_OUT +/* input message available */ +#define POLL_MSG +/* I/O error */ +#define POLL_ERR +/* high priority input available */ +#define POLL_PRI +/* device disconnected */ +#define POLL_HUP +/* signal sent by kill() */ +#define SI_USER +/* signal sent by the sigqueue() */ +#define SI_QUEUE +/* signal generated by expiration of a timer set by timer_settime() */ +#define SI_TIMER +/* signal generated by completion of an asynchronous I/O request */ +#define SI_ASYNCIO +/* signal generated by arrival of a message on an empty message queue */ +#define SI_MESGQ + +/* PROTOTYPES */ +void (*bsd_signal(int, void (*)(int)))(int); +int kill(pid_t, int); +int killpg(pid_t, int); +int pthread_kill(pthread_t, int); +int pthread_sigmask(int, const sigset_t *, sigset_t *); +int raise(int); +int sigaction(int, const struct sigaction *, struct sigaction *); +int sigaddset(sigset_t *, int); +int sigaltstack(const stack_t *, stack_t *); +int sigdelset(sigset_t *, int); +int sigemptyset(sigset_t *); +int sigfillset(sigset_t *); +int sighold(int); +int sigignore(int); +int siginterrupt(int, int); +int sigismember(const sigset_t *, int); +void (*signal(int, void (*)(int)))(int); +int sigpause(int); +int sigpending(sigset_t *); +int sigprocmask(int, const sigset_t *, sigset_t *); +int sigqueue(pid_t, int, const union sigval); +int sigrelse(int); +void (*sigset(int, void (*)(int)))(int); +int sigstack(struct sigstack *ss, + struct sigstack *oss); /* LEGACY */ +int sigsuspend(const sigset_t *); +int sigtimedwait(const sigset_t *, siginfo_t *, + const struct timespec *); +int sigwait(const sigset_t *set, int *sig); +int sigwaitinfo(const sigset_t *, siginfo_t *); + +/* MACROS */ + +#endif /* __SIGNAL_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/stdarg.h b/posix/include/stdarg.h new file mode 100644 index 00000000000..6ed8b5f739d --- /dev/null +++ b/posix/include/stdarg.h @@ -0,0 +1,55 @@ +/* + * stdarg.h + * + * handle variable argument list. Based on the Single UNIX(r) + * Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __STDARG_H_INCLUDED__ +#define __STDARG_H_INCLUDED__ + +/* OBJECTS */ + +/* TYPES */ +typedef char* va_list; + +/* CONSTANTS */ + +/* PROTOTYPES */ + +/* MACROS */ +/* taken from mingw's stdarg.h */ + +/* Amount of space required in an argument list (ie. the stack) for an + argument of type t. */ +#define __va_argsiz(t) \ + (((sizeof(t) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) + +#define va_start(ap, pN) \ + ((ap) = ((va_list) (&pN) + __va_argsiz(pN))) + +#define va_end(ap) ((void)0) + +#define va_arg(ap, t) \ + (((ap) = (ap) + __va_argsiz(t)), \ + *((t*) (void*) ((ap) - __va_argsiz(t)))) + +#endif /* __STDARG_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/stddef.h b/posix/include/stddef.h new file mode 100644 index 00000000000..debec6c66b3 --- /dev/null +++ b/posix/include/stddef.h @@ -0,0 +1,48 @@ +/* + * stddef.h + * + * standard type definitions. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __STDDEF_H_INCLUDED__ +#define __STDDEF_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ +typedef signed long int ptrdiff_t; +typedef unsigned short int wchar_t; + +/* CONSTANTS */ +#ifndef NULL +#define NULL ((void *)(0)) /* Null pointer constant. */ +#endif + +/* PROTOTYPES */ + +/* MACROS */ +#define offsetof(t,m) ((size_t) &((t *)0)->m) + +#endif /* __STDDEF_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/stdio.h b/posix/include/stdio.h new file mode 100644 index 00000000000..7fc1d1966cf --- /dev/null +++ b/posix/include/stdio.h @@ -0,0 +1,162 @@ +/* + * stdio.h + * + * standard buffered input/output. + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __STDIO_H_INCLUDED__ +#define __STDIO_H_INCLUDED__ + +/* INCLUDES */ +#include +#include +#include +#include + +/* OBJECTS */ +extern char *optarg; +extern int opterr; +extern int optind; /* (LEGACY) */ +extern int optopt; + +/* TYPES */ +typedef struct _tagFILE +{ + int _dummy; +} FILE; + +typedef struct _tagfpos_t +{ + int _dummy; +} fpos_t; + + +/* CONSTANTS */ +/* Size of buffers. */ +#define BUFSIZ (0x10000) + +/* Maximum size in bytes of the longest filename string that the implementation + guarantees can be opened. */ +#define FILENAME_MAX (255) + +/* Number of streams which the implementation guarantees can be open + simultaneously. The value will be at least eight. */ +#define FOPEN_MAX (8) + +/* Input/output fully buffered. */ +#define _IOFBF (1) +/* Input/output line buffered. */ +#define _IOLBF (2) +/* Input/output unbuffered. */ +#define _IONBF (3) + +/* Maximum size of character array to hold ctermid() output. */ +#define L_ctermid (255) +/* Maximum size of character array to hold cuserid() output. (LEGACY) */ +#define L_cuserid (255) +/* Maximum size of character array to hold tmpnam() output. */ +#define L_tmpnam (255) + +/* Minimum number of unique filenames generated by tmpnam(). Maximum number + of times an application can call tmpnam() reliably. The value of TMP_MAX + will be at least 10,000. */ +#define TMP_MAX (0xFFFF) + +/* End-of-file return value. */ +#define EOF (-1) + +/* default directory prefix for tempnam() */ +#define P_tmpdir "/tmp/" + +/* Standard error output stream. */ +#define stderr ((FILE *)STDERR_FILENO) +/* Standard input stream. */ +#define stdin ((FILE *)STDIN_FILENO) +/* Standard output stream. */ +#define stdout ((FILE *)STDOUT_FILENO) + +/* PROTOTYPES */ +void clearerr(FILE *); +char *ctermid(char *); +char *cuserid(char *); /* (LEGACY) */ +int fclose(FILE *); +FILE *fdopen(int, const char *); +int feof(FILE *); +int ferror(FILE *); +int fflush(FILE *); +int fgetc(FILE *); +int fgetpos(FILE *, fpos_t *); +char *fgets(char *, int, FILE *); +int fileno(FILE *); +void flockfile(FILE *); +FILE *fopen(const char *, const char *); +int fprintf(FILE *, const char *, ...); +int fputc(int, FILE *); +int fputs(const char *, FILE *); +size_t fread(void *, size_t, size_t, FILE *); +FILE *freopen(const char *, const char *, FILE *); +int fscanf(FILE *, const char *, ...); +int fseek(FILE *, long int, int); +int fseeko(FILE *, off_t, int); +int fsetpos(FILE *, const fpos_t *); +long int ftell(FILE *); +off_t ftello(FILE *); +int ftrylockfile(FILE *); +void funlockfile(FILE *); +size_t fwrite(const void *, size_t, size_t, FILE *); +int getc(FILE *); +int getchar(void); +int getc_unlocked(FILE *); +int getchar_unlocked(void); +int getopt(int, char * const[], const char *); /* (LEGACY) */ +char *gets(char *); +int getw(FILE *); +int pclose(FILE *); +void perror(const char *); +FILE *popen(const char *, const char *); +int printf(const char *, ...); +int putc(int, FILE *); +int putchar(int); +int putc_unlocked(int, FILE *); +int putchar_unlocked(int); +int puts(const char *); +int putw(int, FILE *); +int remove(const char *); +int rename(const char *, const char *); +void rewind(FILE *); +int scanf(const char *, ...); +void setbuf(FILE *, char *); +int setvbuf(FILE *, char *, int, size_t); +int snprintf(char *, size_t, const char *, ...); +int sprintf(char *, const char *, ...); +int sscanf(const char *, const char *, int, ...); +char *tempnam(const char *, const char *); +FILE *tmpfile(void); +char *tmpnam(char *); +int ungetc(int, FILE *); +int vfprintf(FILE *, const char *, va_list); +int vprintf(const char *, va_list); +int vsnprintf(char *, size_t, const char *, va_list); +int vsprintf(char *, const char *, va_list); + +/* MACROS */ + +#endif /* __STDIO_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/stdlib.h b/posix/include/stdlib.h new file mode 100644 index 00000000000..2cdf5167129 --- /dev/null +++ b/posix/include/stdlib.h @@ -0,0 +1,128 @@ +/* + * stdlib.h + * + * standard library definitions. Based on the Single UNIX(r) + * Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __STDLIB_H_INCLUDED__ +#define __STDLIB_H_INCLUDED__ + +/* INCLUDES */ +#include +#include +#include +#include + +/* OBJECTS */ + +/* TYPES */ +typedef struct __tagdiv_t +{ + int quot; /* quotient */ + int rem; /* remainder */ +} div_t; + +typedef struct __tagldiv_t +{ + long int quot; /* quotient */ + long int rem; /* remainder */ +} ldiv_t; + +/* CONSTANTS */ +#define EXIT_FAILURE (-1) /* Unsuccessful termination for exit(), evaluates + to a non-zero value. */ +#define EXIT_SUCCESS (0) /* Successful termination for exit(), evaluates to 0. */ + +/* FIXME */ +#define RAND_MAX (32767) /* Maximum value returned by rand(), at least 32,767. */ + +/* FIXME */ +#define MB_CUR_MAX (1) /* Integer expression whose value is the maximum number + of bytes in a character specified by the current + locale. */ + +/* PROTOTYPES */ +long a64l(const char *); +void abort(void); +int abs(int); +int atexit(void (*)(void)); +double atof(const char *); +int atoi(const char *); +long int atol(const char *); +void *bsearch(const void *, const void *, size_t, size_t, + int (*)(const void *, const void *)); +void *calloc(size_t, size_t); +div_t div(int, int); +double drand48(void); +char *ecvt(double, int, int *, int *); +double erand48(unsigned short int[3]); +void exit(int); +char *fcvt (double, int, int *, int *); +void free(void *); +char *gcvt(double, int, char *); +char *getenv(const char *); +int getsubopt(char **, char *const *, char **); +int grantpt(int); +char *initstate(unsigned int, char *, size_t); +long int jrand48(unsigned short int[3]); +char *l64a(long); +long int labs(long int); +void lcong48(unsigned short int[7]); +ldiv_t ldiv(long int, long int); +long int lrand48(void); +void *malloc(size_t); +int mblen(const char *, size_t); +size_t mbstowcs(wchar_t *, const char *, size_t); +int mbtowc(wchar_t *, const char *, size_t); +char *mktemp(char *); +int mkstemp(char *); +long int mrand48(void); +long int nrand48(unsigned short int [3]); +char *ptsname(int); +int putenv(char *); +void qsort(void *, size_t, size_t, int (*)(const void *, + const void *)); +int rand(void); +int rand_r(unsigned int *); +long random(void); +void *realloc(void *, size_t); +char *realpath(const char *, char *); +unsigned short int seed48(unsigned short int[3]); +void setkey(const char *); +char *setstate(const char *); +void srand(unsigned int); +void srand48(long int); +void srandom(unsigned); +double strtod(const char *, char **); +long int strtol(const char *, char **, int); +unsigned long int + strtoul(const char *, char **, int); +int system(const char *); +int ttyslot(void); /* (LEGACY) */ +int unlockpt(int); +void *valloc(size_t); /* (LEGACY) */ +size_t wcstombs(char *, const wchar_t *, size_t); +int wctomb(char *, wchar_t); + +/* MACROS */ + +#endif /* __STDLIB_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/string.h b/posix/include/string.h new file mode 100644 index 00000000000..f73d6387b45 --- /dev/null +++ b/posix/include/string.h @@ -0,0 +1,66 @@ +/* + * string.h + * + * string operations. Based on the Single UNIX(r) Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __STRING_H_INCLUDED__ /* replace with the appropriate tag */ +#define __STRING_H_INCLUDED__ /* replace with the appropriate tag */ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ + +/* CONSTANTS */ + +/* PROTOTYPES */ +void *memccpy(void *, const void *, int, size_t); +void *memchr(const void *, int, size_t); +int memcmp(const void *, const void *, size_t); +void *memcpy(void *, const void *, size_t); +void *memmove(void *, const void *, size_t); +void *memset(void *, int, size_t); +char *strcat(char *, const char *); +char *strchr(const char *, int); +int strcmp(const char *, const char *); +int strcoll(const char *, const char *); +char *strcpy(char *, const char *); +size_t strcspn(const char *, const char *); +char *strdup(const char *); +char *strerror(int); +size_t strlen(const char *); +char *strncat(char *, const char *, size_t); +int strncmp(const char *, const char *, size_t); +char *strncpy(char *, const char *, size_t); +char *strpbrk(const char *, const char *); +char *strrchr(const char *, int); +size_t strspn(const char *, const char *); +char *strstr(const char *, const char *); +char *strtok(char *, const char *); +char *strtok_r(char *, const char *, char **); +size_t strxfrm(char *, const char *, size_t); + +/* MACROS */ + +#endif /* __STRING_H_INCLUDED__ */ /* replace with the appropriate tag */ + +/* EOF */ + diff --git a/posix/include/sys/ipc.h b/posix/include/sys/ipc.h new file mode 100644 index 00000000000..6a49a8a7d4c --- /dev/null +++ b/posix/include/sys/ipc.h @@ -0,0 +1,7 @@ +#ifndef __SYS_IPC_H_INCLUDED__ +#define __SYS_IPC_H_INCLUDED__ + +#endif /* __SYS_IPC_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/mman.h b/posix/include/sys/mman.h new file mode 100644 index 00000000000..952a6e9d537 --- /dev/null +++ b/posix/include/sys/mman.h @@ -0,0 +1,7 @@ +#ifndef __SYS_MMAN_H_INCLUDED__ +#define __SYS_MMAN_H_INCLUDED__ + +#endif /* __SYS_MMAN_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/msg.h b/posix/include/sys/msg.h new file mode 100644 index 00000000000..6a8f1ee216b --- /dev/null +++ b/posix/include/sys/msg.h @@ -0,0 +1,7 @@ +#ifndef __SYS_MSG_H_INCLUDED__ +#define __SYS_MSG_H_INCLUDED__ + +#endif /* __SYS_MSG_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/resource.h b/posix/include/sys/resource.h new file mode 100644 index 00000000000..2e74b0b377b --- /dev/null +++ b/posix/include/sys/resource.h @@ -0,0 +1,7 @@ +#ifndef __SYS_RESOURCE_H_INCLUDED__ +#define __SYS_RESOURCE_H_INCLUDED__ + +#endif /* __SYS_RESOURCE_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/sem.h b/posix/include/sys/sem.h new file mode 100644 index 00000000000..0a1a896fbdc --- /dev/null +++ b/posix/include/sys/sem.h @@ -0,0 +1,7 @@ +#ifndef __SYS_SEM_H_INCLUDED__ +#define __SYS_SEM_H_INCLUDED__ + +#endif /* __SYS_SEM_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/shm.h b/posix/include/sys/shm.h new file mode 100644 index 00000000000..9e91b6a6808 --- /dev/null +++ b/posix/include/sys/shm.h @@ -0,0 +1,7 @@ +#ifndef __SYS_SHM_H_INCLUDED__ +#define __SYS_SHM_H_INCLUDED__ + +#endif /* __SYS_SHM_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/socket.h b/posix/include/sys/socket.h new file mode 100644 index 00000000000..5ac6f821729 --- /dev/null +++ b/posix/include/sys/socket.h @@ -0,0 +1,7 @@ +#ifndef __SYS_SOCKET_H_INCLUDED__ +#define __SYS_SOCKET_H_INCLUDED__ + +#endif /* __SYS_SOCKET_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/stat.h b/posix/include/sys/stat.h new file mode 100644 index 00000000000..4ee2745c306 --- /dev/null +++ b/posix/include/sys/stat.h @@ -0,0 +1,120 @@ +/* + * sys/stat.h + * + * data returned by the stat() function. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __SYS_STAT_H_INCLUDED__ +#define __SYS_STAT_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* 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) */ + 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 */ + 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 */ + blkcnt_t st_blocks; /* number of blocks allocated for this object */ +}; + +/* CONSTANTS */ +/* + 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 */ + +/* type of file */ +#define S_IFMT (S_IFBLK | S_IFCHR | S_IFIFO | S_IFREG | S_IFDIR | S_IFLNK) + +/* + file mode bits + */ +#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_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_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 */ + +/* + the following macros will test whether a file is of the specified type + */ +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#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_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) + +/* shared memory, semaphores and message queues are unlikely to be ever + implemented as files */ +#define S_TYPEISMQ(buf) (0) /* Test for a message queue */ +#define S_TYPEISSEM(buf) (0) /* Test for a semaphore */ +#define S_TYPEISSHM(buf) (0) /* Test for a shared memory object */ + +/* PROTOTYPES */ +int chmod(const char *, mode_t); +int fchmod(int, mode_t); +int fstat(int, struct stat *); +int lstat(const char *, struct stat *); +int mkdir(const char *, mode_t); +int mkfifo(const char *, mode_t); +int mknod(const char *, mode_t, dev_t); +int stat(const char *, struct stat *); +mode_t umask(mode_t); + +/* MACROS */ + +#endif /* __SYS_STAT_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/statvfs.h b/posix/include/sys/statvfs.h new file mode 100644 index 00000000000..56e87b099c3 --- /dev/null +++ b/posix/include/sys/statvfs.h @@ -0,0 +1,7 @@ +#ifndef __SYS_STATVFS_H_INCLUDED__ +#define __SYS_STATVFS_H_INCLUDED__ + +#endif /* __SYS_STATVFS_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/time.h b/posix/include/sys/time.h new file mode 100644 index 00000000000..d27f87de064 --- /dev/null +++ b/posix/include/sys/time.h @@ -0,0 +1,7 @@ +#ifndef __SYS_TIME_H_INCLUDED__ +#define __SYS_TIME_H_INCLUDED__ + +#endif /* __SYS_TIME_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/timeb.h b/posix/include/sys/timeb.h new file mode 100644 index 00000000000..8235c4d7b9e --- /dev/null +++ b/posix/include/sys/timeb.h @@ -0,0 +1,7 @@ +#ifndef __SYS_TIMEB_H_INCLUDED__ +#define __SYS_TIMEB_H_INCLUDED__ + +#endif /* __SYS_TIMEB_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/times.h b/posix/include/sys/times.h new file mode 100644 index 00000000000..b4014456033 --- /dev/null +++ b/posix/include/sys/times.h @@ -0,0 +1,7 @@ +#ifndef __SYS_TIMES_H_INCLUDED__ +#define __SYS_TIMES_H_INCLUDED__ + +#endif /* __SYS_TIMES_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/types.h b/posix/include/sys/types.h new file mode 100644 index 00000000000..a738115c67b --- /dev/null +++ b/posix/include/sys/types.h @@ -0,0 +1,80 @@ +/* + * sys/types.h + * + * data types. Based on the Single UNIX(r) Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __SYS_TYPES_H_INCLUDED__ +#define __SYS_TYPES_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ +/* FIXME: all these types need to be checked */ +typedef unsigned long int blkcnt_t; /* Used for file block counts */ +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 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 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. */ + +/* pthread types */ +typedef void * pthread_cond_t; /* Used for condition variables. */ +typedef void * pthread_condattr_t; /* Used to identify a condition attribute object. */ +typedef void * pthread_key_t; /* Used for thread-specific data keys. */ +typedef void * pthread_attr_t; /* Used to identify a thread attribute object. */ + +typedef void * pthread_mutex_t; +typedef void * pthread_mutexattr_t; + +typedef void * pthread_once_t; /* Used for dynamic package initialisation. */ +typedef void * pthread_rwlock_t; /* Used for read-write locks. */ +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 long long suseconds_t; /* Used for time in microseconds */ +typedef unsigned 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. */ + +/* CONSTANTS */ + +/* PROTOTYPES */ + +/* MACROS */ + +#endif /* __SYS_TYPES_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/uio.h b/posix/include/sys/uio.h new file mode 100644 index 00000000000..2e278911fc0 --- /dev/null +++ b/posix/include/sys/uio.h @@ -0,0 +1,7 @@ +#ifndef __SYS_UIO_H_INCLUDED__ +#define __SYS_UIO_H_INCLUDED__ + +#endif /* __SYS_UIO_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/un.h b/posix/include/sys/un.h new file mode 100644 index 00000000000..9fc422a9319 --- /dev/null +++ b/posix/include/sys/un.h @@ -0,0 +1,7 @@ +#ifndef __SYS_UN_H_INCLUDED__ +#define __SYS_UN_H_INCLUDED__ + +#endif /* __SYS_UN_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/utsname.h b/posix/include/sys/utsname.h new file mode 100644 index 00000000000..bd2b9b32ec1 --- /dev/null +++ b/posix/include/sys/utsname.h @@ -0,0 +1,52 @@ +/* + * sys/utsname.h + * + * system name structure. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __SYS_UTSNAME_H_INCLUDED__ +#define __SYS_UTSNAME_H_INCLUDED__ + +/* INCLUDES */ + +/* OBJECTS */ + +/* TYPES */ +struct utsname +{ + char sysname[255]; /* name of this implementation of the operating system */ + char nodename[255]; /* name of this node within an implementation-dependent + communications network */ + char release[255]; /* current release level of this implementation */ + char version[255]; /* current version level of this release */ + char machine[255]; /* name of the hardware type on which the system is + running */ +}; + +/* CONSTANTS */ + +/* PROTOTYPES */ +int uname(struct utsname *); + +/* MACROS */ + +#endif /* __SYS_UTSNAME_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/sys/wait.h b/posix/include/sys/wait.h new file mode 100644 index 00000000000..434a4cedba1 --- /dev/null +++ b/posix/include/sys/wait.h @@ -0,0 +1,7 @@ +#ifndef __SYS_WAIT_H_INCLUDED__ +#define __SYS_WAIT_H_INCLUDED__ + +#endif /* __SYS_WAIT_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/time.h b/posix/include/time.h new file mode 100644 index 00000000000..664ce22b41c --- /dev/null +++ b/posix/include/time.h @@ -0,0 +1,111 @@ +/* + * time.h + * + * time types. Based on the Single UNIX(r) Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __TIME_H_INCLUDED__ +#define __TIME_H_INCLUDED__ + +/* INCLUDES */ +#include +#include + +/* OBJECTS */ +//extern static int getdate_err; /* FIXME */ +extern int daylight; +extern long int timezone; +extern char *tzname[]; + +/* TYPES */ +/* pre-declaration of signal.h types to suppress warnings caused by circular + dependencies */ +struct sigevent; + +struct tm +{ + int tm_sec; /* seconds [0,61] */ + int tm_min; /* minutes [0,59] */ + int tm_hour; /* hour [0,23] */ + int tm_mday; /* day of month [1,31] */ + int tm_mon; /* month of year [0,11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* day of week [0,6] (Sunday = 0) */ + int tm_yday; /* day of year [0,365] */ + int tm_isdst; /* daylight savings flag */ +}; + +struct timespec +{ + time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; + +struct itimerspec +{ + struct timespec it_interval; /* timer period */ + struct timespec it_value; /* timer expiration */ +}; + +/* CONSTANTS */ +/* FIXME: all the constants are wrong */ +/* Number of clock ticks per second returned by the times() function (LEGACY). */ +#define CLK_TCK (1) +/* A number used to convert the value returned by the clock() function into + seconds. */ +#define CLOCKS_PER_SEC (1) +/* The identifier of the systemwide realtime clock. */ +#define CLOCK_REALTIME (0) +/* Flag indicating time is absolute with respect to the clock associated with a + timer. */ +#define TIMER_ABSTIME (1) + +/* PROTOTYPES */ +char *asctime(const struct tm *); +char *asctime_r(const struct tm *, char *); +clock_t clock(void); +int clock_getres(clockid_t, struct timespec *); +int clock_gettime(clockid_t, struct timespec *); +int clock_settime(clockid_t, const struct timespec *); +char *ctime(const time_t *); +char *ctime_r(const time_t *, char *); +double difftime(time_t, time_t); +struct tm *getdate(const char *); +struct tm *gmtime(const time_t *); +struct tm *gmtime_r(const time_t *, struct tm *); +struct tm *localtime(const time_t *); +struct tm *localtime_r(const time_t *, struct tm *); +time_t mktime(struct tm *); +int nanosleep(const struct timespec *, struct timespec *); +size_t strftime(char *, size_t, const char *, const struct tm *); +char *strptime(const char *, const char *, struct tm *); +time_t time(time_t *); +int timer_create(clockid_t, struct sigevent *, timer_t *); +int timer_delete(timer_t); +int timer_gettime(timer_t, struct itimerspec *); +int timer_getoverrun(timer_t); +int timer_settime(timer_t, int, const struct itimerspec *, + struct itimerspec *); +void tzset(void); + +/* MACROS */ + +#endif /* __TIME_H_INCLUDED__ */ /* replace with the appropriate tag */ + +/* EOF */ + diff --git a/posix/include/ucontext.h b/posix/include/ucontext.h new file mode 100644 index 00000000000..0ef8daaf1bb --- /dev/null +++ b/posix/include/ucontext.h @@ -0,0 +1,59 @@ +/* + * ucontext.h + * + * user context. Based on the Single UNIX(r) Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __UCONTEXT_H_INCLUDED__ +#define __UCONTEXT_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ +typedef void * mcontext_t; + +typedef struct _tagucontext_t ucontext_t; + +struct _tagucontext_t +{ + ucontext_t *uc_link; /* pointer to the context that will be resumed + when this context returns */ + sigset_t uc_sigmask; /* the set of signals that are blocked when this + context is active */ + stack_t uc_stack; /* the stack used by this context */ + mcontext_t uc_mcontext; /* a machine-specific representation of the saved + context */ +}; + +/* CONSTANTS */ + +/* PROTOTYPES */ +int getcontext(ucontext_t *); +int setcontext(const ucontext_t *); +void makecontext(ucontext_t *, (void *)(), int, ...); +int swapcontext(ucontext_t *, const ucontext_t *); + +/* MACROS */ + +#endif /* __UCONTEXT_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/unistd.h b/posix/include/unistd.h new file mode 100644 index 00000000000..1483dae5bad --- /dev/null +++ b/posix/include/unistd.h @@ -0,0 +1,490 @@ +/* + * psx/template.h + * + * standard symbolic constants and types. Based on the Single UNIX(r) + * Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __UNISTD_H_INCLUDED__ +#define __UNISTD_H_INCLUDED__ + +/* INCLUDES */ +#include +#include +#include + +/* OBJECTS */ +extern char *optarg; +extern int optind, opterr, optopt; + +/* TYPES */ + +/* CONSTANTS */ +/* FIXME: set these constants appropriately */ +/* Integer value indicating version of the ISO POSIX-1 standard (C + language binding). */ +#define _POSIX_VERSION (0) + +/* Integer value indicating version of the ISO POSIX-2 standard + (Commands). */ +#define _POSIX2_VERSION (0) + +/* Integer value indicating version of the ISO POSIX-2 standard (C + language binding). */ +#define _POSIX2_C_VERSION (0) + +/* Integer value indicating version of the X/Open Portability Guide to + which the implementation conforms. */ +#define _XOPEN_VERSION (500) + +/* The version of the XCU specification to which the implementation + conforms */ +/* TODO: set to an appropriate value when commands and utilities will + be available */ +#define _XOPEN_XCU_VERSION (-1) + +#if _XOPEN_XCU_VERSION != -1 +#error TODO: define these constants +#define _POSIX2_C_BIND +#define _POSIX2_C_VERSION +#define _POSIX2_CHAR_TERM +#define _POSIX2_LOCALEDEF +#define _POSIX2_UPE +#define _POSIX2_VERSION +#endif + +#if 0 +/* TODO: check for conformance to the following specs */ +#define _XOPEN_XPG2 +#define _XOPEN_XPG3 +#define _XOPEN_XPG4 +#define _XOPEN_UNIX +#endif + +#if 0 +/* TODO: don't forget these features */ +/* The use of chown() is restricted to a process with appropriate + privileges, and to changing the group ID of a file only to the + effective group ID of the process or to one of its supplementary + group IDs. */ +#define _POSIX_CHOWN_RESTRICTED + +/* Terminal special characters defined in can be disabled + using this character value. */ +#define _POSIX_VDISABLE + +/* Each process has a saved set-user-ID and a saved set-group-ID. */ +#define _POSIX_SAVED_IDS + +/* Implementation supports job control. */ +#define _POSIX_JOB_CONTROL + +#endif + +/* Pathname components longer than {NAME_MAX} generate an error. */ +#define _POSIX_NO_TRUNC (1) + +/* The implementation supports the threads option. */ +#define _POSIX_THREADS (1) + +/* FIXME: none of the following is strictly true yet */ +/* The implementation supports the thread stack address attribute + option. */ /* FIXME: not currently implemented. Should be trivial */ +#define _POSIX_THREAD_ATTR_STACKADDR (1) + +/* The implementation supports the thread stack size attribute + option. */ /* FIXME: not currently implemented. Should be trivial */ +#define _POSIX_THREAD_ATTR_STACKSIZE (1) + +/* The implementation supports the process-shared synchronisation + option. */ /* FIXME? not sure */ +#define _POSIX_THREAD_PROCESS_SHARED (1) + +/* The implementation supports the thread-safe functions option. */ +/* FIXME: fix errno (currently not thread-safe) */ +#define _POSIX_THREAD_SAFE_FUNCTIONS (1) + +/* +  Constants for Options and Feature Groups + */ + +/* Implementation supports the C Language Binding option. This will + always have a value other than -1. */ +#define _POSIX2_C_BIND (1) + +/* Implementation supports the C Language Development Utilities + option. */ /* FIXME: please change this when C compiler and + utilities are ported */ +#define _POSIX2_C_DEV (-1) + +/* Implementation supports at least one terminal type. */ /* FIXME: + please change this when terminal emulation is complete */ +#define _POSIX2_CHAR_TERM (-1) + +/* Implementation supports the FORTRAN Development Utilities option. */ +/* FIXME: please change this when Fortran compiler and utilities are + ported */ +#define _POSIX2_FORT_DEV (-1) + +/* Implementation supports the FORTRAN Run-time Utilities option. */ +/* FIXME: please change this when Fortran runtimes are ported */ +#define _POSIX2_FORT_RUN (-1) + +/* Implementation supports the creation of locales by the localedef + utility. */ /* FIXME: please change this when locales are ready */ +#define _POSIX2_LOCALEDEF (-1) + +/* Implementation supports the Software Development Utilities option. */ +/* FIXME? */ +#define _POSIX2_SW_DEV (-1) + +/* The implementation supports the User Portability Utilities option. */ +/* FIXME? */ +#define _POSIX2_UPE (-1) + +/* The implementation supports the X/Open Encryption Feature Group. */ +/* FIXME: please change this when encryption is ready */ +#define _XOPEN_CRYPT (-1) + +/* The implementation supports the Issue 4, Version 2 Enhanced + Internationalisation Feature Group. This is always set to a value + other than -1. */ /* TODO: high priority. Support for this feature is + needed for a conforming implementation */ +#define _XOPEN_ENH_I18N (-1) + +/* The implementation supports the Legacy Feature Group. */ +#define _XOPEN_LEGACY (1) + +/* The implementation supports the X/Open Realtime Feature Group. */ +/* FIXME? unlikely to be ever supported */ +#define _XOPEN_REALTIME (-1) + +/* The implementation supports the X/Open Realtime Threads Feature + Group. */ /* FIXME? really unlikely to be ever supported */ +#define _XOPEN_REALTIME_THREADS (-1) + +/* The implementation supports the Issue 4, Version 2 Shared Memory + Feature Group. This is always set to a value other than -1. */ /* TODO: + high priority. Support for this feature is needed for a conforming + implementation */ +#define _XOPEN_SHM (-1) + +/* Implementation provides a C-language compilation environment with + 32-bit int, long, pointer and off_t types. */ +#define _XBS5_ILP32_OFF32 (1) + +/* Implementation provides a C-language compilation environment with + 32-bit int, long and pointer types and an off_t type using at + least 64 bits. */ /* FIXME? check the off_t type */ +#define _XBS5_ILP32_OFFBIG (1) + +/* Implementation provides a C-language compilation environment with + 32-bit int and 64-bit long, pointer and off_t types. */ /* FIXME: on + some architectures this may be true */ +#define _XBS5_LP64_OFF64 (-1) + +/* Implementation provides a C-language compilation environment with + an int type using at least 32 bits and long, pointer and off_t + types using at least 64 bits. */ /* FIXME: on some architectures + this may be true */ +#define _XBS5_LPBIG_OFFBIG (-1) + +/* Implementation supports the File Synchronisation option. */ +/* TODO: high priority. Implement this */ +#define _POSIX_FSYNC + +/* Implementation supports the Memory Mapped Files option. */ +/* TODO: high priority. Implement this */ +#define _POSIX_MAPPED_FILES + +/* Implementation supports the Memory Protection option. */ +/* TODO: high priority. Implement this */ +#define _POSIX_MEMORY_PROTECTION + +#if 0 +/* Implementation supports the Prioritized Input and Output option. */ +/* FIXME? unlikely to be ever supported */ +#define _POSIX_PRIORITIZED_IO +#endif + +/* FIXME: these should be implemented */ +/* Asynchronous input or output operations may be performed for the + associated file. */ +#define _POSIX_ASYNC_IO (-1) + +/* Prioritized input or output operations may be performed for the + associated file. */ +#define _POSIX_PRIO_IO (-1) + +/* Synchronised input or output operations may be performed for the + associated file. */ +#define _POSIX_SYNC_IO (-1) + +/* + null pointer + */ +#ifndef NULL +/* NULL seems to be defined pretty much everywhere - we prevent + redefinition */ +#define NULL ((void *)(0)) +#endif + +/* + 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) + +/* + constants for the confstr() function + */ +#define _CS_PATH (1) +#define _CS_XBS5_ILP32_OFF32_CFLAGS (2) +#define _CS_XBS5_ILP32_OFF32_LDFLAGS (3) +#define _CS_XBS5_ILP32_OFF32_LIBS (4) +#define _CS_XBS5_ILP32_OFF32_LINTFLAGS (5) +#define _CS_XBS5_ILP32_OFFBIG_CFLAGS (6) +#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS (7) +#define _CS_XBS5_ILP32_OFFBIG_LIBS (8) +#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS (9) +#define _CS_XBS5_LP64_OFF64_CFLAGS (10) +#define _CS_XBS5_LP64_OFF64_LDFLAGS (11) +#define _CS_XBS5_LP64_OFF64_LIBS (12) +#define _CS_XBS5_LP64_OFF64_LINTFLAGS (13) +#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS (14) +#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS (15) +#define _CS_XBS5_LPBIG_OFFBIG_LIBS (16) +#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS (17) + +/* + 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. */ + +/* + 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) + +#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) + +/* PROTOTYPES */ +int access(const char *, int); +unsigned int alarm(unsigned int); +int brk(void *); +int chdir(const char *); +int chroot(const char *); /* (LEGACY) */ +int chown(const char *, uid_t, gid_t); +int close(int); +size_t confstr(int, char *, size_t); +char *crypt(const char *, const char *); +char *ctermid(char *); +char *cuserid(char *s); /* (LEGACY) */ +int dup(int); +int dup2(int, int); +void encrypt(char[64], int); +int execl(const char *, const char *, ...); +int execle(const char *, const char *, ...); +int execlp(const char *, const char *, ...); +int execv(const char *, char *const []); +int execve(const char *, char *const [], char *const []); +int execvp(const char *, char *const []); +void _exit(int); +int fchown(int, uid_t, gid_t); +int fchdir(int); +int fdatasync(int); +pid_t fork(void); +long int fpathconf(int, int); +int fsync(int); +int ftruncate(int, off_t); +char *getcwd(char *, size_t); +int getdtablesize(void); /* (LEGACY) */ +gid_t getegid(void); +uid_t geteuid(void); +gid_t getgid(void); +int getgroups(int, gid_t []); +long gethostid(void); +char *getlogin(void); +int getlogin_r(char *, size_t); +int getopt(int, char * const [], const char *); +int getpagesize(void); /* (LEGACY) */ +char *getpass(const char *); /* (LEGACY) */ +pid_t getpgid(pid_t); +pid_t getpgrp(void); +pid_t getpid(void); +pid_t getppid(void); +pid_t getsid(pid_t); +uid_t getuid(void); +char *getwd(char *); +int isatty(int); +int lchown(const char *, uid_t, gid_t); +int link(const char *, const char *); +int lockf(int, int, off_t); +off_t lseek(int, off_t, int); +int nice(int); +long int pathconf(const char *, int); +int pause(void); +int pipe(int [2]); +ssize_t pread(int, void *, size_t, off_t); +int pthread_atfork(void (*)(void), void (*)(void), + void(*)(void)); +ssize_t pwrite(int, const void *, size_t, off_t); +ssize_t read(int, void *, size_t); +int readlink(const char *, char *, size_t); +int rmdir(const char *); +void *sbrk(intptr_t); +int setgid(gid_t); +int setpgid(pid_t, pid_t); +pid_t setpgrp(void); +int setregid(gid_t, gid_t); +int setreuid(uid_t, uid_t); +pid_t setsid(void); +int setuid(uid_t); +unsigned int sleep(unsigned int); +void swab(const void *, void *, ssize_t); +int symlink(const char *, const char *); +void sync(void); +long int sysconf(int); +pid_t tcgetpgrp(int); +int tcsetpgrp(int, pid_t); +int truncate(const char *, off_t); +char *ttyname(int); +int ttyname_r(int, char *, size_t); +useconds_t ualarm(useconds_t, useconds_t); +int unlink(const char *); +int usleep(useconds_t); +pid_t vfork(void); +ssize_t write(int, const void *, size_t); + +/* MACROS */ + +#endif /* __UNISTD_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/utime.h b/posix/include/utime.h new file mode 100644 index 00000000000..1b5e65b229c --- /dev/null +++ b/posix/include/utime.h @@ -0,0 +1,48 @@ +/* + * utime.h + * + * access and modification times structure. Based on the Single UNIX(r) + * Specification, Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __UTIME_H_INCLUDED__ +#define __UTIME_H_INCLUDED__ + +/* INCLUDES */ +#include + +/* OBJECTS */ + +/* TYPES */ +struct utimbuf +{ + time_t actime; /* access time */ + time_t modtime; /* modification time */ +}; + +/* CONSTANTS */ + +/* PROTOTYPES */ +int utime(const char *, const struct utimbuf *); + +/* MACROS */ + +#endif /* __UTIME_H_INCLUDED__ */ + +/* EOF */ + diff --git a/posix/include/wchar.h b/posix/include/wchar.h new file mode 100644 index 00000000000..2facb02efdc --- /dev/null +++ b/posix/include/wchar.h @@ -0,0 +1,137 @@ +/* + * wchar.h + * + * wide-character types. Based on the Single UNIX(r) Specification, + * Version 2 + * + * This file is part of the ReactOS Operating System. + * + * Contributors: + * Created by KJK::Hyperion + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#ifndef __WCHAR_H_INCLUDED__ +#define __WCHAR_H_INCLUDED__ + +/* INCLUDES */ +#include +#include +#include +#include +#include +#include + +/* OBJECTS */ + +/* TYPES */ +typedef wchar_t wint_t; /* An integral type capable of storing any valid + value of wchar_t, or WEOF */ +typedef long int wctype_t; /* A scalar type of a data object that can hold + values which represent locale-specific + character classification. */ +typedef void * mbstate_t; /* An object type other than an array type that + can hold the conversion state information + necessary to convert between sequences of + (possibly multibyte) characters and + wide-characters */ + +/* CONSTANTS */ + +/* PROTOTYPES */ +wint_t btowc(int); +int fwprintf(FILE *, const wchar_t *, ...); +int fwscanf(FILE *, const wchar_t *, ...); +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswcntrl(wint_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +int iswctype(wint_t, wctype_t); +wint_t fgetwc(FILE *); +wchar_t *fgetws(wchar_t *, int, FILE *); +wint_t fputwc(wchar_t, FILE *); +int fputws(const wchar_t *, FILE *); +int fwide(FILE *, int); +wint_t getwc(FILE *); +wint_t getwchar(void); +int mbsinit(const mbstate_t *); +size_t mbrlen(const char *, size_t, mbstate_t *); +size_t mbrtowc(wchar_t *, const char *, size_t, + mbstate_t *); +size_t mbsrtowcs(wchar_t *, const char **, size_t, + mbstate_t *); +wint_t putwc(wchar_t, FILE *); +wint_t putwchar(wchar_t); +int swprintf(wchar_t *, size_t, const wchar_t *, ...); +int swscanf(const wchar_t *, const wchar_t *, ...); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +wint_t ungetwc(wint_t, FILE *); +int vfwprintf(FILE *, const wchar_t *, va_list); +int vwprintf(const wchar_t *, va_list); +int vswprintf(wchar_t *, size_t, const wchar_t *, + va_list); +size_t wcrtomb(char *, wchar_t, mbstate_t *); +wchar_t *wcscat(wchar_t *, const wchar_t *); +wchar_t *wcschr(const wchar_t *, wchar_t); +int wcscmp(const wchar_t *, const wchar_t *); +int wcscoll(const wchar_t *, const wchar_t *); +wchar_t *wcscpy(wchar_t *, const wchar_t *); +size_t wcscspn(const wchar_t *, const wchar_t *); +size_t wcsftime(wchar_t *, size_t, const wchar_t *, + const struct tm *); +size_t wcslen(const wchar_t *); +wchar_t *wcsncat(wchar_t *, const wchar_t *, size_t); +int wcsncmp(const wchar_t *, const wchar_t *, size_t); +wchar_t *wcsncpy(wchar_t *, const wchar_t *, size_t); +wchar_t *wcspbrk(const wchar_t *, const wchar_t *); +wchar_t *wcsrchr(const wchar_t *, wchar_t); +size_t wcsrtombs(char *, const wchar_t **, size_t, + mbstate_t *); +size_t wcsspn(const wchar_t *, const wchar_t *); +wchar_t *wcsstr(const wchar_t *, const wchar_t *); +double wcstod(const wchar_t *, wchar_t **); +wchar_t *wcstok(wchar_t *, const wchar_t *, wchar_t **); +long int wcstol(const wchar_t *, wchar_t **, int); +unsigned long int wcstoul(const wchar_t *, wchar_t **, int); +wchar_t *wcswcs(const wchar_t *, const wchar_t *); +int wcswidth(const wchar_t *, size_t); +size_t wcsxfrm(wchar_t *, const wchar_t *, size_t); +int wctob(wint_t); +wctype_t wctype(const char *); +int wcwidth(wchar_t); +wchar_t *wmemchr(const wchar_t *, wchar_t, size_t); +int wmemcmp(const wchar_t *, const wchar_t *, size_t); +wchar_t *wmemcpy(wchar_t *, const wchar_t *, size_t); +wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); +wchar_t *wmemset(wchar_t *, wchar_t, size_t); +int wprintf(const wchar_t *, ...); +int wscanf(const wchar_t *, ...); + +/* MACROS */ +#define WCHAR_MAX (0xFFFF) +#define WCHAR_MIN (0x0000) + +/* FIXME? */ +#define WEOF (0xFFFF) + +#endif /* __WCHAR_H_INCLUDED__ */ + +/* EOF */ +