blob: 9fb694d22699e3d6aacb296c73fb5233a7311c6e [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* 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
10#include <sys/syscall.h>
11#include <stdlib.h>
12#include <stdarg.h>
13#include <fcntl.h>
14#include <string.h>
15#include <sys/param.h>
16
17#define __NR___syscall_open __NR_open
18static __inline__ _syscall3(int, __syscall_open, const char *, file,
19 int, flags, __kernel_mode_t, mode)
20
21int open(const char *file, int oflag, ...)
22{
23 mode_t mode = 0;
24
25 if (oflag & O_CREAT) {
26 va_list arg;
27 va_start(arg, oflag);
28 mode = va_arg(arg, mode_t);
29 va_end(arg);
30 }
31
32 return __syscall_open(file, oflag, mode);
33}
34#ifndef __LINUXTHREADS_OLD__
35libc_hidden_def(open)
36#else
37libc_hidden_weak(open)
38strong_alias(open,__libc_open)
39#endif