2007-04-27 22:42:41 +00:00
|
|
|
#ifndef _UNISTD_H
|
|
|
|
#define _UNISTD_H
|
|
|
|
|
2018-06-23 09:46:55 +00:00
|
|
|
/*
|
|
|
|
* Generic Posix prototypes used by the rest of the libc. Plats don't have to
|
|
|
|
* implement these if they don't care about the functionality, but if they do,
|
|
|
|
* they must conform to these prototypes.
|
|
|
|
*/
|
2007-04-27 22:42:41 +00:00
|
|
|
|
2018-06-23 09:46:55 +00:00
|
|
|
#include <ack/config.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
2007-04-27 22:42:41 +00:00
|
|
|
|
2018-06-23 09:46:55 +00:00
|
|
|
#if ACKCONF_WANT_STANDARD_O
|
2018-06-23 10:13:33 +00:00
|
|
|
/* A standard set of flags for read/write/creat and friends for platforms
|
|
|
|
* where these aren't determined by the operating system. */
|
2007-04-27 22:42:41 +00:00
|
|
|
|
2018-06-23 10:13:33 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
O_ACCMODE = 0x3,
|
|
|
|
|
|
|
|
O_RDONLY = 0,
|
|
|
|
O_WRONLY = 1,
|
|
|
|
O_RDWR = 2,
|
|
|
|
|
|
|
|
O_CREAT = 0100,
|
|
|
|
O_TRUNC = 01000,
|
|
|
|
O_APPEND = 02000,
|
|
|
|
O_NONBLOCK = 04000
|
|
|
|
};
|
|
|
|
#else
|
|
|
|
#include <ack/fcntl.h>
|
2018-06-23 09:46:55 +00:00
|
|
|
#endif
|
2007-04-27 22:42:41 +00:00
|
|
|
|
2018-06-23 09:46:55 +00:00
|
|
|
#if ACKCONF_WANT_STANDARD_SIGNALS
|
2018-06-23 10:13:33 +00:00
|
|
|
/* A standard set of definitions for signal handling for platforms where these
|
|
|
|
* aren't determined by the operating system. */
|
2007-04-27 22:42:41 +00:00
|
|
|
|
2018-06-23 10:13:33 +00:00
|
|
|
typedef int sig_atomic_t;
|
2007-04-27 22:42:41 +00:00
|
|
|
|
2018-06-23 10:13:33 +00:00
|
|
|
#define SIG_ERR ((sighandler_t) -1) /* Error return. */
|
|
|
|
#define SIG_DFL ((sighandler_t) 0) /* Default action. */
|
|
|
|
#define SIG_IGN ((sighandler_t) 1) /* Ignore signal. */
|
2007-04-27 22:42:41 +00:00
|
|
|
|
2018-06-23 10:13:33 +00:00
|
|
|
#define SIGABRT 6 /* Abort (ANSI) */
|
|
|
|
#define SIGILL 11 /* Illegal instruction */
|
2018-06-23 09:46:55 +00:00
|
|
|
|
2018-06-23 10:13:33 +00:00
|
|
|
#define _NSIG 16 /* Biggest signal number + 1
|
|
|
|
(not including real-time signals). */
|
|
|
|
typedef uint16_t sigset_t;
|
2018-06-23 10:41:54 +00:00
|
|
|
|
|
|
|
struct sigaction;
|
2018-06-23 10:13:33 +00:00
|
|
|
#else
|
|
|
|
#include <ack/signal.h>
|
2018-06-23 09:46:55 +00:00
|
|
|
#endif
|
2018-06-23 10:55:59 +00:00
|
|
|
typedef void (*sighandler_t)(int);
|
2018-06-23 09:46:55 +00:00
|
|
|
|
2018-06-23 10:13:33 +00:00
|
|
|
/* Time handling. */
|
|
|
|
|
|
|
|
struct timeval
|
|
|
|
{
|
|
|
|
time_t tv_sec;
|
|
|
|
suseconds_t tv_usec;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct timezone
|
|
|
|
{
|
|
|
|
int tz_minuteswest;
|
|
|
|
int tz_dsttime;
|
|
|
|
}; /* obsolete, unused */
|
|
|
|
|
2018-06-23 09:46:55 +00:00
|
|
|
/* Special variables */
|
|
|
|
|
|
|
|
extern char** environ;
|
|
|
|
|
|
|
|
/* Implemented system calls */
|
|
|
|
|
|
|
|
extern int brk(void* ptr);
|
|
|
|
extern int close(int d);
|
|
|
|
extern int creat(const char* path, mode_t mode);
|
|
|
|
extern int execve(const char *path, char *const argv[], char *const envp[]);
|
2018-06-23 10:13:33 +00:00
|
|
|
extern int fcntl(int fd, int op, ...);
|
|
|
|
extern int gettimeofday(struct timeval* tv, struct timezone* tz);
|
2018-06-23 09:46:55 +00:00
|
|
|
extern int isatty(int d);
|
|
|
|
extern int isatty(int d);
|
|
|
|
extern int kill(pid_t old, int sig);
|
|
|
|
extern int open(const char* path, int access, ...);
|
2007-04-27 22:42:41 +00:00
|
|
|
extern int raise(int signum);
|
2018-06-23 10:13:33 +00:00
|
|
|
extern int settimeofday(const struct timeval* tv, const struct timezone* tz);
|
2018-06-23 10:41:54 +00:00
|
|
|
extern int sigaction(int, const struct sigaction *, struct sigaction *);
|
2018-06-23 09:46:55 +00:00
|
|
|
extern int sigprocmask(int, const sigset_t *, sigset_t *);
|
|
|
|
extern int unlink(const char* path);
|
|
|
|
extern off_t lseek(int fildes, off_t offset, int whence);
|
|
|
|
extern pid_t getpid(void);
|
|
|
|
extern sighandler_t signal(int signum, sighandler_t handler);
|
|
|
|
extern ssize_t read(int fd, void* buffer, size_t count);
|
|
|
|
extern ssize_t write(int fd, void* buffer, size_t count);
|
|
|
|
extern void _exit(int);
|
|
|
|
extern void* sbrk(int increment);
|
2018-06-23 10:13:33 +00:00
|
|
|
|
2007-04-27 22:42:41 +00:00
|
|
|
|
|
|
|
#endif
|