libc: add headers and definitions required by libgcc
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#ifndef FCNTL_H_
|
||||
#define FCNTL_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define O_RDONLY 0x0000 /* open for reading only */
|
||||
#define O_WRONLY 0x0001 /* open for writing only */
|
||||
#define O_RDWR 0x0002 /* open for reading and writing */
|
||||
@@ -50,4 +52,47 @@
|
||||
#define AT_SYMLINK_NOFOLLOW_ANY \
|
||||
0x0800 /* Path should not contain any symlinks */
|
||||
|
||||
#define S_IRWXU 00700
|
||||
#define S_IRUSR 00400
|
||||
#define S_IWUSR 00200
|
||||
#define S_IXUSR 00100
|
||||
#define S_IRWXG 00070
|
||||
#define S_IRGRP 00040
|
||||
#define S_IWGRP 00020
|
||||
#define S_IXGRP 00010
|
||||
#define S_IRWXO 00007
|
||||
#define S_IROTH 00004
|
||||
#define S_IWOTH 00002
|
||||
#define S_IXOTH 00001
|
||||
#define S_ISUID 0004000
|
||||
#define S_ISGID 0002000
|
||||
#define S_ISVTX 0001000
|
||||
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
#define F_OK 0
|
||||
|
||||
#define F_RDLCK 0
|
||||
#define F_WRLCK 1
|
||||
#define F_SETLKW 7
|
||||
|
||||
struct flock {
|
||||
short l_type;
|
||||
short l_whence;
|
||||
off_t l_start;
|
||||
off_t l_len;
|
||||
pid_t l_pid;
|
||||
};
|
||||
|
||||
struct flock64 {
|
||||
short l_type;
|
||||
short l_whence;
|
||||
off_t l_start;
|
||||
off_t l_len;
|
||||
pid_t l_pid;
|
||||
};
|
||||
|
||||
extern int fcntl(int fd, int op, ...);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,7 @@ extern int printf(const char *format, ...);
|
||||
extern int vprintf(const char *format, va_list arg);
|
||||
extern int fprintf(FILE *stream, const char *format, ...);
|
||||
extern int vfprintf(FILE *stream, const char *format, va_list arg);
|
||||
extern int sprintf(char *buffer, const char *format, ...);
|
||||
extern int snprintf(char *buffer, size_t count, const char *format, ...);
|
||||
extern int vsnprintf(
|
||||
char *buffer,
|
||||
@@ -34,6 +35,8 @@ extern int vsnprintf(
|
||||
va_list va);
|
||||
|
||||
extern FILE *fopen(const char *path, const char *mode);
|
||||
extern FILE *fdopen(int fildes, const char *mode);
|
||||
|
||||
extern int fclose(FILE *stream);
|
||||
|
||||
extern int feof(FILE *stream);
|
||||
@@ -60,6 +63,7 @@ extern int fputs(const char *restrict str, FILE *restrict stream);
|
||||
|
||||
extern long ftell(FILE *stream);
|
||||
extern int fseek(FILE *stream, long offset, int origin);
|
||||
extern int fflush(FILE *stream);
|
||||
|
||||
extern int sscanf(
|
||||
const char *restrict buffer,
|
||||
|
||||
@@ -8,6 +8,11 @@ extern void abort(void);
|
||||
extern void exit(int result);
|
||||
extern int atexit(void (*func)(void));
|
||||
|
||||
extern int abs(int v);
|
||||
extern int atoi(const char *str);
|
||||
|
||||
extern char *getenv(const char *name);
|
||||
|
||||
extern void *malloc(size_t count);
|
||||
extern void *calloc(size_t count, size_t size);
|
||||
extern void *realloc(void *p, size_t count);
|
||||
|
||||
@@ -10,6 +10,7 @@ extern size_t strlen(const char *s);
|
||||
|
||||
extern size_t strcspn(const char *dest, const char *src);
|
||||
|
||||
extern char *strcat(char *dest, const char *src);
|
||||
extern char *strchr(const char *str, int c);
|
||||
extern char *strrchr(const char *str, int ch);
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SYS_STAT_H_
|
||||
#define SYS_STAT_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
extern int mkdir(const char *path, mode_t mode);
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,7 @@
|
||||
#define SEEK_END 2
|
||||
|
||||
typedef size_t ino_t;
|
||||
typedef long pid_t;
|
||||
typedef int pid_t;
|
||||
typedef long mode_t;
|
||||
|
||||
struct dentry {
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
extern int open(const char *path, int flags);
|
||||
extern int open(const char *path, int flags, ...);
|
||||
extern int close(int fd);
|
||||
|
||||
extern int read(int fd, void *buf, size_t count);
|
||||
extern int write(int fd, const void *buf, size_t count);
|
||||
|
||||
extern int access(const char *path, int mode);
|
||||
|
||||
extern off_t lseek(int fd, off_t offset, int whence);
|
||||
|
||||
extern long getdents(int fd, struct dentry *dirp, unsigned int count);
|
||||
@@ -20,7 +22,11 @@ extern int execl(const char *path, const char *arg, ...);
|
||||
extern int execlp(const char *file, const char *arg, ...);
|
||||
extern int execle(const char *path, const char *arg, ...);
|
||||
extern int execv(const char *path, char *const argv[]);
|
||||
extern int execve(const char *path, char *const argv[], char *const envp[]);
|
||||
extern int execvp(const char *file, char *const argv[]);
|
||||
extern int execvpe(const char *file, char *const argv[], char *const envp[]);
|
||||
|
||||
extern pid_t getpid(void);
|
||||
extern pid_t getppid(void);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user