Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/sys_generic.c
Show First 20 Lines • Show All 813 Lines • ▼ Show 20 Lines | default: | ||||
break; | break; | ||||
} | } | ||||
if (fp != NULL) | if (fp != NULL) | ||||
fdrop(fp, td); | fdrop(fp, td); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
sys_posix_fallocate(struct thread *td, struct posix_fallocate_args *uap) | |||||
{ | |||||
int error; | |||||
error = kern_posix_fallocate(td, uap->fd, uap->offset, uap->len); | |||||
return (kern_posix_error(td, error)); | |||||
} | |||||
int | |||||
kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) | |||||
{ | |||||
struct file *fp; | |||||
int error; | |||||
AUDIT_ARG_FD(fd); | |||||
if (offset < 0 || len <= 0) | |||||
return (EINVAL); | |||||
/* Check for wrap. */ | |||||
if (offset > OFF_MAX - len) | |||||
return (EFBIG); | |||||
AUDIT_ARG_FD(fd); | |||||
error = fget(td, fd, &cap_pwrite_rights, &fp); | |||||
if (error != 0) | |||||
return (error); | |||||
AUDIT_ARG_FILE(td->td_proc, fp); | |||||
if ((fp->f_ops->fo_flags & DFLAG_SEEKABLE) == 0) { | |||||
error = ESPIPE; | |||||
goto out; | |||||
} | |||||
if ((fp->f_flag & FWRITE) == 0) { | |||||
error = EBADF; | |||||
goto out; | |||||
} | |||||
error = fo_fallocate(fp, offset, len, td); | |||||
out: | |||||
kib: ```
if ((fp->f_ops->fo_flags & DFLAG_SEEKABLE) == 0)
error = ESPIPE… | |||||
fdrop(fp, td); | |||||
return (error); | |||||
} | |||||
int | |||||
poll_no_poll(int events) | poll_no_poll(int events) | ||||
{ | { | ||||
/* | /* | ||||
* Return true for read/write. If the user asked for something | * Return true for read/write. If the user asked for something | ||||
* special, return POLLNVAL, so that clients have a way of | * special, return POLLNVAL, so that clients have a way of | ||||
* determining reliably whether or not the extended | * determining reliably whether or not the extended | ||||
* functionality is present without hard-coding knowledge | * functionality is present without hard-coding knowledge | ||||
* of specific filesystem implementations. | * of specific filesystem implementations. | ||||
▲ Show 20 Lines • Show All 1,045 Lines • Show Last 20 Lines |
gets rid of the 'out' label.