diff --git a/headers/posix/unistd.h b/headers/posix/unistd.h index ea43538c92..15333ea6db 100644 --- a/headers/posix/unistd.h +++ b/headers/posix/unistd.h @@ -39,6 +39,7 @@ #define _POSIX_THREADS (200112L) /* pathconf() constants */ +/* BeOS supported values, do not touch */ #define _PC_CHOWN_RESTRICTED 1 #define _PC_MAX_CANON 2 #define _PC_MAX_INPUT 3 @@ -48,8 +49,25 @@ #define _PC_PIPE_BUF 7 #define _PC_VDISABLE 8 #define _PC_LINK_MAX 25 +/* new values */ +/* TODO: reorder */ +#define _PC_SYNC_IO 26 +#define _PC_ASYNC_IO 27 +#define _PC_PRIO_IO 28 +#define _PC_SOCK_MAXBUF 29 +#define _PC_FILESIZEBITS 30 +#define _PC_REC_INCR_XFER_SIZE 31 +#define _PC_REC_MAX_XFER_SIZE 32 +#define _PC_REC_MIN_XFER_SIZE 33 +#define _PC_REC_XFER_ALIGN 34 +#define _PC_ALLOC_SIZE_MIN 35 +#define _PC_SYMLINK_MAX 36 +#define _PC_2_SYMLINKS 37 +#define _PC_XATTR_EXISTS 38 +#define _PC_XATTR_ENABLED 39 /* sysconf() constants */ +/* BeOS supported values, do not touch */ #define _SC_ARG_MAX 15 #define _SC_CHILD_MAX 16 #define _SC_CLK_TCK 17 diff --git a/src/system/libroot/posix/unistd/conf.c b/src/system/libroot/posix/unistd/conf.c index fccf5dd6c7..fc9a05640e 100644 --- a/src/system/libroot/posix/unistd/conf.c +++ b/src/system/libroot/posix/unistd/conf.c @@ -80,6 +80,11 @@ sysconf(int name) long fpathconf(int fd, int name) { + if (fd < 0) { + errno = EBADF; + return -1; + } + // TODO: should query the underlying filesystem // for correct value, as most are fs-dependant // (which is why it's a different call than sysconf() btw). @@ -111,6 +116,32 @@ fpathconf(int fd, int name) case _PC_VDISABLE: return _POSIX_VDISABLE; + case _PC_FILESIZEBITS: + return 64; + + case _PC_XATTR_EXISTS: + case _PC_XATTR_ENABLED: + /* those seem to be Solaris specific, + * else we should return 1 I suppose. + */ + errno = EINVAL; + return -1; + + case _PC_SYNC_IO: + case _PC_ASYNC_IO: + case _PC_PRIO_IO: + case _PC_SOCK_MAXBUF: + case _PC_REC_INCR_XFER_SIZE: + case _PC_REC_MAX_XFER_SIZE: + case _PC_REC_MIN_XFER_SIZE: + case _PC_REC_XFER_ALIGN: + case _PC_ALLOC_SIZE_MIN: + case _PC_SYMLINK_MAX: + case _PC_2_SYMLINKS: + /* not yet supported */ + errno = EINVAL; + return -1; + } errno = EINVAL;