child_return man page on NetBSD

Man page or keyword search:  
man Server   9087 pages
apropos Keyword Search (all sections)
Output format
NetBSD logo
[printable version]

CPU_LWP_FORK(9)		 BSD Kernel Developer's Manual	       CPU_LWP_FORK(9)

NAME
     cpu_lwp_fork, child_return, proc_trampoline — finish a fork operation

SYNOPSIS
     #include <sys/proc.h>

     void
     cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack,
	 size_t stacksize, void (*func)(void *), void *arg);

     void
     child_return(void *arg);

DESCRIPTION
     cpu_lwp_fork() is the machine-dependent portion of fork1() which finishes
     a fork operation, with child lwp l2 nearly set up.	 It copies and updates
     the PCB and trap frame from the parent l1, making the child ready to run.

     cpu_lwp_fork() rigs the child's kernel stack so that it will start in
     proc_trampoline().	 proc_trampoline() does not have a normal calling
     sequence and is entered by cpu_switch().  If an alternate user-level
     stack is requested (with non-zero values in both the stack and stacksize
     arguments), the user stack pointer is set up accordingly.

     After being entered by cpu_switch() and while running in user context
     (within the kernel) proc_trampoline() will invoke the function func with
     the argument arg.	If a kernel thread is being created, the return path
     and argument are specified with func and arg.  If a user process is being
     created, fork1() will pass child_return() and l2 to cpu_lwp_fork() as
     func and arg respectively.	 This causes the newly-created child process
     to go directly to user level with an apparent return value of 0 from
     fork(2), while the parent process returns normally.

SEE ALSO
     fork(2), cpu_switchto(9), fork1(9)

BSD				April 13, 2010				   BSD
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server NetBSD

List of man pages available for NetBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net