Luna/libc/include/unistd.h
apio 770286a19d
All checks were successful
continuous-integration/drone/push Build is passing
kernel+libc: Implement fcntl() for F_DUPFD and F_DUPFD_CLOEXEC
2023-03-24 21:33:20 +01:00

66 lines
1.5 KiB
C

/* unistd.h: POSIX constants and functions. */
#ifndef _UNISTD_H
#define _UNISTD_H
#define __need_NULL
#include <stddef.h>
#include <bits/seek.h>
#include <stdint.h>
#include <sys/types.h>
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#ifdef __cplusplus
extern "C"
{
#endif
/* Create a new process that is a clone of the current one. */
pid_t fork(void);
/* Return the current process' process ID. */
pid_t getpid(void);
/* Return the current process' parent process ID. */
pid_t getppid(void);
/* Replace the current process with another one. On success, does not return. */
int execv(const char* path, char* const* argv);
int execve(const char*, char* const*, char* const*);
int execvp(const char*, char* const*);
/* Call the operating system kernel for a specific service. */
long syscall(long num, ...);
/* Sleep for X microseconds. */
int usleep(useconds_t us);
/* Sleep for X seconds. */
unsigned long sleep(unsigned long seconds);
/* Close a file descriptor. */
int close(int fd);
/* Read bytes from a file descriptor. */
ssize_t read(int fd, void* buf, size_t size);
/* Write bytes to a file descriptor. */
ssize_t write(int fd, const void* buf, size_t size);
/* Modify a file descriptor's offset. */
off_t lseek(int fd, off_t offset, int whence);
/* Duplicate a file descriptor. */
int dup(int fd);
#ifdef __cplusplus
}
#endif
#endif