#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 */
_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 */
#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
/* 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 */
#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 */
* 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 */
#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 */
#endif
-_PROTOTYPE( int readlink, (const char *, char *, int));
-_PROTOTYPE( int getopt, (int, char **, char *));
-extern int optind, opterr, optopt;
-
#endif /* _UNISTD_H */