openat.c 725 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * openat() for uClibc
  3. *
  4. * Copyright (C) 2009 Analog Devices Inc.
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <fcntl.h>
  10. #include <stdarg.h>
  11. #ifdef __NR_openat
  12. # define __NR___syscall_openat __NR_openat
  13. static __inline__ _syscall4(int, __syscall_openat, int, fd, const char *, file, int, oflag, mode_t, mode)
  14. int __openat(int fd, const char *file, int o_flag, ...)
  15. {
  16. va_list ap;
  17. mode_t mode;
  18. va_start(ap, o_flag);
  19. mode = va_arg(ap, int);
  20. va_end(ap);
  21. return __syscall_openat(fd, file, o_flag, mode);
  22. }
  23. strong_alias_untyped(__openat,openat)
  24. libc_hidden_def(openat)
  25. #else
  26. /* should add emulation with open() and /proc/self/fd/ ... */
  27. #endif