about summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/Makefile10
-rw-r--r--misc/bsd-compat.c37
-rw-r--r--misc/sys/cdefs.h34
3 files changed, 30 insertions, 51 deletions
diff --git a/misc/Makefile b/misc/Makefile
index 6c120bab65..c8b2302c99 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -58,24 +58,16 @@ routines := brk sbrk sstk ioctl \
 	    err error ustat \
 	    getsysstats dirname regexp
 aux := init-misc
-distribute := bsd-compat.c
-extra-objs := bsd-compat.o
 install-lib := libbsd-compat.a libg.a
-non-lib.a := libbsd-compat.a
 gpl2lgpl := error.c error.h
 
 tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt
 
 include ../Rules
 
-
-$(objpfx)libbsd-compat.a: $(objpfx)bsd-compat.o
-	rm -f $@
-	ln $< $@
-
+$(objpfx)libbsd-compat.a: $(dep-dummy-lib); $(make-dummy-lib)
 $(objpfx)libg.a: $(dep-dummy-lib); $(make-dummy-lib)
 
-
 CFLAGS-init-misc.c = -fkeep-inline-functions
 
 ifeq ($(build-shared),yes)
diff --git a/misc/bsd-compat.c b/misc/bsd-compat.c
deleted file mode 100644
index f18cf38ec2..0000000000
--- a/misc/bsd-compat.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* BSD-compatible versions of functions where BSD and POSIX.1 conflict.
-   Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include <sys/types.h>
-
-/* Don't include unistd.h because it declares a conflicting
-   prototype for the POSIX.1 `getpgrp' function.  */
-extern pid_t __getpgid __P ((pid_t));
-extern int __setpgid __P ((pid_t, pid_t));
-
-pid_t
-getpgrp (pid_t pid)
-{
-  return __getpgid (pid);
-}
-
-int
-setpgrp (pid_t pid, pid_t pgrp)
-{
-  return __setpgid (pid, pgrp);
-}
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 5f40a0a45d..c0c442e011 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -95,15 +95,39 @@
 # define __END_DECLS
 #endif
 
-/* GCC2 has various useful declarations that can be made with the
+/* __asm__ ("xyz") is used throughout the headers to rename functions
+   at the assembly language level.  This is wrapped by the __REDIRECT
+   macro, in order to support compilers that can do this some other
+   way.  When compilers don't support asm-names at all, we have to do
+   preprocessor tricks instead (which don't have exactly the right
+   semantics, but it's the best we can do).
+
+   Example:
+   int __REDIRECT(setpgrp, __P((__pid_t pid, __pid_t pgrp)), setpgid); */
+
+#if defined __GNUC__ && __GNUC__ >= 2
+
+# define __REDIRECT(name, proto, asname) name proto __asm__ (#asname)
+
+/*
+#elif __SOME_OTHER_COMPILER__
+
+# define __attribute__(xyz)
+# define __ALIAS(name, proto, asname) name proto; \
+                  _Pragma("let " #name " = " #asname)
+*/
+#endif
+
+/* GCC has various useful declarations that can be made with the
    `__attribute__' syntax.  All of the ways we use this do fine if
-   they are omitted for compilers that don't understand it.  */
+   they are omitted for compilers that don't understand it. */
 #if !defined __GNUC__ || __GNUC__ < 2
-# define __attribute__(xyz)	/* Ignore.  */
-#endif
 
+# define __attribute__(xyz)	/* Ignore. */
+
+#endif
 
-/* For now no version of gcc knows the `restrict' keyword.  Define it
+/* No current version of gcc knows the `restrict' keyword.  Define it
    for now unconditionally to the empty string.  */
 #define __restrict