xref: /haiku/src/system/libroot/posix/unistd/access.c (revision ed24eb5ff12640d052171c6a7feba37fab8a75d1)
1 /*
2  * Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <errno.h>
8 #include <unistd.h>
9 
10 #include <errno_private.h>
11 #include <syscalls.h>
12 #include <syscall_utils.h>
13 
14 
15 int
16 access(const char* path, int accessMode)
17 {
18 	status_t status = _kern_access(-1, path, accessMode, false);
19 
20 	RETURN_AND_SET_ERRNO(status);
21 }
22 
23 
24 int
25 faccessat(int fd, const char* path, int accessMode, int flag)
26 {
27 	status_t status = _kern_access(fd, path, accessMode,
28 		(flag & AT_EACCESS) != 0);
29 
30 	RETURN_AND_SET_ERRNO(status);
31 }
32