kboot: Implement dup(2)

Early in boot, we need to create the normal stdin/out/err env for the
boot loader to run in. To do that, we need to open the console and
duplicate the file descriptors which requires dup(2). Implement a
wrapper as host_dup.

Sponsored by:		Netflix
This commit is contained in:
Warner Losh 2022-06-30 12:25:49 -06:00
parent a4ed0eb1aa
commit bc84de741d
4 changed files with 9 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#define SYS_close 3
#define SYS_dup 32
#define SYS_getdents 78
#define SYS_getpid 39
#define SYS_gettimeofday 96

View File

@ -1,4 +1,5 @@
#define SYS_close 6
#define SYS_dup 41
#define SYS_fstat 108
#define SYS_getdents 141
#define SYS_getpid 20

View File

@ -92,6 +92,7 @@ struct host_timeval {
* System Calls
*/
int host_close(int fd);
int host_dup(int fd);
int host_fstat(int fd, struct host_kstat *sb);
int host_getdents(int fd, void *dirp, int count);
int host_getpid(void);

View File

@ -13,6 +13,12 @@ host_close(int fd)
return host_syscall(SYS_close, fd);
}
int
host_dup(int fd)
{
return host_syscall(SYS_dup, fd);
}
int
host_fstat(int fd, struct host_kstat *sb)
{