open.c 810 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * open() for uClibc
  4. *
  5. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <sys/syscall.h>
  10. #include <stdlib.h>
  11. #include <stdarg.h>
  12. #include <fcntl.h>
  13. #include <string.h>
  14. #include <sys/param.h>
  15. #define __NR___syscall_open __NR_open
  16. static __inline__ _syscall3(int, __syscall_open, const char *, file,
  17. int, flags, __kernel_mode_t, mode)
  18. int open(const char *file, int oflag, ...)
  19. {
  20. mode_t mode = 0;
  21. if (oflag & O_CREAT) {
  22. va_list arg;
  23. va_start(arg, oflag);
  24. mode = va_arg(arg, mode_t);
  25. va_end(arg);
  26. }
  27. return __syscall_open(file, oflag, mode);
  28. }
  29. #ifndef __LINUXTHREADS_OLD__
  30. libc_hidden_def(open)
  31. #else
  32. libc_hidden_weak(open)
  33. strong_alias(open,__libc_open)
  34. #endif