open64.c 890 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. int __libc_open64 (const char *file, int oflag, ...)
  19. {
  20. int mode = 0;
  21. if (oflag & O_CREAT)
  22. {
  23. va_list arg;
  24. va_start (arg, oflag);
  25. mode = va_arg (arg, int);
  26. va_end (arg);
  27. }
  28. return __libc_open(file, oflag | O_LARGEFILE, mode);
  29. }
  30. libc_hidden_proto(open64)
  31. weak_alias(__libc_open64,open64)
  32. libc_hidden_weak(open64)
  33. #endif /* __UCLIBC_HAS_LFS__ */