projects
/
musl
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
088a28f74b6212cd9bd9ec2083d1245abf7e989d
[musl]
/
src
/
fcntl
/
open.c
1
#include <fcntl.h>
2
#include <stdarg.h>
3
#include "syscall.h"
4
#include "libc.h"
5
6
int open(const char *filename, int flags, ...)
7
{
8
mode_t mode;
9
va_list ap;
10
va_start(ap, flags);
11
mode = va_arg(ap, mode_t);
12
va_end(ap);
13
14
int fd = __sys_open_cp(filename, flags, mode);
15
if (fd>=0 && (flags & O_CLOEXEC))
16
__syscall(SYS_fcntl, fd, F_SETFD, FD_CLOEXEC);
17
18
return __syscall_ret(fd);
19
}
20
21
LFS64(open);