From 8610f496a7d1b4e50122fe9538921934411d84ba Mon Sep 17 00:00:00 2001 From: jtc Date: Thu, 7 Nov 1996 05:37:34 +0000 Subject: [PATCH] New __errno() function, returns the address of the errno variable. --- lib/libc/gen/Makefile.inc | 4 ++-- lib/libc/gen/_errno.c | 47 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 lib/libc/gen/_errno.c diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 981a89dca2d1..06ec020db939 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -1,10 +1,10 @@ -# $NetBSD: Makefile.inc,v 1.74 1996/10/16 17:53:44 perry Exp $ +# $NetBSD: Makefile.inc,v 1.75 1996/11/07 05:37:34 jtc Exp $ # @(#)Makefile.inc 8.3 (Berkeley) 4/16/94 # gen sources .PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/gen ${.CURDIR}/gen -SRCS+= alarm.c assert.c clock.c closedir.c confstr.c ctermid.c \ +SRCS+= _errno.c alarm.c assert.c clock.c closedir.c confstr.c ctermid.c \ ctype_.c daemon.c devname.c disklabel.c err.c errx.c errlist.c \ errno.c execl.c execle.c execlp.c execv.c execvp.c fnmatch.c fstab.c \ ftok.c fts.c getbsize.c getcap.c \ diff --git a/lib/libc/gen/_errno.c b/lib/libc/gen/_errno.c new file mode 100644 index 000000000000..4eb7d6200d29 --- /dev/null +++ b/lib/libc/gen/_errno.c @@ -0,0 +1,47 @@ +/* $NetBSD: _errno.c,v 1.1 1996/11/07 05:37:34 jtc Exp $ */ + +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by J.T. Conklin. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 REGENTS 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. + */ + +#include + +#undef errno + +int * +__errno() +{ + return &errno; +}