2005-04-21 16:53:53 +02:00
|
|
|
/* The <unistd.h> header contains a few miscellaneous manifest constants. */
|
|
|
|
|
|
|
|
#ifndef _UNISTD_H
|
|
|
|
#define _UNISTD_H
|
|
|
|
|
|
|
|
#ifndef _TYPES_H
|
2009-11-06 09:46:22 +01:00
|
|
|
#include <minix/types.h>
|
2005-04-21 16:53:53 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Values used by access(). POSIX Table 2-8. */
|
|
|
|
#define F_OK 0 /* test if file exists */
|
|
|
|
#define X_OK 1 /* test if file is executable */
|
|
|
|
#define W_OK 2 /* test if file is writable */
|
|
|
|
#define R_OK 4 /* test if file is readable */
|
|
|
|
|
|
|
|
/* Values used for whence in lseek(fd, offset, whence). POSIX Table 2-9. */
|
|
|
|
#define SEEK_SET 0 /* offset is absolute */
|
|
|
|
#define SEEK_CUR 1 /* offset is relative to current position */
|
|
|
|
#define SEEK_END 2 /* offset is relative to end of file */
|
|
|
|
|
|
|
|
/* This value is required by POSIX Table 2-10. */
|
|
|
|
#define _POSIX_VERSION 199009L /* which standard is being conformed to */
|
|
|
|
|
|
|
|
/* These three definitions are required by POSIX Sec. 8.2.1.2. */
|
|
|
|
#define STDIN_FILENO 0 /* file descriptor for stdin */
|
|
|
|
#define STDOUT_FILENO 1 /* file descriptor for stdout */
|
|
|
|
#define STDERR_FILENO 2 /* file descriptor for stderr */
|
|
|
|
|
|
|
|
#ifdef _MINIX
|
|
|
|
/* How to exit the system or stop a server process. */
|
2006-03-10 17:10:05 +01:00
|
|
|
#define RBT_HALT 0 /* shutdown and return to monitor */
|
|
|
|
#define RBT_REBOOT 1 /* reboot the system through the monitor */
|
2005-04-21 16:53:53 +02:00
|
|
|
#define RBT_PANIC 2 /* a server panics */
|
|
|
|
#define RBT_MONITOR 3 /* let the monitor do this */
|
|
|
|
#define RBT_RESET 4 /* hard reset the system */
|
2006-03-10 17:10:05 +01:00
|
|
|
#define RBT_INVALID 5 /* first invalid reboot flag */
|
|
|
|
|
2006-03-03 10:43:06 +01:00
|
|
|
#define _PM_SEG_FLAG (1L << 30) /* for read() and write() to FS by PM */
|
2005-04-21 16:53:53 +02:00
|
|
|
#endif
|
|
|
|
|
2005-06-06 15:51:50 +02:00
|
|
|
/* What system info to retrieve with sysgetinfo(). */
|
2005-09-16 16:23:14 +02:00
|
|
|
#define SI_KINFO 0 /* get kernel info via PM */
|
|
|
|
#define SI_PROC_ADDR 1 /* address of process table */
|
|
|
|
#define SI_PROC_TAB 2 /* copy of entire process table */
|
|
|
|
#define SI_DMAP_TAB 3 /* get device <-> driver mappings */
|
2005-10-13 14:45:31 +02:00
|
|
|
#define SI_MEM_ALLOC 4 /* get memory allocation data */
|
2010-01-14 16:24:16 +01:00
|
|
|
#define SI_DATA_STORE 5 /* get copy of data store mappings */
|
|
|
|
#define SI_SUBSCRIPTION 6 /* get copy of data store subscriptions */
|
|
|
|
#define SI_LOADINFO 7 /* get copy of load average structure */
|
|
|
|
#define SI_KPROC_TAB 8 /* copy of kernel process table */
|
|
|
|
#define SI_CALL_STATS 9 /* system call statistics */
|
|
|
|
#define SI_PCI_INFO 10 /* get kernel info via PM */
|
|
|
|
#define SI_PROCPUB_TAB 11 /* copy of public entries of process table */
|
2005-06-06 15:51:50 +02:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/* NULL must be defined in <unistd.h> according to POSIX Sec. 2.7.1. */
|
|
|
|
#define NULL ((void *)0)
|
|
|
|
|
|
|
|
/* The following relate to configurable system variables. POSIX Table 4-2. */
|
2005-09-16 16:23:14 +02:00
|
|
|
#define _SC_ARG_MAX 1
|
|
|
|
#define _SC_CHILD_MAX 2
|
|
|
|
#define _SC_CLOCKS_PER_SEC 3
|
|
|
|
#define _SC_CLK_TCK 3
|
|
|
|
#define _SC_NGROUPS_MAX 4
|
|
|
|
#define _SC_OPEN_MAX 5
|
|
|
|
#define _SC_JOB_CONTROL 6
|
|
|
|
#define _SC_SAVED_IDS 7
|
|
|
|
#define _SC_VERSION 8
|
|
|
|
#define _SC_STREAM_MAX 9
|
|
|
|
#define _SC_TZNAME_MAX 10
|
2006-03-23 12:05:15 +01:00
|
|
|
#define _SC_PAGESIZE 11
|
|
|
|
#define _SC_PAGE_SIZE _SC_PAGESIZE
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
/* The following relate to configurable pathname variables. POSIX Table 5-2. */
|
2005-09-16 16:23:14 +02:00
|
|
|
#define _PC_LINK_MAX 1 /* link count */
|
|
|
|
#define _PC_MAX_CANON 2 /* size of the canonical input queue */
|
|
|
|
#define _PC_MAX_INPUT 3 /* type-ahead buffer size */
|
|
|
|
#define _PC_NAME_MAX 4 /* file name size */
|
|
|
|
#define _PC_PATH_MAX 5 /* pathname size */
|
|
|
|
#define _PC_PIPE_BUF 6 /* pipe size */
|
|
|
|
#define _PC_NO_TRUNC 7 /* treatment of long name components */
|
|
|
|
#define _PC_VDISABLE 8 /* tty disable */
|
|
|
|
#define _PC_CHOWN_RESTRICTED 9 /* chown restricted or not */
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
/* POSIX defines several options that may be implemented or not, at the
|
|
|
|
* implementer's whim. This implementer has made the following choices:
|
|
|
|
*
|
|
|
|
* _POSIX_JOB_CONTROL not defined: no job control
|
|
|
|
* _POSIX_SAVED_IDS not defined: no saved uid/gid
|
|
|
|
* _POSIX_NO_TRUNC defined as -1: long path names are truncated
|
|
|
|
* _POSIX_CHOWN_RESTRICTED defined: you can't give away files
|
|
|
|
* _POSIX_VDISABLE defined: tty functions can be disabled
|
|
|
|
*/
|
|
|
|
#define _POSIX_NO_TRUNC (-1)
|
|
|
|
#define _POSIX_CHOWN_RESTRICTED 1
|
|
|
|
|
|
|
|
/* Function Prototypes. */
|
|
|
|
_PROTOTYPE( void _exit, (int _status) );
|
|
|
|
_PROTOTYPE( int access, (const char *_path, int _amode) );
|
|
|
|
_PROTOTYPE( unsigned int alarm, (unsigned int _seconds) );
|
|
|
|
_PROTOTYPE( int chdir, (const char *_path) );
|
2005-06-29 21:28:26 +02:00
|
|
|
_PROTOTYPE( int fchdir, (int fd) );
|
2010-04-13 12:58:41 +02:00
|
|
|
_PROTOTYPE( int chown, (const char *_path, uid_t _owner, gid_t _group) );
|
|
|
|
_PROTOTYPE( int fchown, (int fd, uid_t _owner, gid_t _group) );
|
2005-04-21 16:53:53 +02:00
|
|
|
_PROTOTYPE( int close, (int _fd) );
|
|
|
|
_PROTOTYPE( char *ctermid, (char *_s) );
|
|
|
|
_PROTOTYPE( char *cuserid, (char *_s) );
|
|
|
|
_PROTOTYPE( int dup, (int _fd) );
|
|
|
|
_PROTOTYPE( int dup2, (int _fd, int _fd2) );
|
|
|
|
_PROTOTYPE( int execl, (const char *_path, const char *_arg, ...) );
|
|
|
|
_PROTOTYPE( int execle, (const char *_path, const char *_arg, ...) );
|
|
|
|
_PROTOTYPE( int execlp, (const char *_file, const char *arg, ...) );
|
|
|
|
_PROTOTYPE( int execv, (const char *_path, char *const _argv[]) );
|
|
|
|
_PROTOTYPE( int execve, (const char *_path, char *const _argv[],
|
|
|
|
char *const _envp[]) );
|
|
|
|
_PROTOTYPE( int execvp, (const char *_file, char *const _argv[]) );
|
|
|
|
_PROTOTYPE( pid_t fork, (void) );
|
|
|
|
_PROTOTYPE( long fpathconf, (int _fd, int _name) );
|
|
|
|
_PROTOTYPE( char *getcwd, (char *_buf, size_t _size) );
|
|
|
|
_PROTOTYPE( gid_t getegid, (void) );
|
|
|
|
_PROTOTYPE( uid_t geteuid, (void) );
|
|
|
|
_PROTOTYPE( gid_t getgid, (void) );
|
|
|
|
_PROTOTYPE( int getgroups, (int _gidsetsize, gid_t _grouplist[]) );
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
_PROTOTYPE( int setgroups, (int _ngroups, gid_t const *grps) );
|
2005-04-21 16:53:53 +02:00
|
|
|
_PROTOTYPE( char *getlogin, (void) );
|
|
|
|
_PROTOTYPE( pid_t getpgrp, (void) );
|
|
|
|
_PROTOTYPE( pid_t getpid, (void) );
|
|
|
|
_PROTOTYPE( pid_t getppid, (void) );
|
|
|
|
_PROTOTYPE( uid_t getuid, (void) );
|
|
|
|
_PROTOTYPE( int isatty, (int _fd) );
|
|
|
|
_PROTOTYPE( int link, (const char *_existing, const char *_new) );
|
|
|
|
_PROTOTYPE( off_t lseek, (int _fd, off_t _offset, int _whence) );
|
|
|
|
_PROTOTYPE( long pathconf, (const char *_path, int _name) );
|
|
|
|
_PROTOTYPE( int pause, (void) );
|
|
|
|
_PROTOTYPE( int pipe, (int _fildes[2]) );
|
|
|
|
_PROTOTYPE( ssize_t read, (int _fd, void *_buf, size_t _n) );
|
2010-02-25 18:08:08 +01:00
|
|
|
_PROTOTYPE( ssize_t pread, (int, void *, size_t, off_t) );
|
2005-04-21 16:53:53 +02:00
|
|
|
_PROTOTYPE( int rmdir, (const char *_path) );
|
2010-04-13 12:58:41 +02:00
|
|
|
_PROTOTYPE( int setgid, (gid_t _gid) );
|
|
|
|
_PROTOTYPE( int setegid, (gid_t _gid) );
|
2005-04-21 16:53:53 +02:00
|
|
|
_PROTOTYPE( pid_t setsid, (void) );
|
2010-04-13 12:58:41 +02:00
|
|
|
_PROTOTYPE( int setuid, (uid_t _uid) );
|
|
|
|
_PROTOTYPE( int seteuid, (uid_t _uid) );
|
2005-04-21 16:53:53 +02:00
|
|
|
_PROTOTYPE( unsigned int sleep, (unsigned int _seconds) );
|
|
|
|
_PROTOTYPE( long sysconf, (int _name) );
|
|
|
|
_PROTOTYPE( pid_t tcgetpgrp, (int _fd) );
|
|
|
|
_PROTOTYPE( int tcsetpgrp, (int _fd, pid_t _pgrp_id) );
|
|
|
|
_PROTOTYPE( char *ttyname, (int _fd) );
|
|
|
|
_PROTOTYPE( int unlink, (const char *_path) );
|
|
|
|
_PROTOTYPE( ssize_t write, (int _fd, const void *_buf, size_t _n) );
|
2006-01-19 16:33:13 +01:00
|
|
|
_PROTOTYPE( int truncate, (const char *_path, off_t _length) );
|
|
|
|
_PROTOTYPE( int ftruncate, (int _fd, off_t _length) );
|
2006-10-20 16:10:53 +02:00
|
|
|
_PROTOTYPE( int nice, (int _incr) );
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2005-06-10 17:12:03 +02:00
|
|
|
/* Open Group Base Specifications Issue 6 (not complete) */
|
|
|
|
_PROTOTYPE( int symlink, (const char *path1, const char *path2) );
|
2006-01-17 12:24:48 +01:00
|
|
|
_PROTOTYPE( int readlink, (const char *, char *, size_t) );
|
2006-03-24 15:03:25 +01:00
|
|
|
_PROTOTYPE( int getopt, (int _argc, char * const _argv[], char const *_opts) );
|
2005-07-11 15:00:43 +02:00
|
|
|
extern char *optarg;
|
|
|
|
extern int optind, opterr, optopt;
|
|
|
|
_PROTOTYPE( int usleep, (useconds_t _useconds) );
|
2005-06-10 17:12:03 +02:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
#ifdef _MINIX
|
2005-06-03 15:55:06 +02:00
|
|
|
#ifndef _TYPE_H
|
|
|
|
#include <minix/type.h>
|
|
|
|
#endif
|
2006-06-07 16:36:35 +02:00
|
|
|
|
|
|
|
extern int optreset; /* Reset getopt state */
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
_PROTOTYPE( int brk, (char *_addr) );
|
|
|
|
_PROTOTYPE( int chroot, (const char *_name) );
|
2006-12-06 16:21:27 +01:00
|
|
|
_PROTOTYPE( int lseek64, (int _fd, u64_t _offset, int _whence,
|
|
|
|
u64_t *_newpos) );
|
2010-04-13 12:58:41 +02:00
|
|
|
_PROTOTYPE( int mknod, (const char *_name, mode_t _mode, dev_t _addr) );
|
|
|
|
_PROTOTYPE( int mknod4, (const char *_name, mode_t _mode, dev_t _addr,
|
2005-04-21 16:53:53 +02:00
|
|
|
long _size) );
|
|
|
|
_PROTOTYPE( char *mktemp, (char *_template) );
|
|
|
|
_PROTOTYPE( long ptrace, (int _req, pid_t _pid, long _addr, long _data) );
|
|
|
|
_PROTOTYPE( char *sbrk, (int _incr) );
|
|
|
|
_PROTOTYPE( int sync, (void) );
|
2005-09-21 12:57:21 +02:00
|
|
|
_PROTOTYPE( int fsync, (int fd) );
|
2005-04-21 16:53:53 +02:00
|
|
|
_PROTOTYPE( int reboot, (int _how, ...) );
|
|
|
|
_PROTOTYPE( int gethostname, (char *_hostname, size_t _len) );
|
|
|
|
_PROTOTYPE( int getdomainname, (char *_domain, size_t _len) );
|
|
|
|
_PROTOTYPE( int ttyslot, (void) );
|
|
|
|
_PROTOTYPE( int fttyslot, (int _fd) );
|
|
|
|
_PROTOTYPE( char *crypt, (const char *_key, const char *_salt) );
|
2010-01-05 20:39:27 +01:00
|
|
|
_PROTOTYPE( int getsysinfo, (endpoint_t who, int what, void *where) );
|
2006-03-10 17:10:05 +01:00
|
|
|
_PROTOTYPE( int getsigset, (sigset_t *sigset) );
|
2005-09-16 16:23:14 +02:00
|
|
|
_PROTOTYPE( int getprocnr, (void) );
|
2005-10-12 17:08:45 +02:00
|
|
|
_PROTOTYPE( int getnprocnr, (pid_t pid) );
|
|
|
|
_PROTOTYPE( int getpprocnr, (void) );
|
2006-03-25 05:49:04 +01:00
|
|
|
_PROTOTYPE( int _pm_findproc, (char *proc_name, int *proc_nr) );
|
2010-01-05 20:39:27 +01:00
|
|
|
_PROTOTYPE( int mapdriver, (char *label, int major, int style,
|
2010-04-09 23:56:44 +02:00
|
|
|
int flags) );
|
2008-02-21 16:58:55 +01:00
|
|
|
_PROTOTYPE(int adddma, (endpoint_t proc_e,
|
|
|
|
phys_bytes start, phys_bytes size) );
|
|
|
|
_PROTOTYPE(int deldma, (endpoint_t proc_e,
|
|
|
|
phys_bytes start, phys_bytes size) );
|
|
|
|
_PROTOTYPE(int getdma, (endpoint_t *procp, phys_bytes *basep,
|
|
|
|
phys_bytes *sizep) );
|
2005-06-10 17:12:03 +02:00
|
|
|
|
2009-10-31 15:09:28 +01:00
|
|
|
_PROTOTYPE( pid_t getnpid, (endpoint_t proc_ep) );
|
|
|
|
_PROTOTYPE( uid_t getnuid, (endpoint_t proc_ep) );
|
|
|
|
_PROTOTYPE( gid_t getngid, (endpoint_t proc_ep) );
|
|
|
|
|
2005-06-10 17:12:03 +02:00
|
|
|
/* For compatibility with other Unix systems */
|
|
|
|
_PROTOTYPE( int getpagesize, (void) );
|
|
|
|
_PROTOTYPE( int setgroups, (int ngroups, const gid_t *gidset) );
|
2006-02-13 16:00:49 +01:00
|
|
|
_PROTOTYPE( int initgroups, (const char *name, gid_t basegid) );
|
2010-06-09 14:53:09 +02:00
|
|
|
_PROTOTYPE( void *setmode, (const char *) );
|
|
|
|
_PROTOTYPE( mode_t getmode, (const void *, mode_t) );
|
|
|
|
_PROTOTYPE( void strmode, (mode_t, char *) );
|
2005-06-10 17:12:03 +02:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
#endif
|
|
|
|
|
2009-12-07 20:56:40 +01:00
|
|
|
#ifdef _POSIX_SOURCE
|
|
|
|
_PROTOTYPE( int getdtablesize, (void) );
|
|
|
|
#endif
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
#endif /* _UNISTD_H */
|