Invoke initlog from forkret on first user process
# exec(init, argv)
.globl start
start:
- movl $SYS_init, %eax
- int $T_SYSCALL
pushl $argv
pushl $init
pushl $0 // where caller pc would be
scheduler(); // start running processes
}
-pde_t enterpgdir[];
+pde_t enterpgdir[]; // For entry.S
// Start the non-boot (AP) processors.
static void
void
forkret(void)
{
+ static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
+
+ if (first) {
+ first = 0;
+ initlog();
+ }
// Return to "caller", actually trapret (see allocproc).
}
extern int sys_write(void);
extern int sys_uptime(void);
-int
-sys_init(void)
-{
- initlog();
- return 0;
-}
-
static int (*syscalls[])(void) = {
-[SYS_init] sys_init,
[SYS_fork] sys_fork,
[SYS_exit] sys_exit,
[SYS_wait] sys_wait,
[SYS_sbrk] sys_sbrk,
[SYS_sleep] sys_sleep,
[SYS_uptime] sys_uptime,
-// File system calls that are run in a transaction:
[SYS_open] sys_open,
[SYS_write] sys_write,
[SYS_mknod] sys_mknod,
// System call numbers
-#define SYS_init 0
#define SYS_fork 1
#define SYS_exit 2
#define SYS_wait 3