I don't know is this is of any interest, but a rfork(0) will cause a
fault. I have included a patch.

fault code  = supervisor read, page not present
instruction pointer = 0x8:0xc015ff46
stack pointer         = 0x10:0xc6894f38
frame pointer         = 0x10:0xc6894f4c
code segment  = base 0x0, limit 0xfffff, type 0x1b
   = DPL 0, pres 1, def32 1, gran 1
processor eflags = interrupt enabled, resume, IOPL = 0
current process  = 94200 (syscall)
interrupt mask  =
kernel: type 12 trap, code=0
Stopped at      rfork+0x22:     movl    0x30(%eax),%eax
db> p %eax
c015ff46 <--- why this?  eax == 0x8 in show reg
db> trace
rfork(c680a100,c6894f80,2,bfbfdc24,bfbfdc30) at rfork+0x22
syscall(2f,2f,2f,bfbfdc30,bfbfdc24) at syscall+0x182
Xint0x80_syscall() at Xint0x80_syscall+0x30
db> show reg
cs                 0x8
ds                0x10
es                0x10
fs                0x10
ss                0x10
eax                0x8
ecx         0x7d8aa8c3
edx                  0
ebx         0xc680a100
esp         0xc6894f38
ebp         0xc6894f4c
esi         0xc02f9a3c  sysent+0x7d8
edi                  0
eip         0xc015ff46  rfork+0x22
efl            0x10246
rfork+0x22:     movl    0x30(%eax),%eax
db>
--
Peter Holm | mailto:[EMAIL PROTECTED] | http://login.dknet.dk/~pho/
  -[ Member of the BSD-Dk User Group / http://www.bsd-dk.dk/ ] -

*** src/sys/kern/kern_fork.c~   Sat Jul  3 21:15:58 1999
--- src/sys/kern/kern_fork.c    Sat Jul  3 21:54:18 1999
***************
*** 130,136 ****
  
        error = fork1(p, uap->flags, &p2);
        if (error == 0) {
!               p->p_retval[0] = p2->p_pid;
                p->p_retval[1] = 0;
        }
        return error;
--- 130,139 ----
  
        error = fork1(p, uap->flags, &p2);
        if (error == 0) {
!               if (p2 == NULL)
!                       p->p_retval[0] = 0;
!               else
!                       p->p_retval[0] = p2->p_pid;
                p->p_retval[1] = 0;
        }
        return error;
***************
*** 196,201 ****
--- 199,205 ----
                                p1->p_fd = newfd;
                        }
                }
+               *procp = NULL;
                return (0);
        }
  

Reply via email to