From ecb2be2c0a2f9c489663a4b01b97074dda2ceb1e Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Wed, 10 Oct 2012 15:10:27 +0100 Subject: mkdir: Use mkdirat if arch does not have the mkdir syscall Signed-off-by: Markos Chandras Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/mkdir.c | 10 +++++++++- libc/sysdeps/linux/common/mkdirat.c | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/mkdir.c b/libc/sysdeps/linux/common/mkdir.c index fbc587d3d..bee3e3e7c 100644 --- a/libc/sysdeps/linux/common/mkdir.c +++ b/libc/sysdeps/linux/common/mkdir.c @@ -10,8 +10,15 @@ #include #include +#if defined __NR_mkdirat && !defined __NR_mkdir +# include +int mkdir(const char *pathname, mode_t mode) +{ + return mkdirat(AT_FDCWD, pathname, mode); +} -#define __NR___syscall_mkdir __NR_mkdir +#else +# define __NR___syscall_mkdir __NR_mkdir static __inline__ _syscall2(int, __syscall_mkdir, const char *, pathname, __kernel_mode_t, mode) @@ -19,4 +26,5 @@ int mkdir(const char *pathname, mode_t mode) { return (__syscall_mkdir(pathname, mode)); } +#endif libc_hidden_def(mkdir) diff --git a/libc/sysdeps/linux/common/mkdirat.c b/libc/sysdeps/linux/common/mkdirat.c index 4da9468e1..871104bda 100644 --- a/libc/sysdeps/linux/common/mkdirat.c +++ b/libc/sysdeps/linux/common/mkdirat.c @@ -11,6 +11,7 @@ #ifdef __NR_mkdirat _syscall3(int, mkdirat, int, fd, const char *, path, mode_t, mode) +libc_hidden_def(mkdirat) #else /* should add emulation with mkdir() and /proc/self/fd/ ... */ #endif -- cgit v1.2.3