open64.c 828 B

12345678910111213141516171819202122232425262728293031323334
  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 <sys/syscall.h>
  8. #include <fcntl.h>
  9. #include <stdarg.h>
  10. #include <cancel.h>
  11. /* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
  12. a third argument is the file protection. */
  13. int open64(const char *file, int oflag, ...)
  14. {
  15. mode_t mode = 0;
  16. if (oflag & O_CREAT) {
  17. va_list arg;
  18. va_start (arg, oflag);
  19. mode = va_arg (arg, mode_t);
  20. va_end (arg);
  21. }
  22. #if defined __NR_openat && !defined __NR_open
  23. return openat(AT_FDCWD, file, oflag | O_LARGEFILE, mode);
  24. #else
  25. return open(file, oflag | O_LARGEFILE, mode);
  26. #endif
  27. }
  28. lt_strong_alias(open64)
  29. lt_libc_hidden(open64)
  30. /* open handled cancellation, noop on uClibc */
  31. LIBC_CANCEL_HANDLED();