8080 * Protected counters by write_lock_irq(&tasklist_lock)
8181 */
8282unsigned long total_forks ; /* Handle normal Linux uptimes. */
83- int nr_threads ; /* The idle threads do not count.. */
83+ int nr_threads ; /* The idle threads do not count.. */
8484
8585int max_threads ; /* tunable limit on nr_threads */
8686
@@ -232,7 +232,7 @@ void __init fork_init(unsigned long mempages)
232232 /*
233233 * we need to allow at least 20 threads to boot a system
234234 */
235- if (max_threads < 20 )
235+ if (max_threads < 20 )
236236 max_threads = 20 ;
237237
238238 init_task .signal -> rlim [RLIMIT_NPROC ].rlim_cur = max_threads /2 ;
@@ -268,7 +268,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
268268 return NULL ;
269269 }
270270
271- err = arch_dup_task_struct (tsk , orig );
271+ err = arch_dup_task_struct (tsk , orig );
272272 if (err )
273273 goto out ;
274274
@@ -288,8 +288,11 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
288288 tsk -> stack_canary = get_random_int ();
289289#endif
290290
291- /* One for us, one for whoever does the "release_task()" (usually parent) */
292- atomic_set (& tsk -> usage ,2 );
291+ /*
292+ * One for us, one for whoever does the "release_task()" (usually
293+ * parent)
294+ */
295+ atomic_set (& tsk -> usage , 2 );
293296#ifdef CONFIG_BLK_DEV_IO_TRACE
294297 tsk -> btrace_seq = 0 ;
295298#endif
@@ -437,15 +440,15 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
437440 goto out ;
438441}
439442
440- static inline int mm_alloc_pgd (struct mm_struct * mm )
443+ static inline int mm_alloc_pgd (struct mm_struct * mm )
441444{
442445 mm -> pgd = pgd_alloc (mm );
443446 if (unlikely (!mm -> pgd ))
444447 return - ENOMEM ;
445448 return 0 ;
446449}
447450
448- static inline void mm_free_pgd (struct mm_struct * mm )
451+ static inline void mm_free_pgd (struct mm_struct * mm )
449452{
450453 pgd_free (mm , mm -> pgd );
451454}
@@ -482,7 +485,7 @@ static void mm_init_aio(struct mm_struct *mm)
482485#endif
483486}
484487
485- static struct mm_struct * mm_init (struct mm_struct * mm , struct task_struct * p )
488+ static struct mm_struct * mm_init (struct mm_struct * mm , struct task_struct * p )
486489{
487490 atomic_set (& mm -> mm_users , 1 );
488491 atomic_set (& mm -> mm_count , 1 );
@@ -513,9 +516,9 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
513516/*
514517 * Allocate and initialize an mm_struct.
515518 */
516- struct mm_struct * mm_alloc (void )
519+ struct mm_struct * mm_alloc (void )
517520{
518- struct mm_struct * mm ;
521+ struct mm_struct * mm ;
519522
520523 mm = allocate_mm ();
521524 if (!mm )
@@ -583,7 +586,7 @@ void added_exe_file_vma(struct mm_struct *mm)
583586void removed_exe_file_vma (struct mm_struct * mm )
584587{
585588 mm -> num_exe_file_vmas -- ;
586- if ((mm -> num_exe_file_vmas == 0 ) && mm -> exe_file ){
589+ if ((mm -> num_exe_file_vmas == 0 ) && mm -> exe_file ) {
587590 fput (mm -> exe_file );
588591 mm -> exe_file = NULL ;
589592 }
@@ -775,9 +778,9 @@ struct mm_struct *dup_mm(struct task_struct *tsk)
775778 return NULL ;
776779}
777780
778- static int copy_mm (unsigned long clone_flags , struct task_struct * tsk )
781+ static int copy_mm (unsigned long clone_flags , struct task_struct * tsk )
779782{
780- struct mm_struct * mm , * oldmm ;
783+ struct mm_struct * mm , * oldmm ;
781784 int retval ;
782785
783786 tsk -> min_flt = tsk -> maj_flt = 0 ;
@@ -844,7 +847,7 @@ static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
844847 return 0 ;
845848}
846849
847- static int copy_files (unsigned long clone_flags , struct task_struct * tsk )
850+ static int copy_files (unsigned long clone_flags , struct task_struct * tsk )
848851{
849852 struct files_struct * oldf , * newf ;
850853 int error = 0 ;
@@ -1166,11 +1169,11 @@ static struct task_struct *copy_process(unsigned long clone_flags,
11661169 cgroup_fork (p );
11671170#ifdef CONFIG_NUMA
11681171 p -> mempolicy = mpol_dup (p -> mempolicy );
1169- if (IS_ERR (p -> mempolicy )) {
1170- retval = PTR_ERR (p -> mempolicy );
1171- p -> mempolicy = NULL ;
1172- goto bad_fork_cleanup_cgroup ;
1173- }
1172+ if (IS_ERR (p -> mempolicy )) {
1173+ retval = PTR_ERR (p -> mempolicy );
1174+ p -> mempolicy = NULL ;
1175+ goto bad_fork_cleanup_cgroup ;
1176+ }
11741177 mpol_fix_fork_child_flag (p );
11751178#endif
11761179#ifdef CONFIG_CPUSETS
@@ -1216,25 +1219,33 @@ static struct task_struct *copy_process(unsigned long clone_flags,
12161219 retval = perf_event_init_task (p );
12171220 if (retval )
12181221 goto bad_fork_cleanup_policy ;
1219-
1220- if (( retval = audit_alloc ( p )) )
1222+ retval = audit_alloc ( p );
1223+ if (retval )
12211224 goto bad_fork_cleanup_policy ;
12221225 /* copy all the process information */
1223- if ((retval = copy_semundo (clone_flags , p )))
1226+ retval = copy_semundo (clone_flags , p );
1227+ if (retval )
12241228 goto bad_fork_cleanup_audit ;
1225- if ((retval = copy_files (clone_flags , p )))
1229+ retval = copy_files (clone_flags , p );
1230+ if (retval )
12261231 goto bad_fork_cleanup_semundo ;
1227- if ((retval = copy_fs (clone_flags , p )))
1232+ retval = copy_fs (clone_flags , p );
1233+ if (retval )
12281234 goto bad_fork_cleanup_files ;
1229- if ((retval = copy_sighand (clone_flags , p )))
1235+ retval = copy_sighand (clone_flags , p );
1236+ if (retval )
12301237 goto bad_fork_cleanup_fs ;
1231- if ((retval = copy_signal (clone_flags , p )))
1238+ retval = copy_signal (clone_flags , p );
1239+ if (retval )
12321240 goto bad_fork_cleanup_sighand ;
1233- if ((retval = copy_mm (clone_flags , p )))
1241+ retval = copy_mm (clone_flags , p );
1242+ if (retval )
12341243 goto bad_fork_cleanup_signal ;
1235- if ((retval = copy_namespaces (clone_flags , p )))
1244+ retval = copy_namespaces (clone_flags , p );
1245+ if (retval )
12361246 goto bad_fork_cleanup_mm ;
1237- if ((retval = copy_io (clone_flags , p )))
1247+ retval = copy_io (clone_flags , p );
1248+ if (retval )
12381249 goto bad_fork_cleanup_namespaces ;
12391250 retval = copy_thread (clone_flags , stack_start , stack_size , p , regs );
12401251 if (retval )
@@ -1256,7 +1267,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
12561267 /*
12571268 * Clear TID on mm_release()?
12581269 */
1259- p -> clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID ) ? child_tidptr : NULL ;
1270+ p -> clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID ) ? child_tidptr : NULL ;
12601271#ifdef CONFIG_BLOCK
12611272 p -> plug = NULL ;
12621273#endif
@@ -1324,7 +1335,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
13241335 * it's process group.
13251336 * A fatal signal pending means that current will exit, so the new
13261337 * thread can't slip out of an OOM kill (or normal SIGKILL).
1327- */
1338+ */
13281339 recalc_sigpending ();
13291340 if (signal_pending (current )) {
13301341 spin_unlock (& current -> sighand -> siglock );
@@ -1685,12 +1696,14 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
16851696 */
16861697 if (unshare_flags & (CLONE_NEWIPC |CLONE_SYSVSEM ))
16871698 do_sysvsem = 1 ;
1688- if ((err = unshare_fs (unshare_flags , & new_fs )))
1699+ err = unshare_fs (unshare_flags , & new_fs );
1700+ if (err )
16891701 goto bad_unshare_out ;
1690- if ((err = unshare_fd (unshare_flags , & new_fd )))
1702+ err = unshare_fd (unshare_flags , & new_fd );
1703+ if (err )
16911704 goto bad_unshare_cleanup_fs ;
1692- if (( err = unshare_nsproxy_namespaces (unshare_flags , & new_nsproxy ,
1693- new_fs )) )
1705+ err = unshare_nsproxy_namespaces (unshare_flags , & new_nsproxy , new_fs );
1706+ if ( err )
16941707 goto bad_unshare_cleanup_fd ;
16951708
16961709 if (new_fs || new_fd || do_sysvsem || new_nsproxy ) {
0 commit comments