diff options
| author | Joshua M. Clulow <jmc@joyent.com> | 2015-02-26 05:26:01 +0000 |
|---|---|---|
| committer | Joshua M. Clulow <jmc@joyent.com> | 2015-02-26 06:27:18 +0000 |
| commit | 951211ad1865c5ba0a9b52d15f18a35d976badef (patch) | |
| tree | 9d5fc85cec9569e9cc887d0f787190dfcf475de6 /usr/src | |
| parent | 72b9bbdbf8261cde99a8c9f5b4e62ff791806ad5 (diff) | |
| download | illumos-joyent-951211ad1865c5ba0a9b52d15f18a35d976badef.tar.gz | |
OS-3924 lxbrand in-kernel mkdir(2) and mkdirat(2)
OS-3920 lxbrand use native *at(2) system calls for LX emulation
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/file.c | 15 | ||||
| -rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/lx_brand.c | 8 | ||||
| -rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/misc.c | 9 | ||||
| -rw-r--r-- | usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h | 2 | ||||
| -rw-r--r-- | usr/src/uts/common/brand/lx/os/lx_syscall.c | 8 | ||||
| -rw-r--r-- | usr/src/uts/common/brand/lx/sys/lx_syscalls.h | 2 | ||||
| -rw-r--r-- | usr/src/uts/common/brand/lx/syscall/lx_mkdir.c | 38 | ||||
| -rw-r--r-- | usr/src/uts/intel/Makefile.files | 1 |
8 files changed, 49 insertions, 34 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/file.c b/usr/src/lib/brand/lx/lx_brand/common/file.c index a3fc081c53..0b145e9c27 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/file.c +++ b/usr/src/lib/brand/lx/lx_brand/common/file.c @@ -679,21 +679,6 @@ getpathat(int fd, uintptr_t p1, char *outbuf, size_t outbuf_size) } long -lx_mkdirat(uintptr_t p1, uintptr_t p2, uintptr_t p3) -{ - int atfd = (int)p1; - mode_t mode = (mode_t)p3; - char pathbuf[MAXPATHLEN]; - int ret; - - ret = getpathat(atfd, p2, pathbuf, sizeof (pathbuf)); - if (ret < 0) - return (ret); - - return (mkdir(pathbuf, mode) ? -errno : 0); -} - -long lx_mknodat(uintptr_t ext1, uintptr_t p1, uintptr_t p2, uintptr_t p3) { int atfd = (int)ext1; diff --git a/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c b/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c index 3b88397860..dd0037c774 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c +++ b/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c @@ -1045,7 +1045,7 @@ static lx_syscall_handler_t lx_handlers[] = { lx_chdir, /* 80: chdir */ lx_fchdir, /* 81: fchdir */ lx_rename, /* 82: rename */ - lx_mkdir, /* 83: mkdir */ + NULL, /* 83: mkdir */ lx_rmdir, /* 84: rmdir */ lx_creat, /* 85: creat */ lx_link, /* 86: link */ @@ -1220,7 +1220,7 @@ static lx_syscall_handler_t lx_handlers[] = { lx_inotify_rm_watch, /* 255: inotify_rm_watch */ NULL, /* 256: migrate_pages */ lx_openat, /* 257: openat */ - lx_mkdirat, /* 258: mkdirat */ + NULL, /* 258: mkdirat */ lx_mknodat, /* 259: mknodat */ lx_fchownat, /* 260: fchownat */ lx_futimesat, /* 261: futimesat */ @@ -1332,7 +1332,7 @@ static lx_syscall_handler_t lx_handlers[] = { lx_sync, /* 36: sync */ NULL, /* 37: kill */ lx_rename, /* 38: rename */ - lx_mkdir, /* 39: mkdir */ + NULL, /* 39: mkdir */ lx_rmdir, /* 40: rmdir */ lx_dup, /* 41: dup */ NULL, /* 42: pipe */ @@ -1589,7 +1589,7 @@ static lx_syscall_handler_t lx_handlers[] = { lx_inotify_rm_watch, /* 293: inotify_rm_watch */ NULL, /* 294: migrate_pages */ lx_openat, /* 295: openat */ - lx_mkdirat, /* 296: mkdirat */ + NULL, /* 296: mkdirat */ lx_mknodat, /* 297: mknodat */ lx_fchownat, /* 298: fchownat */ lx_futimesat, /* 299: futimesat */ diff --git a/usr/src/lib/brand/lx/lx_brand/common/misc.c b/usr/src/lib/brand/lx/lx_brand/common/misc.c index e3bb34dadc..9558133b0e 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/misc.c +++ b/usr/src/lib/brand/lx/lx_brand/common/misc.c @@ -945,15 +945,6 @@ lx_mincore(caddr_t addr, size_t len, char *vec) } long -lx_mkdir(const char *path, mode_t mode) -{ - int r; - - r = mkdir(path, mode); - return ((r == -1) ? -errno : r); -} - -long lx_munmap(void *addr, size_t len) { int r; diff --git a/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h b/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h index 7aed33752f..58f56d2737 100644 --- a/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h +++ b/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h @@ -45,7 +45,6 @@ extern "C" { extern int lx_install; extern long lx_openat(uintptr_t, uintptr_t, uintptr_t, uintptr_t); -extern long lx_mkdirat(uintptr_t, uintptr_t, uintptr_t); extern long lx_mknodat(uintptr_t, uintptr_t, uintptr_t, uintptr_t); extern long lx_fchownat(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); extern long lx_futimesat(uintptr_t, uintptr_t, uintptr_t); @@ -327,7 +326,6 @@ extern long lx_inotify_init1(int); extern long lx_inotify_rm_watch(int, int); extern long lx_lchown(const char *, uid_t, gid_t); extern long lx_mincore(caddr_t, size_t, char *); -extern long lx_mkdir(const char *, mode_t); extern long lx_munmap(void *, size_t); extern long lx_nanosleep(const struct timespec *, struct timespec *); extern long lx_nice(int); diff --git a/usr/src/uts/common/brand/lx/os/lx_syscall.c b/usr/src/uts/common/brand/lx/os/lx_syscall.c index eb4ce1e8f6..3ec4dc55af 100644 --- a/usr/src/uts/common/brand/lx/os/lx_syscall.c +++ b/usr/src/uts/common/brand/lx/os/lx_syscall.c @@ -465,7 +465,7 @@ lx_sysent_t lx_sysent32[] = { {"sync", NULL, 0, 0}, /* 36 */ {"kill", lx_kill, 0, 2}, /* 37 */ {"rename", NULL, 0, 2}, /* 38 */ - {"mkdir", NULL, 0, 2}, /* 39 */ + {"mkdir", lx_mkdir, 0, 2}, /* 39 */ {"rmdir", NULL, 0, 1}, /* 40 */ {"dup", NULL, 0, 1}, /* 41 */ {"pipe", lx_pipe, 0, 1}, /* 42 */ @@ -726,7 +726,7 @@ lx_sysent_t lx_sysent32[] = { {"inotify_rm_watch", NULL, 0, 2}, /* 293 */ {"migrate_pages", NULL, NOSYS_NULL, 0}, /* 294 */ {"openat", NULL, 0, 4}, /* 295 */ - {"mkdirat", NULL, 0, 3}, /* 296 */ + {"mkdirat", lx_mkdirat, 0, 3}, /* 296 */ {"mknodat", NULL, 0, 4}, /* 297 */ {"fchownat", NULL, 0, 5}, /* 298 */ {"futimesat", NULL, 0, 3}, /* 299 */ @@ -880,7 +880,7 @@ lx_sysent_t lx_sysent64[] = { {"chdir", NULL, 0, 1}, /* 80 */ {"fchdir", NULL, 0, 1}, /* 81 */ {"rename", NULL, 0, 2}, /* 82 */ - {"mkdir", NULL, 0, 2}, /* 83 */ + {"mkdir", lx_mkdir, 0, 2}, /* 83 */ {"rmdir", NULL, 0, 1}, /* 84 */ {"creat", NULL, 0, 2}, /* 85 */ {"link", NULL, 0, 2}, /* 86 */ @@ -1055,7 +1055,7 @@ lx_sysent_t lx_sysent64[] = { {"inotify_rm_watch", NULL, 0, 2}, /* 255 */ {"migrate_pages", NULL, NOSYS_NULL, 0}, /* 256 */ {"openat", NULL, 0, 4}, /* 257 */ - {"mkdirat", NULL, 0, 3}, /* 258 */ + {"mkdirat", lx_mkdirat, 0, 3}, /* 258 */ {"mknodat", NULL, 0, 4}, /* 259 */ {"fchownat", NULL, 0, 5}, /* 260 */ {"futimesat", NULL, 0, 3}, /* 261 */ diff --git a/usr/src/uts/common/brand/lx/sys/lx_syscalls.h b/usr/src/uts/common/brand/lx/sys/lx_syscalls.h index 6943b40310..52c9d503f7 100644 --- a/usr/src/uts/common/brand/lx/sys/lx_syscalls.h +++ b/usr/src/uts/common/brand/lx/sys/lx_syscalls.h @@ -46,6 +46,8 @@ extern long lx_getppid(); extern long lx_gettid(); extern long lx_ioctl(); extern long lx_kill(); +extern long lx_mkdir(); +extern long lx_mkdirat(); extern long lx_modify_ldt(); extern long lx_pipe(); extern long lx_pipe2(); diff --git a/usr/src/uts/common/brand/lx/syscall/lx_mkdir.c b/usr/src/uts/common/brand/lx/syscall/lx_mkdir.c new file mode 100644 index 0000000000..2f29f56d5f --- /dev/null +++ b/usr/src/uts/common/brand/lx/syscall/lx_mkdir.c @@ -0,0 +1,38 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2015 Joyent, Inc. + */ + +#include <sys/fcntl.h> +#include <sys/lx_fcntl.h> + +/* + * From "uts/common/syscall/mkdir.c": + */ +extern int mkdirat(int, char *, int); + +long +lx_mkdirat(int fd, char *dname, int dmode) +{ + if (fd == LX_AT_FDCWD) { + fd = AT_FDCWD; + } + + return (mkdirat(fd, dname, dmode)); +} + +long +lx_mkdir(char *dname, int dmode) +{ + return (mkdirat(AT_FDCWD, dname, dmode)); +} diff --git a/usr/src/uts/intel/Makefile.files b/usr/src/uts/intel/Makefile.files index 0b99fc7e9c..d2c42ff0a4 100644 --- a/usr/src/uts/intel/Makefile.files +++ b/usr/src/uts/intel/Makefile.files @@ -287,6 +287,7 @@ LX_BRAND_OBJS = \ lx_ioctl.o \ lx_kill.o \ lx_misc.o \ + lx_mkdir.o \ lx_modify_ldt.o \ lx_pid.o \ lx_pipe.o \ |
