libc: Implement _exit()
Apparently, I implemented _Exit in stdlib.h but forgot to add _exit to unistd.h...
This commit is contained in:
parent
82411789e8
commit
0fed45d1c6
@ -3,7 +3,8 @@
|
|||||||
#ifndef _BITS_ATTRS_H
|
#ifndef _BITS_ATTRS_H
|
||||||
#define _BITS_ATTRS_H
|
#define _BITS_ATTRS_H
|
||||||
|
|
||||||
#if !defined(_STDLIB_H) && !defined(_STRING_H) && !defined(_ASSERT_H) && !defined(_SETJMP_H) && !defined(_SYS_TIME_H)
|
#if !defined(_STDLIB_H) && !defined(_UNISTD_H) && !defined(_STRING_H) && !defined(_ASSERT_H) && !defined(_SETJMP_H) && \
|
||||||
|
!defined(_SYS_TIME_H)
|
||||||
#error "Never include bits/attrs.h directly; use one of the standard library headers."
|
#error "Never include bits/attrs.h directly; use one of the standard library headers."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include <bits/access.h>
|
#include <bits/access.h>
|
||||||
|
#include <bits/attrs.h>
|
||||||
#include <bits/seek.h>
|
#include <bits/seek.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -56,6 +57,9 @@ extern "C"
|
|||||||
/* Set the current process' effective group ID. */
|
/* Set the current process' effective group ID. */
|
||||||
int setegid(gid_t gid);
|
int setegid(gid_t gid);
|
||||||
|
|
||||||
|
/* Set the current process or a child process's process group. */
|
||||||
|
int setpgid(pid_t pid, pid_t pgid);
|
||||||
|
|
||||||
/* Change the owner and group of a file. */
|
/* Change the owner and group of a file. */
|
||||||
int chown(const char* path, uid_t uid, gid_t gid);
|
int chown(const char* path, uid_t uid, gid_t gid);
|
||||||
|
|
||||||
@ -86,6 +90,9 @@ extern "C"
|
|||||||
/* Call the operating system kernel for a specific service. */
|
/* Call the operating system kernel for a specific service. */
|
||||||
long syscall(long num, ...);
|
long syscall(long num, ...);
|
||||||
|
|
||||||
|
/* Exit the process immediately, without performing any cleanup actions. */
|
||||||
|
__noreturn void _exit(int status);
|
||||||
|
|
||||||
/* Sleep for X microseconds. */
|
/* Sleep for X microseconds. */
|
||||||
int usleep(useconds_t us);
|
int usleep(useconds_t us);
|
||||||
|
|
||||||
|
@ -246,6 +246,12 @@ extern "C"
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__noreturn void _exit(int status)
|
||||||
|
{
|
||||||
|
syscall(SYS_exit, status);
|
||||||
|
__builtin_unreachable();
|
||||||
|
}
|
||||||
|
|
||||||
int usleep(useconds_t us)
|
int usleep(useconds_t us)
|
||||||
{
|
{
|
||||||
long rc = syscall(SYS_usleep, us);
|
long rc = syscall(SYS_usleep, us);
|
||||||
|
Loading…
Reference in New Issue
Block a user