open64.c 947 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <features.h>
  7. #include <fcntl.h>
  8. #include <stdarg.h>
  9. #ifdef __UCLIBC_HAS_LFS__
  10. #ifndef O_LARGEFILE
  11. # define O_LARGEFILE 0100000
  12. #endif
  13. extern __typeof(open64) __libc_open64;
  14. extern __typeof(open) __libc_open;
  15. libc_hidden_proto(__libc_open)
  16. /* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
  17. a third argument is the file protection. */
  18. libc_hidden_proto(__libc_open64)
  19. int __libc_open64 (const char *file, int oflag, ...)
  20. {
  21. mode_t mode = 0;
  22. if (oflag & O_CREAT)
  23. {
  24. va_list arg;
  25. va_start (arg, oflag);
  26. mode = va_arg (arg, mode_t);
  27. va_end (arg);
  28. }
  29. return __libc_open(file, oflag | O_LARGEFILE, mode);
  30. }
  31. libc_hidden_def(__libc_open64)
  32. libc_hidden_proto(open64)
  33. weak_alias(__libc_open64,open64)
  34. libc_hidden_weak(open64)
  35. #endif /* __UCLIBC_HAS_LFS__ */