diff options
Diffstat (limited to 'sys/compat/linux')
-rw-r--r-- | sys/compat/linux/linux_file.c | 42 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.c | 15 | ||||
-rw-r--r-- | sys/compat/linux/linux_socket.c | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_stats.c | 2 | ||||
-rw-r--r-- | sys/compat/linux/linux_uid16.c | 8 |
5 files changed, 41 insertions, 30 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index e56e61f24b7a..88303b92c9be 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -82,8 +82,8 @@ linux_creat(struct thread *td, struct linux_creat_args *args) if (ldebug(creat)) printf(ARGS(creat, "%s, %d"), path, args->mode); #endif - error = kern_open(td, path, UIO_SYSSPACE, O_WRONLY | O_CREAT | O_TRUNC, - args->mode); + error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE, + O_WRONLY | O_CREAT | O_TRUNC, args->mode); LFREEPATH(path); return (error); } @@ -572,7 +572,8 @@ linux_access(struct thread *td, struct linux_access_args *args) if (ldebug(access)) printf(ARGS(access, "%s, %d"), path, args->amode); #endif - error = kern_access(td, path, UIO_SYSSPACE, args->amode); + error = kern_accessat(td, AT_FDCWD, path, UIO_SYSSPACE, 0, + args->amode); LFREEPATH(path); return (error); @@ -619,12 +620,15 @@ linux_unlink(struct thread *td, struct linux_unlink_args *args) printf(ARGS(unlink, "%s"), path); #endif - error = kern_unlink(td, path, UIO_SYSSPACE); - if (error == EPERM) + error = kern_unlinkat(td, AT_FDCWD, path, UIO_SYSSPACE, 0); + if (error == EPERM) { /* Introduce POSIX noncompliant behaviour of Linux */ - if (kern_stat(td, path, UIO_SYSSPACE, &st) == 0) + if (kern_statat(td, 0, AT_FDCWD, path, UIO_SYSSPACE, &st, + NULL) == 0) { if (S_ISDIR(st.st_mode)) error = EISDIR; + } + } LFREEPATH(path); return (error); } @@ -654,7 +658,7 @@ linux_unlinkat(struct thread *td, struct linux_unlinkat_args *args) if (error == EPERM && !(args->flag & LINUX_AT_REMOVEDIR)) { /* Introduce POSIX noncompliant behaviour of Linux */ if (kern_statat(td, AT_SYMLINK_NOFOLLOW, dfd, path, - UIO_SYSSPACE, &st) == 0 && S_ISDIR(st.st_mode)) + UIO_SYSSPACE, &st, NULL) == 0 && S_ISDIR(st.st_mode)) error = EISDIR; } LFREEPATH(path); @@ -689,7 +693,8 @@ linux_chmod(struct thread *td, struct linux_chmod_args *args) if (ldebug(chmod)) printf(ARGS(chmod, "%s, %d"), path, args->mode); #endif - error = kern_chmod(td, path, UIO_SYSSPACE, args->mode); + error = kern_fchmodat(td, AT_FDCWD, path, UIO_SYSSPACE, + args->mode, 0); LFREEPATH(path); return (error); } @@ -725,7 +730,7 @@ linux_mkdir(struct thread *td, struct linux_mkdir_args *args) if (ldebug(mkdir)) printf(ARGS(mkdir, "%s, %d"), path, args->mode); #endif - error = kern_mkdir(td, path, UIO_SYSSPACE, args->mode); + error = kern_mkdirat(td, AT_FDCWD, path, UIO_SYSSPACE, args->mode); LFREEPATH(path); return (error); } @@ -760,7 +765,7 @@ linux_rmdir(struct thread *td, struct linux_rmdir_args *args) if (ldebug(rmdir)) printf(ARGS(rmdir, "%s"), path); #endif - error = kern_rmdir(td, path, UIO_SYSSPACE); + error = kern_rmdirat(td, AT_FDCWD, path, UIO_SYSSPACE); LFREEPATH(path); return (error); } @@ -783,7 +788,7 @@ linux_rename(struct thread *td, struct linux_rename_args *args) if (ldebug(rename)) printf(ARGS(rename, "%s, %s"), from, to); #endif - error = kern_rename(td, from, to, UIO_SYSSPACE); + error = kern_renameat(td, AT_FDCWD, from, AT_FDCWD, to, UIO_SYSSPACE); LFREEPATH(from); LFREEPATH(to); return (error); @@ -833,7 +838,7 @@ linux_symlink(struct thread *td, struct linux_symlink_args *args) if (ldebug(symlink)) printf(ARGS(symlink, "%s, %s"), path, to); #endif - error = kern_symlink(td, path, to, UIO_SYSSPACE); + error = kern_symlinkat(td, path, AT_FDCWD, to, UIO_SYSSPACE); LFREEPATH(path); LFREEPATH(to); return (error); @@ -878,8 +883,8 @@ linux_readlink(struct thread *td, struct linux_readlink_args *args) printf(ARGS(readlink, "%s, %p, %d"), name, (void *)args->buf, args->count); #endif - error = kern_readlink(td, name, UIO_SYSSPACE, args->buf, UIO_USERSPACE, - args->count); + error = kern_readlinkat(td, AT_FDCWD, name, UIO_SYSSPACE, + args->buf, UIO_USERSPACE, args->count); LFREEPATH(name); return (error); } @@ -972,7 +977,8 @@ linux_link(struct thread *td, struct linux_link_args *args) if (ldebug(link)) printf(ARGS(link, "%s, %s"), path, to); #endif - error = kern_link(td, path, to, UIO_SYSSPACE); + error = kern_linkat(td, AT_FDCWD, AT_FDCWD, path, to, UIO_SYSSPACE, + FOLLOW); LFREEPATH(path); LFREEPATH(to); return (error); @@ -1487,7 +1493,8 @@ linux_chown(struct thread *td, struct linux_chown_args *args) if (ldebug(chown)) printf(ARGS(chown, "%s, %d, %d"), path, args->uid, args->gid); #endif - error = kern_chown(td, path, UIO_SYSSPACE, args->uid, args->gid); + error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid, + args->gid, 0); LFREEPATH(path); return (error); } @@ -1529,7 +1536,8 @@ linux_lchown(struct thread *td, struct linux_lchown_args *args) if (ldebug(lchown)) printf(ARGS(lchown, "%s, %d, %d"), path, args->uid, args->gid); #endif - error = kern_lchown(td, path, UIO_SYSSPACE, args->uid, args->gid); + error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid, + args->gid, AT_SYMLINK_NOFOLLOW); LFREEPATH(path); return (error); } diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index ff5e8a25a487..4433e186afa6 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -777,7 +777,8 @@ linux_utime(struct thread *td, struct linux_utime_args *args) } else tvp = NULL; - error = kern_utimes(td, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); + error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, tvp, + UIO_SYSSPACE); LFREEPATH(fname); return (error); } @@ -809,7 +810,8 @@ linux_utimes(struct thread *td, struct linux_utimes_args *args) tvp = tv; } - error = kern_utimes(td, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); + error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, + tvp, UIO_SYSSPACE); LFREEPATH(fname); return (error); } @@ -914,13 +916,14 @@ linux_mknod(struct thread *td, struct linux_mknod_args *args) switch (args->mode & S_IFMT) { case S_IFIFO: case S_IFSOCK: - error = kern_mkfifo(td, path, UIO_SYSSPACE, args->mode); + error = kern_mkfifoat(td, AT_FDCWD, path, UIO_SYSSPACE, + args->mode); break; case S_IFCHR: case S_IFBLK: - error = kern_mknod(td, path, UIO_SYSSPACE, args->mode, - args->dev); + error = kern_mknodat(td, AT_FDCWD, path, UIO_SYSSPACE, + args->mode, args->dev); break; case S_IFDIR: @@ -931,7 +934,7 @@ linux_mknod(struct thread *td, struct linux_mknod_args *args) args->mode |= S_IFREG; /* FALLTHROUGH */ case S_IFREG: - error = kern_open(td, path, UIO_SYSSPACE, + error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE, O_WRONLY | O_CREAT | O_TRUNC, args->mode); if (error == 0) kern_close(td, td->td_retval[0]); diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 43b255d0dd69..61b786fef9fb 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -731,7 +731,7 @@ linux_bind(struct thread *td, struct linux_bind_args *args) if (error) return (error); - error = kern_bind(td, args->s, sa); + error = kern_bindat(td, AT_FDCWD, args->s, sa); free(sa, M_SONAME); if (error == EADDRNOTAVAIL && args->namelen != sizeof(struct sockaddr_in)) return (EINVAL); @@ -759,7 +759,7 @@ linux_connect(struct thread *td, struct linux_connect_args *args) if (error) return (error); - error = kern_connect(td, args->s, sa); + error = kern_connectat(td, AT_FDCWD, args->s, sa); free(sa, M_SONAME); if (error != EISCONN) return (error); diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index 2e05c8543c39..b6dd86dd6ad4 100644 --- a/sys/compat/linux/linux_stats.c +++ b/sys/compat/linux/linux_stats.c @@ -77,7 +77,7 @@ linux_kern_statat(struct thread *td, int flag, int fd, char *path, enum uio_seg pathseg, struct stat *sbp) { - return (kern_statat_vnhook(td, flag, fd, path, pathseg, sbp, + return (kern_statat(td, flag, fd, path, pathseg, sbp, translate_vnhook_major_minor)); } diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c index c5bf2ddb4f79..61f3030049e6 100644 --- a/sys/compat/linux/linux_uid16.c +++ b/sys/compat/linux/linux_uid16.c @@ -121,8 +121,8 @@ linux_chown16(struct thread *td, struct linux_chown16_args *args) args->gid); LIN_SDT_PROBE1(uid16, linux_chown16, conv_path, path); - error = kern_chown(td, path, UIO_SYSSPACE, CAST_NOCHG(args->uid), - CAST_NOCHG(args->gid)); + error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, + CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), 0); LFREEPATH(path); LIN_SDT_PROBE1(uid16, linux_chown16, return, error); @@ -146,8 +146,8 @@ linux_lchown16(struct thread *td, struct linux_lchown16_args *args) args->gid); LIN_SDT_PROBE1(uid16, linux_lchown16, conv_path, path); - error = kern_lchown(td, path, UIO_SYSSPACE, CAST_NOCHG(args->uid), - CAST_NOCHG(args->gid)); + error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, + CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), AT_SYMLINK_NOFOLLOW); LFREEPATH(path); LIN_SDT_PROBE1(uid16, linux_lchown16, return, error); |