openat64.c 753 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. #define openat64 __xx_openat
  9. #include <sys/syscall.h>
  10. #include <fcntl.h>
  11. #undef openat64
  12. #ifdef __UCLIBC_HAS_LFS__
  13. #ifdef __NR_openat
  14. /* The openat() prototype is varargs based, but we don't care about that
  15. * here, so need to provide our own dedicated signature.
  16. */
  17. extern int openat64(int fd, const char *file, int oflag, mode_t mode);
  18. libc_hidden_proto(openat64)
  19. int openat64(int fd, const char *file, int oflag, mode_t mode)
  20. {
  21. return openat(fd, file, oflag | O_LARGEFILE, mode);
  22. }
  23. libc_hidden_def(openat64)
  24. #else
  25. /* should add emulation with open() and /proc/self/fd/ ... */
  26. #endif
  27. #endif