From: Sascha Wildner Date: Thu, 9 Aug 2012 07:50:14 +0000 (+0200) Subject: Add at_quick_exit(3) and quick_exit(3) manual pages. X-Git-Tag: v3.2.0~434 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/f3adbb3cdddf061a5f284c3d9b33d22fecdfcfaf Add at_quick_exit(3) and quick_exit(3) manual pages. Taken-from: FreeBSD --- diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index 39ec453..a014174 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -27,11 +27,13 @@ MISRCS+= nmalloc.c .endif .if ${LIB} == "c" -MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \ +MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 \ + at_quick_exit.3 \ + bsearch.3 \ div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \ hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \ lsearch.3 malloc.3 memory.3 posix_memalign.3 posix_openpt.3 \ - ptsname.3 qsort.3 \ + ptsname.3 qsort.3 quick_exit.3 \ radixsort.3 rand.3 random.3 \ realpath.3 strfmon.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 \ tsearch.3 diff --git a/lib/libc/stdlib/at_quick_exit.3 b/lib/libc/stdlib/at_quick_exit.3 new file mode 100644 index 0000000..36ae745 --- /dev/null +++ b/lib/libc/stdlib/at_quick_exit.3 @@ -0,0 +1,62 @@ +.\" Copyright (c) 2011 David Chisnall +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: src/lib/libc/stdlib/at_quick_exit.3,v 1.4 2012/07/26 12:04:11 pluknet Exp $ +.\" +.Dd August 9, 2012 +.Dt AT_QUICK_EXIT 3 +.Os +.Sh NAME +.Nm at_quick_exit +.Nd registers a cleanup function to run on quick exit +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In stdlib.h +.Ft int +.Fn at_quick_exit "void (*func)(void)" +.Sh DESCRIPTION +The +.Fn at_quick_exit +function registers a cleanup function to be called when the program exits as a +result of calling +.Xr quick_exit 3 . +The cleanup functions are called in the reverse order and will not be called if +the program exits by calling +.Xr exit 3 , +.Xr _Exit 3 , +or +.Xr abort 3 . +.Sh RETURN VALUES +The +.Fn at_quick_exit +function returns the value 0 if successful and a non-zero value on failure. +.Sh SEE ALSO +.Xr exit 3 , +.Xr quick_exit 3 +.Sh STANDARDS +The +.Fn at_quick_exit +function conforms to +.St -isoC-2011 . diff --git a/lib/libc/stdlib/atexit.3 b/lib/libc/stdlib/atexit.3 index 80f7bdc..69245d1 100644 --- a/lib/libc/stdlib/atexit.3 +++ b/lib/libc/stdlib/atexit.3 @@ -31,7 +31,6 @@ .\" .\" @(#)atexit.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD: src/lib/libc/stdlib/atexit.3,v 1.11 2007/01/09 00:28:09 imp Exp $ -.\" $DragonFly: src/lib/libc/stdlib/atexit.3,v 1.2 2003/06/17 04:26:46 dillon Exp $ .\" .Dd September 6, 2002 .Dt ATEXIT 3 @@ -80,6 +79,7 @@ No memory was available to add the function to the list. The existing list of functions is unmodified. .El .Sh SEE ALSO +.Xr at_quick_exit 3 , .Xr exit 3 .Sh STANDARDS The diff --git a/lib/libc/stdlib/exit.3 b/lib/libc/stdlib/exit.3 index 12f9aac..ecbd4f2 100644 --- a/lib/libc/stdlib/exit.3 +++ b/lib/libc/stdlib/exit.3 @@ -31,7 +31,6 @@ .\" .\" @(#)exit.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD: src/lib/libc/stdlib/exit.3,v 1.16 2007/01/09 00:28:09 imp Exp $ -.\" $DragonFly: src/lib/libc/stdlib/exit.3,v 1.3 2007/06/15 19:36:33 swildner Exp $ .\" .Dd June 15, 2007 .Dt EXIT 3 @@ -120,6 +119,7 @@ never return. .Xr _exit 2 , .Xr wait 2 , .Xr atexit 3 , +.Xr at_quick_exit 3 , .Xr intro 3 , .Xr sysexits 3 , .Xr tmpfile 3 diff --git a/lib/libc/stdlib/quick_exit.3 b/lib/libc/stdlib/quick_exit.3 new file mode 100644 index 0000000..8a92f01 --- /dev/null +++ b/lib/libc/stdlib/quick_exit.3 @@ -0,0 +1,58 @@ +.\" Copyright (c) 2011 David Chisnall +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: src/lib/libc/stdlib/quick_exit.3,v 1.3 2012/07/26 12:04:11 pluknet Exp $ +.\" +.Dd August 9, 2012 +.Dt QUICK_EXIT 3 +.Os +.Sh NAME +.Nm quick_exit +.Nd exits a program quickly, running minimal cleanup +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In stdlib.h +.Ft _Noreturn void +.Fn quick_exit "void" +.Sh DESCRIPTION +The +.Fn quick_exit +function exits the program quickly calling any cleanup functions registered +with +.Xr at_quick_exit 3 +but not any C++ destructors or cleanup code registered with +.Xr atexit 3 . +.Sh RETURN VALUES +The +.Fn quick_exit +function does not return. +.Sh SEE ALSO +.Xr at_quick_exit 3 , +.Xr exit 3 +.Sh STANDARDS +The +.Fn quick_exit +function conforms to +.St -isoC-2011 .