Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add _Exit(), for C99 and POSIX-2001.



details:   https://anonhg.NetBSD.org/src/rev/0ebaa433562f
branches:  trunk
changeset: 543652:0ebaa433562f
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Sat Mar 01 15:59:02 2003 +0000

description:
Add _Exit(), for C99 and POSIX-2001.
Proposed on tech-userlevel to a resounding silence in April last year.

diffstat:

 include/stdlib.h          |   3 ++-
 lib/libc/stdlib/_Exit.c   |  21 +++++++++++++++++++++
 lib/libc/sys/Makefile.inc |   3 ++-
 lib/libc/sys/_exit.2      |  20 ++++++++++++++++----
 4 files changed, 41 insertions(+), 6 deletions(-)

diffs (117 lines):

diff -r fe65096fad5a -r 0ebaa433562f include/stdlib.h
--- a/include/stdlib.h  Sat Mar 01 15:50:15 2003 +0000
+++ b/include/stdlib.h  Sat Mar 01 15:59:02 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stdlib.h,v 1.57 2002/11/29 12:58:14 lukem Exp $        */
+/*     $NetBSD: stdlib.h,v 1.58 2003/03/01 15:59:02 bjh21 Exp $        */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -99,6 +99,7 @@
 #define        MB_CUR_MAX      __mb_cur_max
 
 __BEGIN_DECLS
+__dead  void _Exit __P((int)) __attribute__((__noreturn__));
 __dead  void abort __P((void)) __attribute__((__noreturn__));
 __pure  int abs __P((int));
 int     atexit __P((void (*)(void)));
diff -r fe65096fad5a -r 0ebaa433562f lib/libc/stdlib/_Exit.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/stdlib/_Exit.c   Sat Mar 01 15:59:02 2003 +0000
@@ -0,0 +1,21 @@
+/*     $NetBSD: _Exit.c,v 1.1 2003/03/01 15:59:03 bjh21 Exp $  */
+
+/*
+ * Ben Harris, 2002
+ * This file is in the Public Domain
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+
+/*
+ * IEEE 1003.1-2001 says:
+ * The _Exit() and _exit() functions shall be functionally equivalent.
+ */
+
+void
+_Exit(int status)
+{
+
+       _exit(status);
+}
diff -r fe65096fad5a -r 0ebaa433562f lib/libc/sys/Makefile.inc
--- a/lib/libc/sys/Makefile.inc Sat Mar 01 15:50:15 2003 +0000
+++ b/lib/libc/sys/Makefile.inc Sat Mar 01 15:59:02 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.137 2003/02/15 21:11:49 jdolecek Exp $
+#      $NetBSD: Makefile.inc,v 1.138 2003/03/01 15:59:03 bjh21 Exp $
 #      @(#)Makefile.inc        8.3 (Berkeley) 10/24/94
 
 # sys sources
@@ -153,6 +153,7 @@
        sync.2 sysarch.2 syscall.2 truncate.2 umask.2 undelete.2 \
        unlink.2 utimes.2 utrace.2 vfork.2 wait.2 write.2
 
+MLINKS+=_exit.2 _Exit.2
 MLINKS+=brk.2 sbrk.2
 MLINKS+=clone.2 __clone.2
 MLINKS+=dup.2 dup2.2
diff -r fe65096fad5a -r 0ebaa433562f lib/libc/sys/_exit.2
--- a/lib/libc/sys/_exit.2      Sat Mar 01 15:50:15 2003 +0000
+++ b/lib/libc/sys/_exit.2      Sat Mar 01 15:59:02 2003 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: _exit.2,v 1.14 2003/01/18 11:32:59 thorpej Exp $
+.\"    $NetBSD: _exit.2,v 1.15 2003/03/01 15:59:03 bjh21 Exp $
 .\"
 .\" Copyright (c) 1980, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -33,22 +33,28 @@
 .\"
 .\"     @(#)_exit.2    8.1 (Berkeley) 6/4/93
 .\"
-.Dd June 4, 1993
+.Dd April 23, 2002
 .Dt EXIT 2
 .Os
 .Sh NAME
-.Nm _exit
+.Nm _Exit, _exit
 .Nd terminate the calling process
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
+.Fd #include \*[Lt]stdlib.h\*[Gt]
+.Ft void
+.Fn _Exit "int status"
 .Fd #include \*[Lt]unistd.h\*[Gt]
 .Ft void
 .Fn _exit "int status"
 .Sh DESCRIPTION
 The
+.Fn _Exit
+and
 .Fn _exit
-function terminates a process with the following consequences:
+functions are equivalent.
+They each terminate a process with the following consequences:
 .Bl -bullet
 .It
 All of the descriptors open in the calling process are closed.
@@ -101,6 +107,8 @@
 calling
 .Fn _exit .
 .Sh RETURN VALUES
+.Fn _Exit
+and
 .Fn _exit
 can never return.
 .Sh SEE ALSO
@@ -113,3 +121,7 @@
 .Fn _exit
 function conforms to
 .St -p1003.1-90 .
+The
+.Fn _Exit
+function conforms to
+.St -isoC99 .



Home | Main Index | Thread Index | Old Index