diff --git a/include/errno.h b/include/errno.h index 7bd2284b9..4762f3d4e 100755 --- a/include/errno.h +++ b/include/errno.h @@ -73,6 +73,7 @@ extern int errno; /* place where the error numbers go */ #define ENOLCK (_SIGN 37) /* no locks available */ #define ENOSYS (_SIGN 38) /* function not implemented */ #define ENOTEMPTY (_SIGN 39) /* directory not empty */ +#define ELOOP (_SIGN 40) /* too many levels of symlinks detected */ /* The following errors relate to networking. */ #define EPACKSIZE (_SIGN 50) /* invalid packet size for some protocol */ diff --git a/include/fcntl.h b/include/fcntl.h index 78d511beb..2aa7cce69 100755 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -64,4 +64,12 @@ _PROTOTYPE( int creat, (const char *_path, _mnx_Mode_t _mode) ); _PROTOTYPE( int fcntl, (int _filedes, int _cmd, ...) ); _PROTOTYPE( int open, (const char *_path, int _oflag, ...) ); +/* For locking files. */ +#define LOCK_SH F_RDLCK /* Shared lock */ +#define LOCK_EX F_WRLCK /* Exclusive lock */ +#define LOCK_NB 0x0080 /* Do not block when locking */ +#define LOCK_UN F_UNLCK /* Unlock */ + +_PROTOTYPE( int flock, (int fd, int mode) ); + #endif /* _FCNTL_H */ diff --git a/include/minix/callnr.h b/include/minix/callnr.h index c8af59c2e..cb9891b69 100755 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -39,9 +39,12 @@ #define DUP 41 #define PIPE 42 #define TIMES 43 +#define SYMLINK 45 #define SETGID 46 #define GETGID 47 #define SIGNAL 48 +#define RDLNK 49 +#define LSTAT 50 #define IOCTL 54 #define FCNTL 55 #define EXEC 59 diff --git a/include/minix/const.h b/include/minix/const.h index 3814621a3..6c9e1792a 100755 --- a/include/minix/const.h +++ b/include/minix/const.h @@ -96,6 +96,7 @@ /* Flag bits for i_mode in the inode. */ #define I_TYPE 0170000 /* this field gives inode type */ +#define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */ #define I_REGULAR 0100000 /* regular file, not dir or special */ #define I_BLOCK_SPECIAL 0060000 /* block special file */ #define I_DIRECTORY 0040000 /* file is a directory */ @@ -119,6 +120,8 @@ #define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */ #define MAX_FILE_POS ((off_t) 037777777777) /* largest legal file offset */ +#define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */ + #define NO_BLOCK ((block_t) 0) /* absence of a block number */ #define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */ #define NO_ZONE ((zone_t) 0) /* absence of a zone number */ diff --git a/include/sys/stat.h b/include/sys/stat.h index f586e459f..b08df5020 100755 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -29,14 +29,14 @@ struct stat { * extensions such as S_IFREG != (mode_t) S_IFREG when ints are 32 bits. */ #define S_IFMT ((mode_t) 0170000) /* type of file */ -#define S_IFLNK ((mode_t) 0120000) /* symbolic link, not implemented */ +#define S_IFLNK ((mode_t) 0120000) /* symbolic link */ #define S_IFREG ((mode_t) 0100000) /* regular */ -#define S_IFBLK 0060000 /* block special */ -#define S_IFDIR 0040000 /* directory */ -#define S_IFCHR 0020000 /* character special */ -#define S_IFIFO 0010000 /* this is a FIFO */ -#define S_ISUID 0004000 /* set user id on execution */ -#define S_ISGID 0002000 /* set group id on execution */ +#define S_IFBLK ((mode_t) 0060000) /* block special */ +#define S_IFDIR ((mode_t) 0040000) /* directory */ +#define S_IFCHR ((mode_t) 0020000) /* character special */ +#define S_IFIFO ((mode_t) 0010000) /* this is a FIFO */ +#define S_ISUID ((mode_t) 0004000) /* set user id on execution */ +#define S_ISGID ((mode_t) 0002000) /* set group id on execution */ /* next is reserved for future use */ #define S_ISVTX 01000 /* save swapped text even after use */ @@ -61,6 +61,7 @@ struct stat { #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* is a directory */ #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* is a char spec */ #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* is a block spec */ +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* is a symlink */ #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* is a pipe/FIFO */ #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* is a sym link */ diff --git a/include/unistd.h b/include/unistd.h index 629ab534c..f05e94add 100755 --- a/include/unistd.h +++ b/include/unistd.h @@ -182,8 +182,4 @@ _PROTOTYPE( int setgroups, (int ngroups, const gid_t *gidset) ); #endif -_PROTOTYPE( int readlink, (const char *, char *, int)); -_PROTOTYPE( int getopt, (int, char **, char *)); -extern int optind, opterr, optopt; - #endif /* _UNISTD_H */