2023-01-06 20:02:07 +01:00
|
|
|
/* unistd.h: POSIX constants and functions. */
|
|
|
|
|
2023-01-06 13:31:14 +01:00
|
|
|
#ifndef _UNISTD_H
|
|
|
|
#define _UNISTD_H
|
|
|
|
|
2023-01-06 20:02:07 +01:00
|
|
|
#define __need_NULL
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2023-03-12 13:15:24 +01:00
|
|
|
#include <bits/seek.h>
|
2023-01-06 17:35:07 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2023-03-19 19:19:20 +01:00
|
|
|
#define STDIN_FILENO 0
|
|
|
|
#define STDOUT_FILENO 1
|
|
|
|
#define STDERR_FILENO 2
|
2023-03-18 19:23:18 +01:00
|
|
|
|
2023-01-06 13:31:14 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
2023-03-18 23:58:56 +01:00
|
|
|
/* Create a new process that is a clone of the current one. */
|
|
|
|
pid_t fork(void);
|
2023-03-11 22:19:58 +01:00
|
|
|
|
2023-03-12 11:15:45 +01:00
|
|
|
/* Return the current process' process ID. */
|
2023-03-11 22:19:58 +01:00
|
|
|
pid_t getpid(void);
|
2023-01-06 17:35:07 +01:00
|
|
|
|
2023-03-24 17:39:55 +01:00
|
|
|
/* Return the current process' parent process ID. */
|
|
|
|
pid_t getppid(void);
|
|
|
|
|
2023-03-18 22:31:16 +01:00
|
|
|
/* Replace the current process with another one. On success, does not return. */
|
|
|
|
int execv(const char* path, char* const* argv);
|
|
|
|
|
2023-01-06 17:35:07 +01:00
|
|
|
int execve(const char*, char* const*, char* const*);
|
|
|
|
int execvp(const char*, char* const*);
|
|
|
|
|
2023-03-12 11:15:45 +01:00
|
|
|
/* Call the operating system kernel for a specific service. */
|
2023-01-06 20:02:07 +01:00
|
|
|
long syscall(long num, ...);
|
2023-01-06 13:31:14 +01:00
|
|
|
|
2023-03-12 11:15:45 +01:00
|
|
|
/* Sleep for X microseconds. */
|
2023-01-22 15:00:20 +01:00
|
|
|
int usleep(useconds_t us);
|
|
|
|
|
2023-03-12 11:15:45 +01:00
|
|
|
/* Sleep for X seconds. */
|
2023-01-22 15:00:20 +01:00
|
|
|
unsigned long sleep(unsigned long seconds);
|
|
|
|
|
2023-03-12 11:15:45 +01:00
|
|
|
/* Close a file descriptor. */
|
2023-03-11 17:45:20 +01:00
|
|
|
int close(int fd);
|
|
|
|
|
2023-03-12 11:15:45 +01:00
|
|
|
/* Read bytes from a file descriptor. */
|
2023-03-11 18:02:50 +01:00
|
|
|
ssize_t read(int fd, void* buf, size_t size);
|
|
|
|
|
2023-03-12 11:37:41 +01:00
|
|
|
/* Write bytes to a file descriptor. */
|
|
|
|
ssize_t write(int fd, const void* buf, size_t size);
|
|
|
|
|
2023-03-12 13:15:24 +01:00
|
|
|
/* Modify a file descriptor's offset. */
|
|
|
|
off_t lseek(int fd, off_t offset, int whence);
|
|
|
|
|
2023-01-06 13:31:14 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|