Annotation of 42BSD/lib/libc/vax/sys/Ovfork.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * @(#)vfork.s 4.1 (Berkeley) 12/21/80
                      3:  * C library -- vfork
                      4:  */
                      5: 
                      6: /*
                      7:  * pid = vfork();
                      8:  *
                      9:  * r1 == 0 in parent process, r1 == 1 in child process.
                     10:  * r0 == pid of child in parent, r0 == pid of parent in child.
                     11:  *
                     12:  * trickery here, due to keith sklower, uses ret to clear the stack,
                     13:  * and then returns with a jump indirect, since only one person can return
                     14:  * with a ret off this stack... we do the ret before we vfork!
                     15:  */
                     16: 
                     17:        .set    vfork,66
                     18: .globl _vfork
                     19: 
                     20: _vfork:
                     21:        .word   0x0000
                     22:        movl    16(fp),r2
                     23:        movab   here,16(fp)
                     24:        ret
                     25: here:
                     26:        chmk    $vfork
                     27:        bcc     vforkok
                     28:        jmp     verror
                     29: vforkok:
                     30:        tstl    r1              # child process ?
                     31:        bneq    child   # yes
                     32:        bcc     parent          # if c-bit not set, fork ok
                     33: .globl _errno
                     34: verror:
                     35:        movl    r0,_errno
                     36:        mnegl   $1,r0
                     37:        jmp     (r2)
                     38: child:
                     39:        clrl    r0
                     40: parent:
                     41:        jmp     (r2)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.