open64.c 803 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  3. *
  4. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  5. */
  6. #include <_lfs_64.h>
  7. #include <fcntl.h>
  8. #include <stdarg.h>
  9. #include <cancel.h>
  10. /* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
  11. a third argument is the file protection. */
  12. int open64(const char *file, int oflag, ...)
  13. {
  14. mode_t mode = 0;
  15. if (oflag & O_CREAT) {
  16. va_list arg;
  17. va_start (arg, oflag);
  18. mode = va_arg (arg, mode_t);
  19. va_end (arg);
  20. }
  21. #if defined __NR_openat && !defined __NR_open
  22. return openat(AT_FDCWD, file, oflag | O_LARGEFILE, mode);
  23. #else
  24. return open(file, oflag | O_LARGEFILE, mode);
  25. #endif
  26. }
  27. lt_strong_alias(open64)
  28. lt_libc_hidden(open64)
  29. /* open handled cancellation, noop on uClibc */
  30. LIBC_CANCEL_HANDLED();