1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10 #include <sys/syscall.h>
15 #include <sys/param.h>
17 extern __typeof(open) __libc_open;
18 extern __typeof(creat) __libc_creat;
20 #define __NR___syscall_open __NR_open
21 static inline _syscall3(int, __syscall_open, const char *, file,
22 int, flags, __kernel_mode_t, mode);
24 libc_hidden_proto(__libc_open)
25 int __libc_open(const char *file, int oflag, ...)
29 if (oflag & O_CREAT) {
31 va_start (arg, oflag);
32 mode = va_arg (arg, mode_t);
36 return __syscall_open(file, oflag, mode);
38 libc_hidden_def(__libc_open)
40 libc_hidden_proto(open)
41 weak_alias(__libc_open,open)
42 libc_hidden_weak(open)
44 int __libc_creat(const char *file, mode_t mode)
46 return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
48 weak_alias(__libc_creat,creat)