1 /*
2  * Copyright (c) 2006-2022, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2020-12-16     Meco Man     add usleep
9  * 2021-09-11     Meco Man     move functions from dfs_posix.h to unistd.h
10  */
11 
12 #ifndef __SYS_UNISTD_H__
13 #define __SYS_UNISTD_H__
14 
15 #include <stddef.h>
16 #include <sys/types.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #define _POSIX_VDISABLE 0
23 
24 #define STDIN_FILENO    0       /* standard input file descriptor */
25 #define STDOUT_FILENO   1       /* standard output file descriptor */
26 #define STDERR_FILENO   2       /* standard error file descriptor */
27 
28 #define F_OK 0
29 #define X_OK 1
30 #define W_OK 2
31 #define R_OK 4
32 
33 unsigned alarm(unsigned __secs);
34 ssize_t read(int fd, void *buf, size_t len);
35 ssize_t write(int fd, const void *buf, size_t len);
36 off_t lseek(int fd, off_t offset, int whence);
37 int pause(void);
38 int fsync(int fildes);
39 long sysconf(int __name);
40 int unlink(const char *pathname);
41 int close(int d);
42 int ftruncate(int fd, off_t length);
43 int rmdir(const char *path);
44 int chdir(const char *path);
45 char *getcwd(char *buf, size_t size);
46 int access(const char *path, int amode);
47 int pipe(int fildes[2]);
48 int isatty(int fd);
49 char *ttyname(int desc);
50 unsigned int sleep(unsigned int seconds);
51 int usleep(useconds_t usec);
52 pid_t gettid(void);
53 pid_t getpid(void);
54 pid_t getppid(void);
55 uid_t getuid(void);
56 uid_t geteuid(void);
57 gid_t getgid(void);
58 gid_t getegid(void);
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 #endif /* _SYS_UNISTD_H */
65