2018-10-22 11:57:25 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-05-28 09:53:16 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <limits.h>
|
2018-10-31 01:09:11 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <sys/types.h>
|
2018-10-22 11:57:25 +00:00
|
|
|
|
2018-10-31 01:09:11 +00:00
|
|
|
__BEGIN_DECLS
|
2018-10-22 11:57:25 +00:00
|
|
|
|
2019-02-23 16:24:50 +00:00
|
|
|
#define HZ 1000
|
2019-02-26 11:57:02 +00:00
|
|
|
#define STDIN_FILENO 0
|
|
|
|
#define STDOUT_FILENO 1
|
|
|
|
#define STDERR_FILENO 2
|
2019-02-23 16:24:50 +00:00
|
|
|
|
2018-10-31 16:50:43 +00:00
|
|
|
extern char** environ;
|
|
|
|
|
2019-05-19 17:54:20 +00:00
|
|
|
int fsync(int fd);
|
2019-05-17 12:32:53 +00:00
|
|
|
void sysbeep();
|
2019-04-22 16:44:45 +00:00
|
|
|
int systrace(pid_t);
|
2019-03-25 12:03:49 +00:00
|
|
|
int gettid();
|
|
|
|
int donate(int tid);
|
2019-05-28 09:53:16 +00:00
|
|
|
int create_thread(int (*)(void*), void*);
|
2019-04-29 13:17:20 +00:00
|
|
|
void exit_thread(int);
|
2019-03-08 11:22:55 +00:00
|
|
|
int create_shared_buffer(pid_t peer_pid, int, void** buffer);
|
2019-02-16 11:13:43 +00:00
|
|
|
void* get_shared_buffer(int shared_buffer_id);
|
|
|
|
int release_shared_buffer(int shared_buffer_id);
|
2019-03-08 11:22:55 +00:00
|
|
|
int seal_shared_buffer(int shared_buffer_id);
|
|
|
|
int get_shared_buffer_size(int shared_buffer_id);
|
2019-01-25 01:09:29 +00:00
|
|
|
int read_tsc(unsigned* lsw, unsigned* msw);
|
2018-10-31 18:49:22 +00:00
|
|
|
inline int getpagesize() { return 4096; }
|
2018-11-02 19:41:58 +00:00
|
|
|
pid_t fork();
|
2019-03-14 14:18:15 +00:00
|
|
|
int execv(const char* path, char* const argv[]);
|
2019-01-23 16:03:14 +00:00
|
|
|
int execve(const char* filename, char* const argv[], char* const envp[]);
|
2019-04-26 01:16:26 +00:00
|
|
|
int execvpe(const char* filename, char* const argv[], char* const envp[]);
|
2019-01-23 16:03:14 +00:00
|
|
|
int execvp(const char* filename, char* const argv[]);
|
2019-02-03 03:32:31 +00:00
|
|
|
int execl(const char* filename, const char* arg, ...);
|
2018-12-19 23:39:29 +00:00
|
|
|
void sync();
|
2018-11-17 14:56:09 +00:00
|
|
|
void _exit(int status);
|
2018-11-02 11:56:51 +00:00
|
|
|
pid_t getsid(pid_t);
|
|
|
|
pid_t setsid();
|
|
|
|
int setpgid(pid_t pid, pid_t pgid);
|
|
|
|
pid_t getpgid(pid_t);
|
|
|
|
pid_t getpgrp();
|
2018-11-05 14:04:19 +00:00
|
|
|
uid_t geteuid();
|
|
|
|
gid_t getegid();
|
2018-10-22 11:57:25 +00:00
|
|
|
uid_t getuid();
|
|
|
|
gid_t getgid();
|
|
|
|
pid_t getpid();
|
2019-02-26 13:05:28 +00:00
|
|
|
pid_t getppid();
|
2018-11-07 00:38:51 +00:00
|
|
|
int getgroups(int size, gid_t list[]);
|
|
|
|
int setgroups(size_t, const gid_t*);
|
2019-02-21 22:35:07 +00:00
|
|
|
int setuid(uid_t);
|
|
|
|
int setgid(gid_t);
|
2018-11-02 12:14:25 +00:00
|
|
|
pid_t tcgetpgrp(int fd);
|
|
|
|
int tcsetpgrp(int fd, pid_t pgid);
|
2019-03-27 00:39:13 +00:00
|
|
|
int creat(const char* path, mode_t);
|
2018-11-05 15:40:48 +00:00
|
|
|
int open(const char* path, int options, ...);
|
2018-10-23 08:12:50 +00:00
|
|
|
ssize_t read(int fd, void* buf, size_t count);
|
2018-10-30 14:33:37 +00:00
|
|
|
ssize_t write(int fd, const void* buf, size_t count);
|
2018-10-23 08:12:50 +00:00
|
|
|
int close(int fd);
|
2018-10-26 23:24:22 +00:00
|
|
|
pid_t waitpid(pid_t, int* wstatus, int options);
|
2018-10-26 12:24:11 +00:00
|
|
|
int chdir(const char* path);
|
2018-10-24 12:28:22 +00:00
|
|
|
char* getcwd(char* buffer, size_t size);
|
2018-11-06 14:59:57 +00:00
|
|
|
char* getwd(char* buffer);
|
2018-11-10 23:20:53 +00:00
|
|
|
int fstat(int fd, struct stat* statbuf);
|
2018-10-31 01:09:11 +00:00
|
|
|
int lstat(const char* path, struct stat* statbuf);
|
2018-10-31 09:14:56 +00:00
|
|
|
int stat(const char* path, struct stat* statbuf);
|
2018-10-25 11:53:49 +00:00
|
|
|
int sleep(unsigned seconds);
|
2019-02-03 15:11:28 +00:00
|
|
|
int usleep(useconds_t);
|
2018-10-26 07:54:29 +00:00
|
|
|
int gethostname(char*, size_t);
|
2018-10-28 13:11:51 +00:00
|
|
|
ssize_t readlink(const char* path, char* buffer, size_t);
|
2018-10-30 21:03:02 +00:00
|
|
|
char* ttyname(int fd);
|
|
|
|
int ttyname_r(int fd, char* buffer, size_t);
|
2018-10-31 16:50:43 +00:00
|
|
|
off_t lseek(int fd, off_t, int whence);
|
2018-11-05 15:40:48 +00:00
|
|
|
int link(const char* oldpath, const char* newpath);
|
|
|
|
int unlink(const char* pathname);
|
2019-03-02 00:50:34 +00:00
|
|
|
int symlink(const char* target, const char* linkpath);
|
2019-01-28 03:16:01 +00:00
|
|
|
int rmdir(const char* pathname);
|
2018-11-05 18:01:22 +00:00
|
|
|
int getdtablesize();
|
|
|
|
int dup(int old_fd);
|
|
|
|
int dup2(int old_fd, int new_fd);
|
2018-11-10 23:20:53 +00:00
|
|
|
int pipe(int pipefd[2]);
|
|
|
|
unsigned int alarm(unsigned int seconds);
|
|
|
|
int access(const char* pathname, int mode);
|
2018-11-11 09:11:09 +00:00
|
|
|
int isatty(int fd);
|
2018-11-16 23:11:08 +00:00
|
|
|
int mknod(const char* pathname, mode_t, dev_t);
|
2018-11-17 14:56:09 +00:00
|
|
|
long fpathconf(int fd, int name);
|
2019-05-28 09:53:16 +00:00
|
|
|
long pathconf(const char* path, int name);
|
2019-02-26 11:57:02 +00:00
|
|
|
char* getlogin();
|
2019-02-27 11:32:53 +00:00
|
|
|
int chown(const char* pathname, uid_t, gid_t);
|
2019-06-01 18:31:36 +00:00
|
|
|
int fchown(int fd, uid_t, gid_t);
|
2019-03-23 23:53:39 +00:00
|
|
|
int ftruncate(int fd, off_t length);
|
2018-11-17 14:56:09 +00:00
|
|
|
|
2019-06-07 15:13:23 +00:00
|
|
|
enum {
|
2018-11-17 14:56:09 +00:00
|
|
|
_PC_NAME_MAX,
|
|
|
|
};
|
2018-10-26 07:54:29 +00:00
|
|
|
|
|
|
|
#define HOST_NAME_MAX 64
|
2018-10-24 11:19:36 +00:00
|
|
|
|
2019-02-08 01:38:21 +00:00
|
|
|
#define R_OK 4
|
|
|
|
#define W_OK 2
|
|
|
|
#define X_OK 1
|
|
|
|
#define F_OK 0
|
2018-10-24 11:19:36 +00:00
|
|
|
|
2019-05-29 21:20:51 +00:00
|
|
|
/*
|
|
|
|
* We aren't fully compliant (don't support policies, and don't have a wide
|
|
|
|
* range of values), but we do have process priorities.
|
|
|
|
*/
|
|
|
|
#define _POSIX_PRIORITY_SCHEDULING
|
|
|
|
|
2018-10-31 01:09:11 +00:00
|
|
|
__END_DECLS
|