2 * Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
5 * Copyright 2001, Manuel J. Petit. All rights reserved.
6 * Distributed under the terms of the NewOS License.
16 #include <errno_private.h>
18 #include <syscall_utils.h>
23 creat(const char *path
, mode_t mode
)
25 RETURN_AND_SET_ERRNO_TEST_CANCEL(
26 _kern_open(-1, path
, O_CREAT
| O_TRUNC
| O_WRONLY
, mode
& ~__gUmask
));
27 // adapt the permissions as required by POSIX
32 open(const char *path
, int openMode
, ...)
35 if (openMode
& O_CREAT
) {
37 va_start(args
, openMode
);
38 perms
= va_arg(args
, int) & ~__gUmask
;
39 // adapt the permissions as required by POSIX
43 RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_open(-1, path
, openMode
, perms
));
48 openat(int fd
, const char *path
, int openMode
, ...)
51 if (openMode
& O_CREAT
) {
53 va_start(args
, openMode
);
54 perms
= va_arg(args
, int) & ~__gUmask
;
55 // adapt the permissions as required by POSIX
59 RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_open(fd
, path
, openMode
, perms
));
64 fcntl(int fd
, int op
, ...)
68 size_t argument
= va_arg(args
, size_t);
71 status_t error
= _kern_fcntl(fd
, op
, argument
);
76 RETURN_AND_SET_ERRNO(error
);