__LXSYSCALL(void, yield);
__LXSYSCALL1(pid_t, wait, int*, status);
+
__LXSYSCALL3(pid_t, waitpid, pid_t, pid, int*, status, int, options);
#endif /* __LUNAIX_SYS_H */
pid_t p = 0;
if (!fork()) {
- kprintf("Test no hang!");
- sleep(12);
+ kprintf("Test no hang!\n");
+ sleep(6);
_exit(0);
}
waitpid(-1, &status, WNOHANG);
- // 这里是就是LunaixOS的第一个进程了!
for (size_t i = 0; i < 5; i++) {
pid_t pid = 0;
if (!(pid = fork())) {
__proc0()
{
init_platform();
+ asm volatile("movw %0, %ax\n"
+ "movw %ax, %es\n"
+ "movw %ax, %ds\n"
+ "movw %ax, %fs\n"
+ "movw %ax, %gs\n"
+ "pushl %0\n"
+ "pushl %1\n"
+ "pushl %2\n"
+ "pushl %3\n"
+ "retf" ::"i"(UDATA_SEG),
+ "i"(USTACK_TOP & ~0xf),
+ "i"(UCODE_SEG),
+ "r"(&&usr));
+usr:
if (!fork()) {
asm("jmp _lxinit_main");
}
pgid = pgid ? pgid : proc->pid;
- llist_delete(&proc->grp_member);
struct proc_info* gruppenfuhrer = get_process(pgid);
- if (!gruppenfuhrer) {
+ if (!gruppenfuhrer || proc->pgid == proc->pid) {
__current->k_status = LXINVL;
return -1;
}
+ llist_delete(&proc->grp_member);
llist_append(&gruppenfuhrer->grp_member, &proc->grp_member);
proc->pgid = pgid;
-#include <lunaix/syscall.h>
#include <arch/x86/interrupts.h>
#include <lunaix/process.h>
#include <lunaix/sched.h>
+#include <lunaix/syscall.h>
#include <lunaix/syslog.h>
LOG_MODULE("SYSCALL")
-extern void syscall_hndlr(isr_param* param);
+extern void
+syscall_hndlr(isr_param* param);
-void syscall_install() {
+void
+syscall_install()
+{
intr_subscribe(LUNAIX_SYS_CALL, syscall_hndlr);
}
\ No newline at end of file