[RFC PATCH 01/38] chmod: prefer fchmodat syscall
Khem Raj
raj.khem at gmail.com
Tue Sep 6 13:40:41 UTC 2011
On Tue, Sep 6, 2011 at 1:30 AM, Jonas Bonn <jonas at southpole.se> wrote:
>
> Signed-off-by: Jonas Bonn <jonas at southpole.se>
> ---
> libc/sysdeps/linux/common/chmod.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/libc/sysdeps/linux/common/chmod.c b/libc/sysdeps/linux/common/chmod.c
> index 871e023..c60456f 100644
> --- a/libc/sysdeps/linux/common/chmod.c
> +++ b/libc/sysdeps/linux/common/chmod.c
> @@ -9,8 +9,16 @@
>
> #include <sys/syscall.h>
> #include <sys/stat.h>
> +#include <fcntl.h>
> +#include <unistd.h>
>
those includes could also be put in conditionals if they were not needed before
> +#ifdef __NR_fchmodat
> +int chmod(const char *path, mode_t mode)
> +{
> + return fchmodat(AT_FDCWD, path, mode, 0);
> +}
>
> +#else
> #define __NR___syscall_chmod __NR_chmod
> static __inline__ _syscall2(int, __syscall_chmod, const char *, path, __kernel_mode_t, mode)
>
> @@ -18,4 +26,5 @@ int chmod(const char *path, mode_t mode)
> {
> return __syscall_chmod(path, mode);
> }
> +#endif
> libc_hidden_def(chmod)
> --
> 1.7.5.4
>
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc
>
More information about the uClibc
mailing list