diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2016-02-25 19:58:23 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2016-02-25 19:58:23 +0000 |
| commit | 0acf5d0bfdfe43ad4e4f950a01b4648e72c08a42 (patch) | |
| tree | b010a81a603d2e4723b6c282351b854c13946c40 /sys/kern | |
| parent | d173587f9a5a67e0de9708dba043d021758d26b4 (diff) | |
Notes
Diffstat (limited to 'sys/kern')
| -rw-r--r-- | sys/kern/sys_generic.c | 16 | ||||
| -rw-r--r-- | sys/kern/vfs_syscalls.c | 13 |
2 files changed, 23 insertions, 6 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 55ae6500017c9..fe79f52929be5 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1910,3 +1910,19 @@ selectinit(void *dummy __unused) NULL, NULL, UMA_ALIGN_PTR, 0); mtxpool_select = mtx_pool_create("select mtxpool", 128, MTX_DEF); } + +/* + * Set up a syscall return value that follows the convention specified for + * posix_* functions. + */ +int +kern_posix_error(struct thread *td, int error) +{ + + if (error <= 0) + return (error); + td->td_errno = error; + td->td_pflags |= TDP_NERRNO; + td->td_retval[0] = error; + return (0); +} diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 0762ca7a73fdd..26bcfa0a092e2 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -4533,10 +4533,10 @@ kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) int sys_posix_fallocate(struct thread *td, struct posix_fallocate_args *uap) { + int error; - td->td_retval[0] = kern_posix_fallocate(td, uap->fd, uap->offset, - uap->len); - return (0); + error = kern_posix_fallocate(td, uap->fd, uap->offset, uap->len); + return (kern_posix_error(td, error)); } /* @@ -4668,8 +4668,9 @@ out: int sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) { + int error; - td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, - uap->len, uap->advice); - return (0); + error = kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, + uap->advice); + return (kern_posix_error(td, error)); } |
