From 1d4e135a571129c0e84d9d6d6ab9badd42afdba1 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Fri, 15 Jun 2007 19:36:33 +0000 Subject: [PATCH] Add some words about _Exit() and create an MLINK. Reported-by: Robin Carey Dragonfly-bug: --- lib/libc/stdlib/Makefile.inc | 3 ++- lib/libc/stdlib/exit.3 | 45 ++++++++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index a34b0ce75d..d8ce762469 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -1,6 +1,6 @@ # from @(#)Makefile.inc 8.3 (Berkeley) 2/4/95 # $FreeBSD: src/lib/libc/stdlib/Makefile.inc,v 1.19.2.4 2001/10/02 11:15:38 ru Exp $ -# $DragonFly: src/lib/libc/stdlib/Makefile.inc,v 1.16 2007/03/14 10:37:42 swildner Exp $ +# $DragonFly: src/lib/libc/stdlib/Makefile.inc,v 1.17 2007/06/15 19:36:33 swildner Exp $ # machine-independent stdlib sources .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/stdlib ${.CURDIR}/../libc/stdlib @@ -24,6 +24,7 @@ MAN+= abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \ realpath.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 tsearch.3 MLINKS+=atol.3 atoll.3 +MLINKS+=exit.3 _Exit.3 MLINKS+=getenv.3 putenv.3 getenv.3 setenv.3 getenv.3 unsetenv.3 MLINKS+=getopt_long.3 getopt_long_only.3 MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3 diff --git a/lib/libc/stdlib/exit.3 b/lib/libc/stdlib/exit.3 index 7b0db3de4b..2d499742de 100644 --- a/lib/libc/stdlib/exit.3 +++ b/lib/libc/stdlib/exit.3 @@ -35,13 +35,14 @@ .\" .\" @(#)exit.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD: src/lib/libc/stdlib/exit.3,v 1.6.2.4 2001/12/14 18:33:58 ru Exp $ -.\" $DragonFly: src/lib/libc/stdlib/exit.3,v 1.2 2003/06/17 06:26:46 dillon Exp $ +.\" $DragonFly: src/lib/libc/stdlib/exit.3,v 1.3 2007/06/15 19:36:33 swildner Exp $ .\" -.Dd June 4, 1993 +.Dd June 15, 2007 .Dt EXIT 3 .Os .Sh NAME -.Nm exit +.Nm exit , +.Nm _Exit .Nd perform normal program termination .Sh LIBRARY .Lb libc @@ -49,12 +50,18 @@ .In stdlib.h .Ft void .Fn exit "int status" +.Ft void +.Fn _Exit "int status" .Sh DESCRIPTION -.Fn Exit -terminates a process. +The +.Fn exit +and +.Fn _Exit +functions terminate a process. .Pp -Before termination it performs the following functions in the -order listed: +Before termination, +.Fn exit +performs the following functions in the order listed: .Bl -enum -offset indent .It Call the functions registered with the @@ -70,6 +77,18 @@ Unlink all files created with the function. .El .Pp +The C99 function +.Fn _Exit +terminates without calling the functions registered with +.Xr atexit 3 +by just calling +.Xr _exit 2 . +Code intended to be portable should always use +.Xr _exit 2 +directly as it is defined by +.St -susv2 +as well. +.Pp Passing arbitrary values back to the environment as .Ar status is considered bad style; @@ -83,8 +102,9 @@ use the values described in .Sh RETURN VALUES The .Fn exit -function -never returns. +and +.Fn _Exit +functions never return. .Sh SEE ALSO .Xr _exit 2 , .Xr atexit 3 , @@ -94,6 +114,7 @@ never returns. .Sh STANDARDS The .Fn exit -function -conforms to -.St -isoC . +and +.Fn _Exit +functions conform to +.St -isoC-99 . -- 2.11.4.GIT