Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/vfs_syscalls.c
Show First 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | sys_statfs(struct thread *td, struct statfs_args *uap) | ||||
error = kern_statfs(td, uap->path, UIO_USERSPACE, sfp); | error = kern_statfs(td, uap->path, UIO_USERSPACE, sfp); | ||||
if (error == 0) | if (error == 0) | ||||
error = copyout(sfp, uap->buf, sizeof(struct statfs)); | error = copyout(sfp, uap->buf, sizeof(struct statfs)); | ||||
free(sfp, M_STATFS); | free(sfp, M_STATFS); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
kern_statfs(struct thread *td, char *path, enum uio_seg pathseg, | kern_statfs(struct thread *td, const char *path, enum uio_seg pathseg, | ||||
struct statfs *buf) | struct statfs *buf) | ||||
{ | { | ||||
struct mount *mp; | struct mount *mp; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, | NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, | ||||
pathseg, path, td); | pathseg, path, td); | ||||
▲ Show 20 Lines • Show All 561 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
sys_chdir(struct thread *td, struct chdir_args *uap) | sys_chdir(struct thread *td, struct chdir_args *uap) | ||||
{ | { | ||||
return (kern_chdir(td, uap->path, UIO_USERSPACE)); | return (kern_chdir(td, uap->path, UIO_USERSPACE)); | ||||
} | } | ||||
int | int | ||||
kern_chdir(struct thread *td, char *path, enum uio_seg pathseg) | kern_chdir(struct thread *td, const char *path, enum uio_seg pathseg) | ||||
{ | { | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, | NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, | ||||
pathseg, path, td); | pathseg, path, td); | ||||
if ((error = namei(&nd)) != 0) | if ((error = namei(&nd)) != 0) | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
AUDIT_ARG_FD(uap->fd); | AUDIT_ARG_FD(uap->fd); | ||||
return (kern_openat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag, | return (kern_openat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag, | ||||
uap->mode)); | uap->mode)); | ||||
} | } | ||||
int | int | ||||
kern_openat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_openat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, | ||||
int flags, int mode) | int flags, int mode) | ||||
{ | { | ||||
struct proc *p = td->td_proc; | struct proc *p = td->td_proc; | ||||
struct filedesc *fdp = p->p_fd; | struct filedesc *fdp = p->p_fd; | ||||
struct file *fp; | struct file *fp; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
cap_rights_t rights; | cap_rights_t rights; | ||||
▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
return (kern_mknodat(td, uap->fd, uap->path, UIO_USERSPACE, uap->mode, | return (kern_mknodat(td, uap->fd, uap->path, UIO_USERSPACE, uap->mode, | ||||
uap->dev)); | uap->dev)); | ||||
} | } | ||||
#endif /* COMPAT_FREEBSD11 */ | #endif /* COMPAT_FREEBSD11 */ | ||||
int | int | ||||
kern_mknodat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_mknodat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, | ||||
int mode, dev_t dev) | int mode, dev_t dev) | ||||
{ | { | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct mount *mp; | struct mount *mp; | ||||
struct vattr vattr; | struct vattr vattr; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error, whiteout = 0; | int error, whiteout = 0; | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | |||||
sys_mkfifoat(struct thread *td, struct mkfifoat_args *uap) | sys_mkfifoat(struct thread *td, struct mkfifoat_args *uap) | ||||
{ | { | ||||
return (kern_mkfifoat(td, uap->fd, uap->path, UIO_USERSPACE, | return (kern_mkfifoat(td, uap->fd, uap->path, UIO_USERSPACE, | ||||
uap->mode)); | uap->mode)); | ||||
} | } | ||||
int | int | ||||
kern_mkfifoat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_mkfifoat(struct thread *td, int fd, const char *path, | ||||
int mode) | enum uio_seg pathseg, int mode) | ||||
{ | { | ||||
struct mount *mp; | struct mount *mp; | ||||
struct vattr vattr; | struct vattr vattr; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
AUDIT_ARG_MODE(mode); | AUDIT_ARG_MODE(mode); | ||||
restart: | restart: | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | if (hardlink_check_gid && !groupmember(va.va_gid, cred)) { | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
kern_linkat(struct thread *td, int fd1, int fd2, char *path1, char *path2, | kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, | ||||
enum uio_seg segflg, int follow) | const char *path2, enum uio_seg segflg, int follow) | ||||
{ | { | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct mount *mp; | struct mount *mp; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
again: | again: | ||||
bwillwrite(); | bwillwrite(); | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | |||||
sys_symlinkat(struct thread *td, struct symlinkat_args *uap) | sys_symlinkat(struct thread *td, struct symlinkat_args *uap) | ||||
{ | { | ||||
return (kern_symlinkat(td, uap->path1, uap->fd, uap->path2, | return (kern_symlinkat(td, uap->path1, uap->fd, uap->path2, | ||||
UIO_USERSPACE)); | UIO_USERSPACE)); | ||||
} | } | ||||
int | int | ||||
kern_symlinkat(struct thread *td, char *path1, int fd, char *path2, | kern_symlinkat(struct thread *td, const char *path1, int fd, const char *path2, | ||||
enum uio_seg segflg) | enum uio_seg segflg) | ||||
{ | { | ||||
struct mount *mp; | struct mount *mp; | ||||
struct vattr vattr; | struct vattr vattr; | ||||
char *syspath; | const char *syspath; | ||||
char *tmppath; | |||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
if (segflg == UIO_SYSSPACE) { | if (segflg == UIO_SYSSPACE) { | ||||
syspath = path1; | syspath = path1; | ||||
} else { | } else { | ||||
syspath = uma_zalloc(namei_zone, M_WAITOK); | tmppath = uma_zalloc(namei_zone, M_WAITOK); | ||||
if ((error = copyinstr(path1, syspath, MAXPATHLEN, NULL)) != 0) | if ((error = copyinstr(path1, tmppath, MAXPATHLEN, NULL)) != 0) | ||||
goto out; | goto out; | ||||
syspath = tmppath; | |||||
} | } | ||||
AUDIT_ARG_TEXT(syspath); | AUDIT_ARG_TEXT(syspath); | ||||
restart: | restart: | ||||
bwillwrite(); | bwillwrite(); | ||||
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | | NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | | ||||
NOCACHE, segflg, path2, fd, &cap_symlinkat_rights, | NOCACHE, segflg, path2, fd, &cap_symlinkat_rights, | ||||
td); | td); | ||||
if ((error = namei(&nd)) != 0) | if ((error = namei(&nd)) != 0) | ||||
Show All 30 Lines | |||||
#ifdef MAC | #ifdef MAC | ||||
out2: | out2: | ||||
#endif | #endif | ||||
NDFREE(&nd, NDF_ONLY_PNBUF); | NDFREE(&nd, NDF_ONLY_PNBUF); | ||||
vput(nd.ni_dvp); | vput(nd.ni_dvp); | ||||
vn_finished_write(mp); | vn_finished_write(mp); | ||||
out: | out: | ||||
if (segflg != UIO_SYSSPACE) | if (segflg != UIO_SYSSPACE) | ||||
uma_zfree(namei_zone, syspath); | uma_zfree(namei_zone, tmppath); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Delete a whiteout from the filesystem. | * Delete a whiteout from the filesystem. | ||||
*/ | */ | ||||
#ifndef _SYS_SYSPROTO_H_ | #ifndef _SYS_SYSPROTO_H_ | ||||
struct undelete_args { | struct undelete_args { | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | struct unlinkat_args { | ||||
char *path; | char *path; | ||||
int flag; | int flag; | ||||
}; | }; | ||||
#endif | #endif | ||||
int | int | ||||
sys_unlinkat(struct thread *td, struct unlinkat_args *uap) | sys_unlinkat(struct thread *td, struct unlinkat_args *uap) | ||||
{ | { | ||||
int fd, flag; | int fd, flag; | ||||
char *path; | const char *path; | ||||
flag = uap->flag; | flag = uap->flag; | ||||
fd = uap->fd; | fd = uap->fd; | ||||
path = uap->path; | path = uap->path; | ||||
if ((flag & ~(AT_REMOVEDIR | AT_BENEATH)) != 0) | if ((flag & ~(AT_REMOVEDIR | AT_BENEATH)) != 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
if ((uap->flag & AT_REMOVEDIR) != 0) | if ((uap->flag & AT_REMOVEDIR) != 0) | ||||
return (kern_rmdirat(td, fd, path, UIO_USERSPACE, flag)); | return (kern_rmdirat(td, fd, path, UIO_USERSPACE, flag)); | ||||
else | else | ||||
return (kern_unlinkat(td, fd, path, UIO_USERSPACE, flag, 0)); | return (kern_unlinkat(td, fd, path, UIO_USERSPACE, flag, 0)); | ||||
} | } | ||||
int | int | ||||
kern_unlinkat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_unlinkat(struct thread *td, int fd, const char *path, | ||||
int flag, ino_t oldinum) | enum uio_seg pathseg, int flag, ino_t oldinum) | ||||
{ | { | ||||
struct mount *mp; | struct mount *mp; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
struct stat sb; | struct stat sb; | ||||
int error; | int error; | ||||
restart: | restart: | ||||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | |||||
sys_faccessat(struct thread *td, struct faccessat_args *uap) | sys_faccessat(struct thread *td, struct faccessat_args *uap) | ||||
{ | { | ||||
return (kern_accessat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag, | return (kern_accessat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag, | ||||
uap->amode)); | uap->amode)); | ||||
} | } | ||||
int | int | ||||
kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_accessat(struct thread *td, int fd, const char *path, | ||||
int flag, int amode) | enum uio_seg pathseg, int flag, int amode) | ||||
{ | { | ||||
struct ucred *cred, *usecred; | struct ucred *cred, *usecred; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
if ((flag & ~(AT_EACCESS | AT_BENEATH)) != 0) | if ((flag & ~(AT_EACCESS | AT_BENEATH)) != 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | sys_fstatat(struct thread *td, struct fstatat_args *uap) | ||||
error = kern_statat(td, uap->flag, uap->fd, uap->path, | error = kern_statat(td, uap->flag, uap->fd, uap->path, | ||||
UIO_USERSPACE, &sb, NULL); | UIO_USERSPACE, &sb, NULL); | ||||
if (error == 0) | if (error == 0) | ||||
error = copyout(&sb, uap->buf, sizeof (sb)); | error = copyout(&sb, uap->buf, sizeof (sb)); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
kern_statat(struct thread *td, int flag, int fd, char *path, | kern_statat(struct thread *td, int flag, int fd, const char *path, | ||||
enum uio_seg pathseg, struct stat *sbp, | enum uio_seg pathseg, struct stat *sbp, | ||||
void (*hook)(struct vnode *vp, struct stat *sbp)) | void (*hook)(struct vnode *vp, struct stat *sbp)) | ||||
{ | { | ||||
struct nameidata nd; | struct nameidata nd; | ||||
struct stat sb; | struct stat sb; | ||||
int error; | int error; | ||||
if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH)) != 0) | if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH)) != 0) | ||||
▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | sys_lpathconf(struct thread *td, struct lpathconf_args *uap) | ||||
error = kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, | error = kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, | ||||
NOFOLLOW, &value); | NOFOLLOW, &value); | ||||
if (error == 0) | if (error == 0) | ||||
td->td_retval[0] = value; | td->td_retval[0] = value; | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name, | kern_pathconf(struct thread *td, const char *path, enum uio_seg pathseg, | ||||
u_long flags, long *valuep) | int name, u_long flags, long *valuep) | ||||
{ | { | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
NDINIT(&nd, LOOKUP, LOCKSHARED | LOCKLEAF | AUDITVNODE1 | flags, | NDINIT(&nd, LOOKUP, LOCKSHARED | LOCKLEAF | AUDITVNODE1 | flags, | ||||
pathseg, path, td); | pathseg, path, td); | ||||
if ((error = namei(&nd)) != 0) | if ((error = namei(&nd)) != 0) | ||||
return (error); | return (error); | ||||
Show All 33 Lines | |||||
sys_readlinkat(struct thread *td, struct readlinkat_args *uap) | sys_readlinkat(struct thread *td, struct readlinkat_args *uap) | ||||
{ | { | ||||
return (kern_readlinkat(td, uap->fd, uap->path, UIO_USERSPACE, | return (kern_readlinkat(td, uap->fd, uap->path, UIO_USERSPACE, | ||||
uap->buf, UIO_USERSPACE, uap->bufsize)); | uap->buf, UIO_USERSPACE, uap->bufsize)); | ||||
} | } | ||||
int | int | ||||
kern_readlinkat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_readlinkat(struct thread *td, int fd, const char *path, | ||||
char *buf, enum uio_seg bufseg, size_t count) | enum uio_seg pathseg, char *buf, enum uio_seg bufseg, size_t count) | ||||
{ | { | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct iovec aiov; | struct iovec aiov; | ||||
struct uio auio; | struct uio auio; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
if (count > IOSIZE_MAX) | if (count > IOSIZE_MAX) | ||||
▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | |||||
sys_lchmod(struct thread *td, struct lchmod_args *uap) | sys_lchmod(struct thread *td, struct lchmod_args *uap) | ||||
{ | { | ||||
return (kern_fchmodat(td, AT_FDCWD, uap->path, UIO_USERSPACE, | return (kern_fchmodat(td, AT_FDCWD, uap->path, UIO_USERSPACE, | ||||
uap->mode, AT_SYMLINK_NOFOLLOW)); | uap->mode, AT_SYMLINK_NOFOLLOW)); | ||||
} | } | ||||
int | int | ||||
kern_fchmodat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_fchmodat(struct thread *td, int fd, const char *path, | ||||
mode_t mode, int flag) | enum uio_seg pathseg, mode_t mode, int flag) | ||||
{ | { | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error, follow; | int error, follow; | ||||
AUDIT_ARG_MODE(mode); | AUDIT_ARG_MODE(mode); | ||||
follow = (flag & AT_SYMLINK_NOFOLLOW) != 0 ? NOFOLLOW : FOLLOW; | follow = (flag & AT_SYMLINK_NOFOLLOW) != 0 ? NOFOLLOW : FOLLOW; | ||||
follow |= (flag & AT_BENEATH) != 0 ? BENEATH : 0; | follow |= (flag & AT_BENEATH) != 0 ? BENEATH : 0; | ||||
NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, pathseg, path, fd, | NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, pathseg, path, fd, | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | sys_fchownat(struct thread *td, struct fchownat_args *uap) | ||||
if ((uap->flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH)) != 0) | if ((uap->flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH)) != 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
return (kern_fchownat(td, uap->fd, uap->path, UIO_USERSPACE, uap->uid, | return (kern_fchownat(td, uap->fd, uap->path, UIO_USERSPACE, uap->uid, | ||||
uap->gid, uap->flag)); | uap->gid, uap->flag)); | ||||
} | } | ||||
int | int | ||||
kern_fchownat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_fchownat(struct thread *td, int fd, const char *path, | ||||
int uid, int gid, int flag) | enum uio_seg pathseg, int uid, int gid, int flag) | ||||
{ | { | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error, follow; | int error, follow; | ||||
AUDIT_ARG_OWNER(uid, gid); | AUDIT_ARG_OWNER(uid, gid); | ||||
follow = (flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW; | follow = (flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW; | ||||
follow |= (flag & AT_BENEATH) != 0 ? BENEATH : 0; | follow |= (flag & AT_BENEATH) != 0 ? BENEATH : 0; | ||||
NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, pathseg, path, fd, | NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, pathseg, path, fd, | ||||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | |||||
sys_futimesat(struct thread *td, struct futimesat_args *uap) | sys_futimesat(struct thread *td, struct futimesat_args *uap) | ||||
{ | { | ||||
return (kern_utimesat(td, uap->fd, uap->path, UIO_USERSPACE, | return (kern_utimesat(td, uap->fd, uap->path, UIO_USERSPACE, | ||||
uap->times, UIO_USERSPACE)); | uap->times, UIO_USERSPACE)); | ||||
} | } | ||||
int | int | ||||
kern_utimesat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_utimesat(struct thread *td, int fd, const char *path, | ||||
struct timeval *tptr, enum uio_seg tptrseg) | enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg) | ||||
{ | { | ||||
struct nameidata nd; | struct nameidata nd; | ||||
struct timespec ts[2]; | struct timespec ts[2]; | ||||
int error; | int error; | ||||
if ((error = getutimes(tptr, tptrseg, ts)) != 0) | if ((error = getutimes(tptr, tptrseg, ts)) != 0) | ||||
return (error); | return (error); | ||||
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd, | NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd, | ||||
Show All 20 Lines | |||||
sys_lutimes(struct thread *td, struct lutimes_args *uap) | sys_lutimes(struct thread *td, struct lutimes_args *uap) | ||||
{ | { | ||||
return (kern_lutimes(td, uap->path, UIO_USERSPACE, uap->tptr, | return (kern_lutimes(td, uap->path, UIO_USERSPACE, uap->tptr, | ||||
UIO_USERSPACE)); | UIO_USERSPACE)); | ||||
} | } | ||||
int | int | ||||
kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg, | kern_lutimes(struct thread *td, const char *path, enum uio_seg pathseg, | ||||
struct timeval *tptr, enum uio_seg tptrseg) | struct timeval *tptr, enum uio_seg tptrseg) | ||||
{ | { | ||||
struct timespec ts[2]; | struct timespec ts[2]; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
if ((error = getutimes(tptr, tptrseg, ts)) != 0) | if ((error = getutimes(tptr, tptrseg, ts)) != 0) | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | |||||
sys_utimensat(struct thread *td, struct utimensat_args *uap) | sys_utimensat(struct thread *td, struct utimensat_args *uap) | ||||
{ | { | ||||
return (kern_utimensat(td, uap->fd, uap->path, UIO_USERSPACE, | return (kern_utimensat(td, uap->fd, uap->path, UIO_USERSPACE, | ||||
uap->times, UIO_USERSPACE, uap->flag)); | uap->times, UIO_USERSPACE, uap->flag)); | ||||
} | } | ||||
int | int | ||||
kern_utimensat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_utimensat(struct thread *td, int fd, const char *path, | ||||
struct timespec *tptr, enum uio_seg tptrseg, int flag) | enum uio_seg pathseg, struct timespec *tptr, enum uio_seg tptrseg, | ||||
int flag) | |||||
{ | { | ||||
struct nameidata nd; | struct nameidata nd; | ||||
struct timespec ts[2]; | struct timespec ts[2]; | ||||
int error, flags; | int error, flags; | ||||
if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH)) != 0) | if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH)) != 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
Show All 30 Lines | |||||
int | int | ||||
sys_truncate(struct thread *td, struct truncate_args *uap) | sys_truncate(struct thread *td, struct truncate_args *uap) | ||||
{ | { | ||||
return (kern_truncate(td, uap->path, UIO_USERSPACE, uap->length)); | return (kern_truncate(td, uap->path, UIO_USERSPACE, uap->length)); | ||||
} | } | ||||
int | int | ||||
kern_truncate(struct thread *td, char *path, enum uio_seg pathseg, off_t length) | kern_truncate(struct thread *td, const char *path, enum uio_seg pathseg, | ||||
off_t length) | |||||
{ | { | ||||
struct mount *mp; | struct mount *mp; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
void *rl_cookie; | void *rl_cookie; | ||||
struct vattr vattr; | struct vattr vattr; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | |||||
sys_renameat(struct thread *td, struct renameat_args *uap) | sys_renameat(struct thread *td, struct renameat_args *uap) | ||||
{ | { | ||||
return (kern_renameat(td, uap->oldfd, uap->old, uap->newfd, uap->new, | return (kern_renameat(td, uap->oldfd, uap->old, uap->newfd, uap->new, | ||||
UIO_USERSPACE)); | UIO_USERSPACE)); | ||||
} | } | ||||
int | int | ||||
kern_renameat(struct thread *td, int oldfd, char *old, int newfd, char *new, | kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, | ||||
enum uio_seg pathseg) | const char *new, enum uio_seg pathseg) | ||||
{ | { | ||||
struct mount *mp = NULL; | struct mount *mp = NULL; | ||||
struct vnode *tvp, *fvp, *tdvp; | struct vnode *tvp, *fvp, *tdvp; | ||||
struct nameidata fromnd, tond; | struct nameidata fromnd, tond; | ||||
int error; | int error; | ||||
again: | again: | ||||
bwillwrite(); | bwillwrite(); | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
sys_mkdirat(struct thread *td, struct mkdirat_args *uap) | sys_mkdirat(struct thread *td, struct mkdirat_args *uap) | ||||
{ | { | ||||
return (kern_mkdirat(td, uap->fd, uap->path, UIO_USERSPACE, uap->mode)); | return (kern_mkdirat(td, uap->fd, uap->path, UIO_USERSPACE, uap->mode)); | ||||
} | } | ||||
int | int | ||||
kern_mkdirat(struct thread *td, int fd, char *path, enum uio_seg segflg, | kern_mkdirat(struct thread *td, int fd, const char *path, enum uio_seg segflg, | ||||
int mode) | int mode) | ||||
{ | { | ||||
struct mount *mp; | struct mount *mp; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct vattr vattr; | struct vattr vattr; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
sys_rmdir(struct thread *td, struct rmdir_args *uap) | sys_rmdir(struct thread *td, struct rmdir_args *uap) | ||||
{ | { | ||||
return (kern_rmdirat(td, AT_FDCWD, uap->path, UIO_USERSPACE, 0)); | return (kern_rmdirat(td, AT_FDCWD, uap->path, UIO_USERSPACE, 0)); | ||||
} | } | ||||
int | int | ||||
kern_rmdirat(struct thread *td, int fd, char *path, enum uio_seg pathseg, | kern_rmdirat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, | ||||
int flag) | int flag) | ||||
{ | { | ||||
struct mount *mp; | struct mount *mp; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct nameidata nd; | struct nameidata nd; | ||||
int error; | int error; | ||||
restart: | restart: | ||||
▲ Show 20 Lines • Show All 929 Lines • Show Last 20 Lines |