Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
fork.c File Reference
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/unistd.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/completion.h>
#include <linux/personality.h>
#include <linux/mempolicy.h>
#include <linux/sem.h>
#include <linux/file.h>
#include <linux/fdtable.h>
#include <linux/iocontext.h>
#include <linux/key.h>
#include <linux/binfmts.h>
#include <linux/mman.h>
#include <linux/mmu_notifier.h>
#include <linux/fs.h>
#include <linux/nsproxy.h>
#include <linux/capability.h>
#include <linux/cpu.h>
#include <linux/cgroup.h>
#include <linux/security.h>
#include <linux/hugetlb.h>
#include <linux/seccomp.h>
#include <linux/swap.h>
#include <linux/syscalls.h>
#include <linux/jiffies.h>
#include <linux/futex.h>
#include <linux/compat.h>
#include <linux/kthread.h>
#include <linux/task_io_accounting_ops.h>
#include <linux/rcupdate.h>
#include <linux/ptrace.h>
#include <linux/mount.h>
#include <linux/audit.h>
#include <linux/memcontrol.h>
#include <linux/ftrace.h>
#include <linux/proc_fs.h>
#include <linux/profile.h>
#include <linux/rmap.h>
#include <linux/ksm.h>
#include <linux/acct.h>
#include <linux/tsacct_kern.h>
#include <linux/cn_proc.h>
#include <linux/freezer.h>
#include <linux/delayacct.h>
#include <linux/taskstats_kern.h>
#include <linux/random.h>
#include <linux/tty.h>
#include <linux/blkdev.h>
#include <linux/fs_struct.h>
#include <linux/magic.h>
#include <linux/perf_event.h>
#include <linux/posix-timers.h>
#include <linux/user-return-notifier.h>
#include <linux/oom.h>
#include <linux/khugepaged.h>
#include <linux/signalfd.h>
#include <linux/uprobes.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
#include <trace/events/sched.h>
#include <trace/events/task.h>
#include <linux/init_task.h>

Go to the source code of this file.

Macros

#define CREATE_TRACE_POINTS
 
#define ARCH_MIN_TASKALIGN   L1_CACHE_BYTES
 
#define dup_mmap(mm, oldmm)   (0)
 
#define mm_alloc_pgd(mm)   (0)
 
#define mm_free_pgd(mm)
 
#define allocate_mm()   (kmem_cache_alloc(mm_cachep, GFP_KERNEL))
 
#define free_mm(mm)   (kmem_cache_free(mm_cachep, (mm)))
 
#define ARCH_MIN_MMSTRUCT_ALIGN   0
 

Functions

 DEFINE_PER_CPU (unsigned long, process_counts)=0
 
__cacheline_aligned DEFINE_RWLOCK (tasklist_lock)
 
int nr_processes (void)
 
void __weak arch_release_task_struct (struct task_struct *tsk)
 
void __weak arch_release_thread_info (struct thread_info *ti)
 
void free_task (struct task_struct *tsk)
 
 EXPORT_SYMBOL (free_task)
 
void __put_task_struct (struct task_struct *tsk)
 
 EXPORT_SYMBOL_GPL (__put_task_struct)
 
void __init __weak arch_task_cache_init (void)
 
void __init fork_init (unsigned long mempages)
 
int __attribute__ ((weak))
 
__cacheline_aligned_in_smp DEFINE_SPINLOCK (mmlist_lock)
 
 __setup ("coredump_filter=", coredump_filter_setup)
 
struct mm_structmm_alloc (void)
 
void __mmdrop (struct mm_struct *mm)
 
 EXPORT_SYMBOL_GPL (__mmdrop)
 
void mmput (struct mm_struct *mm)
 
 EXPORT_SYMBOL_GPL (mmput)
 
void set_mm_exe_file (struct mm_struct *mm, struct file *new_exe_file)
 
struct fileget_mm_exe_file (struct mm_struct *mm)
 
struct mm_structget_task_mm (struct task_struct *task)
 
 EXPORT_SYMBOL_GPL (get_task_mm)
 
struct mm_structmm_access (struct task_struct *task, unsigned int mode)
 
void mm_release (struct task_struct *tsk, struct mm_struct *mm)
 
struct mm_structdup_mm (struct task_struct *tsk)
 
void __cleanup_sighand (struct sighand_struct *sighand)
 
 SYSCALL_DEFINE1 (set_tid_address, int __user *, tidptr)
 
struct task_struct *__cpuinit fork_idle (int cpu)
 
long do_fork (unsigned long clone_flags, unsigned long stack_start, struct pt_regs *regs, unsigned long stack_size, int __user *parent_tidptr, int __user *child_tidptr)
 
void __init proc_caches_init (void)
 
 SYSCALL_DEFINE1 (unshare, unsigned long, unshare_flags)
 
int unshare_files (struct files_struct **displaced)
 

Variables

unsigned long total_forks
 
int nr_threads
 
int max_threads
 
struct kmem_cachesighand_cachep
 
struct kmem_cachefiles_cachep
 
struct kmem_cachefs_cachep
 
struct kmem_cachevm_area_cachep
 

Macro Definition Documentation

#define allocate_mm ( )    (kmem_cache_alloc(mm_cachep, GFP_KERNEL))

Definition at line 503 of file fork.c.

#define ARCH_MIN_MMSTRUCT_ALIGN   0

Definition at line 1649 of file fork.c.

#define ARCH_MIN_TASKALIGN   L1_CACHE_BYTES
#define CREATE_TRACE_POINTS

Definition at line 83 of file fork.c.

#define dup_mmap (   mm,
  oldmm 
)    (0)

Definition at line 496 of file fork.c.

#define free_mm (   mm)    (kmem_cache_free(mm_cachep, (mm)))

Definition at line 504 of file fork.c.

#define mm_alloc_pgd (   mm)    (0)

Definition at line 497 of file fork.c.

#define mm_free_pgd (   mm)

Definition at line 498 of file fork.c.

Function Documentation

int __attribute__ ( (weak)  )
read

Definition at line 285 of file fork.c.

void __cleanup_sighand ( struct sighand_struct sighand)

Definition at line 995 of file fork.c.

void __mmdrop ( struct mm_struct mm)

Definition at line 593 of file fork.c.

void __put_task_struct ( struct task_struct tsk)

Definition at line 233 of file fork.c.

__setup ( )
void __weak arch_release_task_struct ( struct task_struct tsk)

Definition at line 117 of file fork.c.

void __weak arch_release_thread_info ( struct thread_info ti)

Definition at line 135 of file fork.c.

void __init __weak arch_task_cache_init ( void  )

Definition at line 249 of file fork.c.

DEFINE_PER_CPU ( unsigned  long,
process_counts   
)
pure virtual
__cacheline_aligned DEFINE_RWLOCK ( tasklist_lock  )
__cacheline_aligned_in_smp DEFINE_SPINLOCK ( mmlist_lock  )
long do_fork ( unsigned long  clone_flags,
unsigned long  stack_start,
struct pt_regs regs,
unsigned long  stack_size,
int __user parent_tidptr,
int __user child_tidptr 
)

Definition at line 1555 of file fork.c.

struct mm_struct* dup_mm ( struct task_struct tsk)
read

Definition at line 806 of file fork.c.

EXPORT_SYMBOL ( free_task  )
EXPORT_SYMBOL_GPL ( __put_task_struct  )
EXPORT_SYMBOL_GPL ( __mmdrop  )
EXPORT_SYMBOL_GPL ( mmput  )
EXPORT_SYMBOL_GPL ( get_task_mm  )
struct task_struct* __cpuinit fork_idle ( int  cpu)
read

Definition at line 1534 of file fork.c.

void __init fork_init ( unsigned long  mempages)

Definition at line 251 of file fork.c.

void free_task ( struct task_struct tsk)

Definition at line 207 of file fork.c.

struct file* get_mm_exe_file ( struct mm_struct mm)
read

Definition at line 639 of file fork.c.

struct mm_struct* get_task_mm ( struct task_struct task)
read

get_task_mm - acquire a reference to the task's mm

Returns NULL if the task has no mm. Checks PF_KTHREAD (meaning this kernel workthread has transiently adopted a user mm with use_mm, to do its AIO) is not set and if so returns a reference to it, after bumping up the use count. User must release the mm via mmput() after use. Typically used by /proc and ptrace.

Definition at line 668 of file fork.c.

struct mm_struct* mm_access ( struct task_struct task,
unsigned int  mode 
)
read

Definition at line 685 of file fork.c.

struct mm_struct* mm_alloc ( void  )
read

Definition at line 575 of file fork.c.

void mm_release ( struct task_struct tsk,
struct mm_struct mm 
)

Definition at line 750 of file fork.c.

void mmput ( struct mm_struct mm)

Definition at line 607 of file fork.c.

int nr_processes ( void  )

Definition at line 106 of file fork.c.

void __init proc_caches_init ( void  )

Definition at line 1660 of file fork.c.

void set_mm_exe_file ( struct mm_struct mm,
struct file new_exe_file 
)

Definition at line 630 of file fork.c.

SYSCALL_DEFINE1 ( set_tid_address  ,
int __user ,
tidptr   
)

Definition at line 1084 of file fork.c.

SYSCALL_DEFINE1 ( unshare  ,
unsigned  long,
unshare_flags   
)

Definition at line 1760 of file fork.c.

int unshare_files ( struct files_struct **  displaced)

Definition at line 1850 of file fork.c.

Variable Documentation

struct kmem_cache* files_cachep

Definition at line 189 of file fork.c.

struct kmem_cache* fs_cachep

Definition at line 192 of file fork.c.

int max_threads

Definition at line 92 of file fork.c.

int nr_threads

Definition at line 90 of file fork.c.

struct kmem_cache* sighand_cachep

Definition at line 186 of file fork.c.

unsigned long total_forks

Definition at line 89 of file fork.c.

struct kmem_cache* vm_area_cachep

Definition at line 195 of file fork.c.