2018-10-22 14:57:25 +03:00
|
|
|
#pragma once
|
|
|
|
|
2018-10-31 04:09:11 +03:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <sys/types.h>
|
2018-11-06 17:59:57 +03:00
|
|
|
#include <limits.h>
|
2019-02-26 14:57:02 +03:00
|
|
|
#include <errno.h>
|
2018-10-22 14:57:25 +03:00
|
|
|
|
2018-10-31 04:09:11 +03:00
|
|
|
__BEGIN_DECLS
|
2018-10-22 14:57:25 +03:00
|
|
|
|
2019-02-23 19:24:50 +03:00
|
|
|
#define HZ 1000
|
2019-02-26 14:57:02 +03:00
|
|
|
#define STDIN_FILENO 0
|
|
|
|
#define STDOUT_FILENO 1
|
|
|
|
#define STDERR_FILENO 2
|
2019-02-23 19:24:50 +03:00
|
|
|
|
2018-10-31 19:50:43 +03:00
|
|
|
extern char** environ;
|
|
|
|
|
2019-03-24 00:59:08 +03:00
|
|
|
int create_thread(int(*)(void*), void*);
|
2019-03-08 14:22:55 +03:00
|
|
|
int create_shared_buffer(pid_t peer_pid, int, void** buffer);
|
2019-02-16 14:13:43 +03:00
|
|
|
void* get_shared_buffer(int shared_buffer_id);
|
|
|
|
int release_shared_buffer(int shared_buffer_id);
|
2019-03-08 14:22:55 +03:00
|
|
|
int seal_shared_buffer(int shared_buffer_id);
|
|
|
|
int get_shared_buffer_size(int shared_buffer_id);
|
2019-01-25 04:09:29 +03:00
|
|
|
int read_tsc(unsigned* lsw, unsigned* msw);
|
2018-10-31 21:49:22 +03:00
|
|
|
inline int getpagesize() { return 4096; }
|
2018-11-02 22:41:58 +03:00
|
|
|
pid_t fork();
|
2019-03-14 17:18:15 +03:00
|
|
|
int execv(const char* path, char* const argv[]);
|
2019-01-23 19:03:14 +03:00
|
|
|
int execve(const char* filename, char* const argv[], char* const envp[]);
|
|
|
|
int execvp(const char* filename, char* const argv[]);
|
2019-02-03 06:32:31 +03:00
|
|
|
int execl(const char* filename, const char* arg, ...);
|
2018-12-20 02:39:29 +03:00
|
|
|
void sync();
|
2018-11-17 17:56:09 +03:00
|
|
|
void _exit(int status);
|
2018-11-02 14:56:51 +03: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 17:04:19 +03:00
|
|
|
uid_t geteuid();
|
|
|
|
gid_t getegid();
|
2018-10-22 14:57:25 +03:00
|
|
|
uid_t getuid();
|
|
|
|
gid_t getgid();
|
|
|
|
pid_t getpid();
|
2019-02-26 16:05:28 +03:00
|
|
|
pid_t getppid();
|
2018-11-07 03:38:51 +03:00
|
|
|
int getgroups(int size, gid_t list[]);
|
|
|
|
int setgroups(size_t, const gid_t*);
|
2019-02-22 01:35:07 +03:00
|
|
|
int setuid(uid_t);
|
|
|
|
int setgid(gid_t);
|
2018-11-02 15:14:25 +03:00
|
|
|
pid_t tcgetpgrp(int fd);
|
|
|
|
int tcsetpgrp(int fd, pid_t pgid);
|
2018-11-05 18:40:48 +03:00
|
|
|
int open(const char* path, int options, ...);
|
2018-10-23 11:12:50 +03:00
|
|
|
ssize_t read(int fd, void* buf, size_t count);
|
2018-10-30 17:33:37 +03:00
|
|
|
ssize_t write(int fd, const void* buf, size_t count);
|
2018-10-23 11:12:50 +03:00
|
|
|
int close(int fd);
|
2018-10-27 02:24:22 +03:00
|
|
|
pid_t waitpid(pid_t, int* wstatus, int options);
|
2018-10-26 15:24:11 +03:00
|
|
|
int chdir(const char* path);
|
2018-10-24 15:28:22 +03:00
|
|
|
char* getcwd(char* buffer, size_t size);
|
2018-11-06 17:59:57 +03:00
|
|
|
char* getwd(char* buffer);
|
2018-11-11 02:20:53 +03:00
|
|
|
int fstat(int fd, struct stat* statbuf);
|
2018-10-31 04:09:11 +03:00
|
|
|
int lstat(const char* path, struct stat* statbuf);
|
2018-10-31 12:14:56 +03:00
|
|
|
int stat(const char* path, struct stat* statbuf);
|
2018-10-25 14:53:49 +03:00
|
|
|
int sleep(unsigned seconds);
|
2019-02-03 18:11:28 +03:00
|
|
|
int usleep(useconds_t);
|
2018-10-26 10:54:29 +03:00
|
|
|
int gethostname(char*, size_t);
|
2018-10-28 16:11:51 +03:00
|
|
|
ssize_t readlink(const char* path, char* buffer, size_t);
|
2018-10-31 00:03:02 +03:00
|
|
|
char* ttyname(int fd);
|
|
|
|
int ttyname_r(int fd, char* buffer, size_t);
|
2018-10-31 19:50:43 +03:00
|
|
|
off_t lseek(int fd, off_t, int whence);
|
2018-11-05 18:40:48 +03:00
|
|
|
int link(const char* oldpath, const char* newpath);
|
|
|
|
int unlink(const char* pathname);
|
2019-03-02 03:50:34 +03:00
|
|
|
int symlink(const char* target, const char* linkpath);
|
2019-01-28 06:16:01 +03:00
|
|
|
int rmdir(const char* pathname);
|
2018-11-05 21:01:22 +03:00
|
|
|
int getdtablesize();
|
|
|
|
int dup(int old_fd);
|
|
|
|
int dup2(int old_fd, int new_fd);
|
2018-11-11 02:20:53 +03:00
|
|
|
int pipe(int pipefd[2]);
|
|
|
|
unsigned int alarm(unsigned int seconds);
|
|
|
|
int access(const char* pathname, int mode);
|
2018-11-11 12:11:09 +03:00
|
|
|
int isatty(int fd);
|
2018-11-17 02:11:08 +03:00
|
|
|
int mknod(const char* pathname, mode_t, dev_t);
|
2018-11-17 17:56:09 +03:00
|
|
|
long fpathconf(int fd, int name);
|
|
|
|
long pathconf(const char *path, int name);
|
2019-02-26 14:57:02 +03:00
|
|
|
char* getlogin();
|
2019-02-27 14:32:53 +03:00
|
|
|
int chown(const char* pathname, uid_t, gid_t);
|
2018-11-17 17:56:09 +03:00
|
|
|
|
|
|
|
enum {
|
|
|
|
_PC_NAME_MAX,
|
|
|
|
};
|
2018-10-26 10:54:29 +03:00
|
|
|
|
2018-10-27 02:24:22 +03:00
|
|
|
#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
|
|
|
|
#define WTERMSIG(status) ((status) & 0x7f)
|
|
|
|
#define WIFEXITED(status) (WTERMSIG(status) == 0)
|
2018-11-01 03:04:02 +03:00
|
|
|
#define WIFSIGNALED(status) (((char) (((status) & 0x7f) + 1) >> 1) > 0)
|
2018-10-27 02:24:22 +03:00
|
|
|
|
2018-10-26 10:54:29 +03:00
|
|
|
#define HOST_NAME_MAX 64
|
2018-10-24 14:19:36 +03:00
|
|
|
|
2019-02-08 04:38:21 +03:00
|
|
|
#define R_OK 4
|
|
|
|
#define W_OK 2
|
|
|
|
#define X_OK 1
|
|
|
|
#define F_OK 0
|
2018-10-24 14:19:36 +03:00
|
|
|
|
2018-10-31 04:09:11 +03:00
|
|
|
__END_DECLS
|
|
|
|
|