kboot: Add host_exit and use it to implement exit()
Clients of libsa are expected to implement exit(). The current exit just loops forever. It is better to really exit: when running as init that will reboot the system. When not running as init, other programs can recover (not that we support running as init, but when we do in the future, this is still the rigtht thing). Sponsored by: Netflix
This commit is contained in:
parent
75cbdbc983
commit
f56d7a73be
@ -1,5 +1,6 @@
|
|||||||
#define SYS_close 57
|
#define SYS_close 57
|
||||||
#define SYS_dup 23
|
#define SYS_dup 23
|
||||||
|
#define SYS_exit 93
|
||||||
#define SYS_fstat 80
|
#define SYS_fstat 80
|
||||||
#define SYS_getdents64 61
|
#define SYS_getdents64 61
|
||||||
#define SYS_getpid 172
|
#define SYS_getpid 172
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#define SYS_close 3
|
#define SYS_close 3
|
||||||
#define SYS_dup 32
|
#define SYS_dup 32
|
||||||
|
#define SYS_exit 60
|
||||||
#define SYS_getdents64 217
|
#define SYS_getdents64 217
|
||||||
#define SYS_getpid 39
|
#define SYS_getpid 39
|
||||||
#define SYS_gettimeofday 96
|
#define SYS_gettimeofday 96
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#define SYS_close 6
|
#define SYS_close 6
|
||||||
#define SYS_dup 41
|
#define SYS_dup 41
|
||||||
|
#define SYS_exit 1
|
||||||
#define SYS_fstat 108
|
#define SYS_fstat 108
|
||||||
#define SYS_getdents64 202
|
#define SYS_getdents64 202
|
||||||
#define SYS_getpid 20
|
#define SYS_getpid 20
|
||||||
|
@ -155,6 +155,7 @@ struct host_dirent64 {
|
|||||||
*/
|
*/
|
||||||
int host_close(int fd);
|
int host_close(int fd);
|
||||||
int host_dup(int fd);
|
int host_dup(int fd);
|
||||||
|
int host_exit(int code);
|
||||||
int host_fstat(int fd, struct host_kstat *sb);
|
int host_fstat(int fd, struct host_kstat *sb);
|
||||||
int host_getdents64(int fd, void *dirp, int count);
|
int host_getdents64(int fd, void *dirp, int count);
|
||||||
int host_getpid(void);
|
int host_getpid(void);
|
||||||
|
@ -19,6 +19,12 @@ host_dup(int fd)
|
|||||||
return host_syscall(SYS_dup, fd);
|
return host_syscall(SYS_dup, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
host_exit(int code)
|
||||||
|
{
|
||||||
|
return host_syscall(SYS_exit, code);
|
||||||
|
}
|
||||||
|
|
||||||
/* Same system call with different names on different Linux architectures due to history */
|
/* Same system call with different names on different Linux architectures due to history */
|
||||||
int
|
int
|
||||||
host_fstat(int fd, struct host_kstat *sb)
|
host_fstat(int fd, struct host_kstat *sb)
|
||||||
|
@ -303,7 +303,7 @@ main(int argc, const char **argv)
|
|||||||
void
|
void
|
||||||
exit(int code)
|
exit(int code)
|
||||||
{
|
{
|
||||||
while (1); /* XXX: host_exit */
|
host_exit(code);
|
||||||
__unreachable();
|
__unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user