mirror of
https://github.com/Fennix-Project/Userspace.git
synced 2025-05-28 15:34:26 +00:00
Update libc
This commit is contained in:
parent
f01eed8dd2
commit
cf3a5599a4
6
libc/include/bits/types/sigset_t.h
Normal file
6
libc/include/bits/types/sigset_t.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef _BITS_TYPES_SIGSET_T_H
|
||||||
|
#define _BITS_TYPES_SIGSET_T_H
|
||||||
|
|
||||||
|
typedef unsigned long sigset_t;
|
||||||
|
|
||||||
|
#endif // !_BITS_TYPES_SIGSET_T_H
|
9
libc/include/bits/types/struct_sched_param.h
Normal file
9
libc/include/bits/types/struct_sched_param.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef _BITS_TYPES_STRUCT_SCHED_PARAM_T_H
|
||||||
|
#define _BITS_TYPES_STRUCT_SCHED_PARAM_T_H
|
||||||
|
|
||||||
|
struct sched_param
|
||||||
|
{
|
||||||
|
int sched_priority;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !_BITS_TYPES_STRUCT_SCHED_PARAM_T_H
|
14
libc/include/bits/waitstatus.h
Normal file
14
libc/include/bits/waitstatus.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef _BITS_WAITSTATUS_H
|
||||||
|
#define _BITS_WAITSTATUS_H
|
||||||
|
|
||||||
|
#define __W_CONTINUED 0xFFFF
|
||||||
|
|
||||||
|
#define __WEXITSTATUS(status) (((status)&0xFF00) >> 8)
|
||||||
|
#define __WTERMSIG(status) ((status)&0x7F)
|
||||||
|
#define __WSTOPSIG(status) __WEXITSTATUS(status)
|
||||||
|
#define __WIFEXITED(status) (__WTERMSIG(status) == 0)
|
||||||
|
#define __WIFSIGNALED(status) (((signed char)(((status)&0x7F) + 1) >> 1) > 0)
|
||||||
|
#define __WIFSTOPPED(status) (((status)&0xFF) == 0x7F)
|
||||||
|
#define __WIFCONTINUED(status) ((status) == __W_CONTINUED)
|
||||||
|
|
||||||
|
#endif
|
@ -35,6 +35,101 @@
|
|||||||
#define EPIPE 32 /* Broken pipe */
|
#define EPIPE 32 /* Broken pipe */
|
||||||
#define EDOM 33 /* Math argument out of domain of func */
|
#define EDOM 33 /* Math argument out of domain of func */
|
||||||
#define ERANGE 34 /* Math result not representable */
|
#define ERANGE 34 /* Math result not representable */
|
||||||
|
#define EDEADLK 35 /* Resource deadlock would occur */
|
||||||
|
#define ENAMETOOLONG 36 /* File name too long */
|
||||||
|
#define ENOLCK 37 /* No record locks available */
|
||||||
|
#define ENOSYS 38 /* Function not implemented */
|
||||||
|
#define ENOTEMPTY 39 /* Directory not empty */
|
||||||
|
#define ELOOP 40 /* Too many symbolic links encountered */
|
||||||
|
#define ENOMSG 42 /* No message of desired type */
|
||||||
|
#define EIDRM 43 /* Identifier removed */
|
||||||
|
#define ECHRNG 44 /* Channel number out of range */
|
||||||
|
#define EL2NSYNC 45 /* Level 2 not synchronized */
|
||||||
|
#define EL3HLT 46 /* Level 3 halted */
|
||||||
|
#define EL3RST 47 /* Level 3 reset */
|
||||||
|
#define ELNRNG 48 /* Link number out of range */
|
||||||
|
#define EUNATCH 49 /* Protocol driver not attached */
|
||||||
|
#define ENOCSI 50 /* No CSI structure available */
|
||||||
|
#define EL2HLT 51 /* Level 2 halted */
|
||||||
|
#define EBADE 52 /* Invalid exchange */
|
||||||
|
#define EBADR 53 /* Invalid request descriptor */
|
||||||
|
#define EXFULL 54 /* Exchange full */
|
||||||
|
#define ENOANO 55 /* No anode */
|
||||||
|
#define EBADRQC 56 /* Invalid request code */
|
||||||
|
#define EBADSLT 57 /* Invalid slot */
|
||||||
|
#define EBFONT 59 /* Bad font file format */
|
||||||
|
#define ENOSTR 60 /* Device not a stream */
|
||||||
|
#define ENODATA 61 /* No data available */
|
||||||
|
#define ETIME 62 /* Timer expired */
|
||||||
|
#define ENOSR 63 /* Out of streams resources */
|
||||||
|
#define ENONET 64 /* Machine is not on the network */
|
||||||
|
#define ENOPKG 65 /* Package not installed */
|
||||||
|
#define EREMOTE 66 /* Object is remote */
|
||||||
|
#define ENOLINK 67 /* Link has been severed */
|
||||||
|
#define EADV 68 /* Advertise error */
|
||||||
|
#define ESRMNT 69 /* Srmount error */
|
||||||
|
#define ECOMM 70 /* Communication error on send */
|
||||||
|
#define EPROTO 71 /* Protocol error */
|
||||||
|
#define EMULTIHOP 72 /* Multihop attempted */
|
||||||
|
#define EDOTDOT 73 /* RFS specific error */
|
||||||
|
#define EBADMSG 74 /* Not a data message */
|
||||||
|
#define EOVERFLOW 75 /* Value too large for defined data type */
|
||||||
|
#define ENOTUNIQ 76 /* Name not unique on network */
|
||||||
|
#define EBADFD 77 /* File descriptor in bad state */
|
||||||
|
#define EREMCHG 78 /* Remote address changed */
|
||||||
|
#define ELIBACC 79 /* Can not access a needed shared library */
|
||||||
|
#define ELIBBAD 80 /* Accessing a corrupted shared library */
|
||||||
|
#define ELIBSCN 81 /* .lib section in a.out corrupted */
|
||||||
|
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
|
||||||
|
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
|
||||||
|
#define EILSEQ 84 /* Illegal byte sequence */
|
||||||
|
#define ERESTART 85 /* Interrupted system call should be restarted */
|
||||||
|
#define ESTRPIPE 86 /* Streams pipe error */
|
||||||
|
#define EUSERS 87 /* Too many users */
|
||||||
|
#define ENOTSOCK 88 /* Socket operation on non-socket */
|
||||||
|
#define EDESTADDRREQ 89 /* Destination address required */
|
||||||
|
#define EMSGSIZE 90 /* Message too long */
|
||||||
|
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
|
||||||
|
#define ENOPROTOOPT 92 /* Protocol not available */
|
||||||
|
#define EPROTONOSUPPORT 93 /* Protocol not supported */
|
||||||
|
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
|
||||||
|
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||||
|
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||||
|
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
|
||||||
|
#define EADDRINUSE 98 /* Address already in use */
|
||||||
|
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
|
||||||
|
#define ENETDOWN 100 /* Network is down */
|
||||||
|
#define ENETUNREACH 101 /* Network is unreachable */
|
||||||
|
#define ENETRESET 102 /* Network dropped connection because of reset */
|
||||||
|
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||||
|
#define ECONNRESET 104 /* Connection reset by peer */
|
||||||
|
#define ENOBUFS 105 /* No buffer space available */
|
||||||
|
#define EISCONN 106 /* Transport endpoint is already connected */
|
||||||
|
#define ENOTCONN 107 /* Transport endpoint is not connected */
|
||||||
|
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
|
||||||
|
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
|
||||||
|
#define ETIMEDOUT 110 /* Connection timed out */
|
||||||
|
#define ECONNREFUSED 111 /* Connection refused */
|
||||||
|
#define EHOSTDOWN 112 /* Host is down */
|
||||||
|
#define EHOSTUNREACH 113 /* No route to host */
|
||||||
|
#define EALREADY 114 /* Operation already in progress */
|
||||||
|
#define EINPROGRESS 115 /* Operation now in progress */
|
||||||
|
#define ESTALE 116 /* Stale NFS file handle */
|
||||||
|
#define EUCLEAN 117 /* Structure needs cleaning */
|
||||||
|
#define ENOTNAM 118 /* Not a XENIX named type file */
|
||||||
|
#define ENAVAIL 119 /* No XENIX semaphores available */
|
||||||
|
#define EISNAM 120 /* Is a named type file */
|
||||||
|
#define EREMOTEIO 121 /* Remote I/O error */
|
||||||
|
#define EDQUOT 122 /* Quota exceeded */
|
||||||
|
#define ENOMEDIUM 123 /* No medium found */
|
||||||
|
#define EMEDIUMTYPE 124 /* Wrong medium type */
|
||||||
|
#define ECANCELED 125 /* Operation Canceled */
|
||||||
|
#define ENOKEY 126 /* Required key not available */
|
||||||
|
#define EKEYEXPIRED 127 /* Key has expired */
|
||||||
|
#define EKEYREVOKED 128 /* Key has been revoked */
|
||||||
|
#define EKEYREJECTED 129 /* Key was rejected by service */
|
||||||
|
#define EOWNERDEAD 130 /* Owner died */
|
||||||
|
#define ENOTRECOVERABLE 131 /* State not recoverable */
|
||||||
|
|
||||||
extern int *__errno_location(void) __attribute__((const));
|
extern int *__errno_location(void) __attribute__((const));
|
||||||
#define errno (*__errno_location())
|
#define errno (*__errno_location())
|
||||||
|
102
libc/include/signal.h
Normal file
102
libc/include/signal.h
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
#ifndef _SIGNAL_H
|
||||||
|
#define _SIGNAL_H
|
||||||
|
|
||||||
|
#include <bits/types/sigset_t.h>
|
||||||
|
|
||||||
|
/* https://www-uxsup.csx.cam.ac.uk/courses/moved.Building/signals.pdf */
|
||||||
|
/* https://man7.org/linux/man-pages/man7/signal.7.html */
|
||||||
|
|
||||||
|
/** @brief Hangup detected on controlling or death of controlling process */
|
||||||
|
#define SIGHUP 1
|
||||||
|
|
||||||
|
/** @brief Interrupt from keyboard */
|
||||||
|
#define SIGINT 2
|
||||||
|
|
||||||
|
/** @brief Quit from keyboard */
|
||||||
|
#define SIGQUIT 3
|
||||||
|
|
||||||
|
/** @brief Illegal Instruction */
|
||||||
|
#define SIGILL 4
|
||||||
|
|
||||||
|
/** @brief Trace/breakpoint trap */
|
||||||
|
#define SIGTRAP 5
|
||||||
|
|
||||||
|
/** @brief Abort signal from abort(3) */
|
||||||
|
#define SIGABRT 6
|
||||||
|
|
||||||
|
/** @brief Bus error (bad memory access) */
|
||||||
|
#define SIGBUS 7
|
||||||
|
|
||||||
|
/** @brief Floating point exception */
|
||||||
|
#define SIGFPE 8
|
||||||
|
|
||||||
|
/** @brief Kill signal */
|
||||||
|
#define SIGKILL 9
|
||||||
|
|
||||||
|
/** @brief User-defined signal 1 */
|
||||||
|
#define SIGUSR1 10
|
||||||
|
|
||||||
|
/** @brief Invalid memory reference */
|
||||||
|
#define SIGSEGV 11
|
||||||
|
|
||||||
|
/** @brief User-defined signal 2 */
|
||||||
|
#define SIGUSR2 12
|
||||||
|
|
||||||
|
/** @brief Broken pipe: write to pipe with no readers */
|
||||||
|
#define SIGPIPE 13
|
||||||
|
|
||||||
|
/** @brief Timer signal from alarm(2) */
|
||||||
|
#define SIGALRM 14
|
||||||
|
|
||||||
|
/** @brief Termination signal */
|
||||||
|
#define SIGTERM 15
|
||||||
|
|
||||||
|
/** @brief Stack fault on coprocessor (unused) */
|
||||||
|
#define SIGSTKFLT 16
|
||||||
|
|
||||||
|
/** @brief Child stopped or terminated */
|
||||||
|
#define SIGCHLD 17
|
||||||
|
|
||||||
|
/** @brief Continue if stopped */
|
||||||
|
#define SIGCONT 18
|
||||||
|
|
||||||
|
/** @brief Stop process */
|
||||||
|
#define SIGSTOP 19
|
||||||
|
|
||||||
|
/** @brief Stop typed at terminal */
|
||||||
|
#define SIGTSTP 20
|
||||||
|
|
||||||
|
/** @brief Terminal input for background process */
|
||||||
|
#define SIGTTIN 21
|
||||||
|
|
||||||
|
/** @brief Terminal output for background process */
|
||||||
|
#define SIGTTOU 22
|
||||||
|
|
||||||
|
/** @brief Urgent condition on socket */
|
||||||
|
#define SIGURG 23
|
||||||
|
|
||||||
|
/** @brief CPU time limit exceeded */
|
||||||
|
#define SIGXCPU 24
|
||||||
|
|
||||||
|
/** @brief File size limit exceeded */
|
||||||
|
#define SIGXFSZ 25
|
||||||
|
|
||||||
|
/** @brief Virtual timer expired */
|
||||||
|
#define SIGVTALRM 26
|
||||||
|
|
||||||
|
/** @brief Profiling timer expired */
|
||||||
|
#define SIGPROF 27
|
||||||
|
|
||||||
|
/** @brief Window resize signal */
|
||||||
|
#define SIGWINCH 28
|
||||||
|
|
||||||
|
/** @brief I/O now possible */
|
||||||
|
#define SIGIO 29
|
||||||
|
|
||||||
|
/** @brief Power failure */
|
||||||
|
#define SIGPWR 30
|
||||||
|
|
||||||
|
/** @brief Bad system call */
|
||||||
|
#define SIGSYS 31
|
||||||
|
|
||||||
|
#endif // !_SIGNAL_H
|
45
libc/include/spawn.h
Normal file
45
libc/include/spawn.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#ifndef _SPAWN_H
|
||||||
|
#define _SPAWN_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <bits/types/struct_sched_param.h>
|
||||||
|
#include <bits/types/sigset_t.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct __spawn_action
|
||||||
|
{
|
||||||
|
int __stub;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
short int __flags;
|
||||||
|
pid_t __pgrp;
|
||||||
|
sigset_t __sd;
|
||||||
|
sigset_t __ss;
|
||||||
|
struct sched_param __sp;
|
||||||
|
int __policy;
|
||||||
|
int __pad[16];
|
||||||
|
} posix_spawnattr_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int __allocated;
|
||||||
|
int __used;
|
||||||
|
struct __spawn_action *__actions;
|
||||||
|
int __pad[16];
|
||||||
|
} posix_spawn_file_actions_t;
|
||||||
|
|
||||||
|
int posix_spawn(pid_t *pid, const char *path,
|
||||||
|
const posix_spawn_file_actions_t *file_actions,
|
||||||
|
const posix_spawnattr_t *attrp,
|
||||||
|
char *const argv[],
|
||||||
|
char *const envp[]);
|
||||||
|
|
||||||
|
int posix_spawnp(pid_t *pid, const char *file,
|
||||||
|
const posix_spawn_file_actions_t *file_actions,
|
||||||
|
const posix_spawnattr_t *attrp,
|
||||||
|
char *const argv[],
|
||||||
|
char *const envp[]);
|
||||||
|
|
||||||
|
#endif // !_SPAWN_H
|
@ -8,6 +8,9 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define EXIT_FAILURE 1
|
||||||
|
#define EXIT_SUCCESS 0
|
||||||
|
|
||||||
void abort(void);
|
void abort(void);
|
||||||
int atexit(void (*function)(void));
|
int atexit(void (*function)(void));
|
||||||
void exit(int status);
|
void exit(int status);
|
||||||
@ -22,6 +25,8 @@ extern "C"
|
|||||||
|
|
||||||
double atof(const char *nptr);
|
double atof(const char *nptr);
|
||||||
|
|
||||||
|
extern void perror(const char *__s);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#ifndef _SYS_TIME_H
|
#ifndef _SYS_TIME_H
|
||||||
#define _SYS_TIME_H
|
#define _SYS_TIME_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
#ifndef _SYS_TYPES_H
|
#ifndef _SYS_TYPES_H
|
||||||
#define _SYS_TYPES_H
|
#define _SYS_TYPES_H
|
||||||
|
|
||||||
typedef int pid_t;
|
typedef int __pid_t;
|
||||||
|
typedef unsigned int __id_t;
|
||||||
|
|
||||||
|
#ifndef __pid_t_defined
|
||||||
|
typedef __pid_t pid_t;
|
||||||
|
#define __pid_t_defined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __id_t_defined
|
||||||
|
typedef __id_t id_t;
|
||||||
|
#define __id_t_defined
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
101
libc/include/sys/wait.h
Normal file
101
libc/include/sys/wait.h
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
#ifndef _SYS_WAIT_H
|
||||||
|
#define _SYS_WAIT_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
P_ALL, /* Wait for any child. */
|
||||||
|
P_PID, /* Wait for specified process. */
|
||||||
|
P_PGID /* Wait for members of process group. */
|
||||||
|
} idtype_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int stub;
|
||||||
|
} siginfo_t;
|
||||||
|
|
||||||
|
#include <bits/waitstatus.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro for extracting the exit status from a status value.
|
||||||
|
*
|
||||||
|
* If the child process terminated normally by calling exit(3) or _exit(2),
|
||||||
|
* the macro WEXITSTATUS() returns the low-order 8 bits of the status value.
|
||||||
|
*
|
||||||
|
* @param status The status value to extract the exit status from.
|
||||||
|
* @return The exit status of the child process.
|
||||||
|
*/
|
||||||
|
#define WEXITSTATUS(status) __WEXITSTATUS(status)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro for extracting the termination signal from a status value.
|
||||||
|
*
|
||||||
|
* If the child process was terminated by a signal, the macro WTERMSIG()
|
||||||
|
* returns the signal number of the terminating signal.
|
||||||
|
*
|
||||||
|
* @param status The status value to extract the termination signal from.
|
||||||
|
* @return The termination signal of the child process.
|
||||||
|
*/
|
||||||
|
#define WTERMSIG(status) __WTERMSIG(status)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro for extracting the stop signal from a status value.
|
||||||
|
*
|
||||||
|
* If the child process was stopped by a signal, the macro WSTOPSIG()
|
||||||
|
* returns the signal number of the stop signal.
|
||||||
|
*
|
||||||
|
* @param status The status value to extract the stop signal from.
|
||||||
|
* @return The stop signal of the child process.
|
||||||
|
*/
|
||||||
|
#define WSTOPSIG(status) __WSTOPSIG(status)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro for testing whether a process exited normally.
|
||||||
|
*
|
||||||
|
* If the child process terminated normally by calling exit(3) or _exit(2),
|
||||||
|
* the macro WIFEXITED() returns a nonzero value. Otherwise, it returns 0.
|
||||||
|
*
|
||||||
|
* @param status The status value to test.
|
||||||
|
* @return A nonzero value if the child process exited normally, 0 otherwise.
|
||||||
|
*/
|
||||||
|
#define WIFEXITED(status) __WIFEXITED(status)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro for testing whether a process was terminated by a signal.
|
||||||
|
*
|
||||||
|
* If the child process was terminated by a signal, the macro WIFSIGNALED()
|
||||||
|
* returns a nonzero value. Otherwise, it returns 0.
|
||||||
|
*
|
||||||
|
* @param status The status value to test.
|
||||||
|
* @return A nonzero value if the child process was terminated by a signal, 0 otherwise.
|
||||||
|
*/
|
||||||
|
#define WIFSIGNALED(status) __WIFSIGNALED(status)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro for testing whether a process was stopped by a signal.
|
||||||
|
*
|
||||||
|
* If the child process was stopped by a signal, the macro WIFSTOPPED()
|
||||||
|
* returns a nonzero value. Otherwise, it returns 0.
|
||||||
|
*
|
||||||
|
* @param status The status value to test.
|
||||||
|
* @return A nonzero value if the child process was stopped by a signal, 0 otherwise.
|
||||||
|
*/
|
||||||
|
#define WIFSTOPPED(status) __WIFSTOPPED(status)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro for testing whether a stopped process was continued.
|
||||||
|
*
|
||||||
|
* If the child process was stopped and has been resumed by delivery of SIGCONT,
|
||||||
|
* the macro WIFCONTINUED() returns a nonzero value. Otherwise, it returns 0.
|
||||||
|
*
|
||||||
|
* @param status The status value to test.
|
||||||
|
* @return A nonzero value if the child process was continued, 0 otherwise.
|
||||||
|
*/
|
||||||
|
#define WIFCONTINUED(status) __WIFCONTINUED(status)
|
||||||
|
|
||||||
|
pid_t wait(int *wstatus);
|
||||||
|
pid_t waitpid(pid_t pid, int *wstatus, int options);
|
||||||
|
int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
|
||||||
|
|
||||||
|
#endif
|
@ -8,9 +8,16 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int execv(const char *, char *const[]);
|
extern char **environ;
|
||||||
int execve(const char *, char *const[], char *const[]);
|
|
||||||
int execvp(const char *, char *const[]);
|
int execl(const char *pathname, const char *arg, ...);
|
||||||
|
int execlp(const char *file, const char *arg, ...);
|
||||||
|
int execle(const char *pathname, const char *arg, ...);
|
||||||
|
int execv(const char *pathname, char *const argv[]);
|
||||||
|
int execvp(const char *file, char *const argv[]);
|
||||||
|
int execvpe(const char *file, char *const argv[], char *const envp[]);
|
||||||
|
int execve(const char *pathname, char *const argv[], char *const envp[]);
|
||||||
|
|
||||||
pid_t fork(void);
|
pid_t fork(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -5,20 +5,20 @@
|
|||||||
// extern void (*__fini_array_start []) (void) __attribute__((weak));
|
// extern void (*__fini_array_start []) (void) __attribute__((weak));
|
||||||
// extern void (*__fini_array_end []) (void) __attribute__((weak));
|
// extern void (*__fini_array_end []) (void) __attribute__((weak));
|
||||||
|
|
||||||
typedef void (*CallPtr)(void);
|
typedef void (*fct)(void);
|
||||||
extern CallPtr __init_array_start[0], __init_array_end[0];
|
extern fct __init_array_start[0], __init_array_end[0];
|
||||||
extern CallPtr __fini_array_start[0], __fini_array_end[0];
|
extern fct __fini_array_start[0], __fini_array_end[0];
|
||||||
|
|
||||||
// TODO: This is not working properly
|
// TODO: This is not working properly
|
||||||
|
|
||||||
void __libc_init_array(void)
|
void __libc_init_array(void)
|
||||||
{
|
{
|
||||||
// for (CallPtr *func = __init_array_start; func != __init_array_end; func++)
|
for (fct *func = __init_array_start; func != __init_array_end; func++)
|
||||||
// (*func)();
|
(*func)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __libc_fini_array(void)
|
void __libc_fini_array(void)
|
||||||
{
|
{
|
||||||
// for (CallPtr *func = __fini_array_start; func != __fini_array_end; func++)
|
for (fct *func = __fini_array_start; func != __fini_array_end; func++)
|
||||||
// (*func)();
|
(*func)();
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ int fseek(FILE *stream, long offset, int whence)
|
|||||||
stream->offset = offset;
|
stream->offset = offset;
|
||||||
break;
|
break;
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
stream->offset += offset;
|
|
||||||
break;
|
break;
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
// stream->offset = syscall1(_FileLength, (uint64_t)File->KernelPrivate) + offset;
|
// stream->offset = syscall1(_FileLength, (uint64_t)File->KernelPrivate) + offset;
|
||||||
|
@ -28,3 +28,8 @@ int puts(const char *s)
|
|||||||
for (int i = 0; s[i] != '\0'; i++)
|
for (int i = 0; s[i] != '\0'; i++)
|
||||||
fputc(s[i], stdout);
|
fputc(s[i], stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void perror(const char *__s)
|
||||||
|
{
|
||||||
|
fputs(__s, stderr);
|
||||||
|
}
|
||||||
|
@ -6,19 +6,23 @@
|
|||||||
|
|
||||||
void abort(void)
|
void abort(void)
|
||||||
{
|
{
|
||||||
|
__asm__ __volatile__("syscall"
|
||||||
|
:
|
||||||
|
: "a"(0), "D"(-0xAB057)
|
||||||
|
: "rcx", "r11", "memory");
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
int atexit(void (*function)(void))
|
int atexit(void (*function)(void))
|
||||||
{
|
{
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void exit(int status)
|
void exit(int status)
|
||||||
{
|
{
|
||||||
while (1)
|
_exit(status);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int atoi(const char *nptr)
|
int atoi(const char *nptr)
|
||||||
@ -64,7 +68,7 @@ void free(void *Address)
|
|||||||
|
|
||||||
int system(const char *command)
|
int system(const char *command)
|
||||||
{
|
{
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
double atof(const char *nptr)
|
double atof(const char *nptr)
|
||||||
|
17
libc/src/std/spawn.c
Normal file
17
libc/src/std/spawn.c
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <spawn.h>
|
||||||
|
|
||||||
|
int posix_spawn(pid_t *pid, const char *path,
|
||||||
|
const posix_spawn_file_actions_t *file_actions,
|
||||||
|
const posix_spawnattr_t *attrp,
|
||||||
|
char *const argv[],
|
||||||
|
char *const envp[])
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int posix_spawnp(pid_t *pid, const char *file,
|
||||||
|
const posix_spawn_file_actions_t *file_actions,
|
||||||
|
const posix_spawnattr_t *attrp,
|
||||||
|
char *const argv[],
|
||||||
|
char *const envp[])
|
||||||
|
{
|
||||||
|
}
|
14
libc/src/std/sys/wait.c
Normal file
14
libc/src/std/sys/wait.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
pid_t wait(int *wstatus)
|
||||||
|
{
|
||||||
|
return waitpid(-1, &wstatus, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
pid_t waitpid(pid_t pid, int *wstatus, int options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options)
|
||||||
|
{
|
||||||
|
}
|
44
libc/src/std/uni/exe.c
Normal file
44
libc/src/std/uni/exe.c
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include <unistd.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include "../../../Kernel/syscalls.h"
|
||||||
|
|
||||||
|
int execl(const char *pathname, const char *arg, ...)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int execlp(const char *file, const char *arg, ...)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int execle(const char *pathname, const char *arg, ...)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int execv(const char *pathname, char *const argv[])
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int execvp(const char *file, char *const argv[])
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int execvpe(const char *file, char *const argv[], char *const envp[])
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int execve(const char *pathname, char *const argv[], char *const envp[])
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pid_t fork(void)
|
||||||
|
{
|
||||||
|
return syscall0(_Fork);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user