chmod.c 653 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * chmod() for uClibc
  3. *
  4. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <sys/stat.h>
  10. #include <unistd.h>
  11. #if defined __NR_fchmodat && !defined __NR_chmod
  12. # include <fcntl.h>
  13. int chmod(const char *path, mode_t mode)
  14. {
  15. return fchmodat(AT_FDCWD, path, mode, 0);
  16. }
  17. #else
  18. # define __NR___syscall_chmod __NR_chmod
  19. static __inline__ _syscall2(int, __syscall_chmod, const char *, path, __kernel_mode_t, mode)
  20. int chmod(const char *path, mode_t mode)
  21. {
  22. return __syscall_chmod(path, mode);
  23. }
  24. #endif
  25. libc_hidden_def(chmod)