Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/libhack Add definitions for weak aliases so th...



details:   https://anonhg.NetBSD.org/src/rev/e20655a30179
branches:  trunk
changeset: 511257:e20655a30179
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri Jun 15 17:26:50 2001 +0000

description:
Add definitions for weak aliases so that libhack functions
are actually linked instead of libc ones on ELF systems.
Fixes install/13050 and install/13153.

diffstat:

 distrib/utils/libhack/getcap.c    |  30 ++++++++++++++++++++++++++++--
 distrib/utils/libhack/getgrent.c  |  22 +++++++++++++++++++++-
 distrib/utils/libhack/gethost.c   |  19 +++++++++----------
 distrib/utils/libhack/getnet.c    |  14 +++++++++++++-
 distrib/utils/libhack/getnetgr.c  |  18 +++++++++++++++++-
 distrib/utils/libhack/getpwent.c  |  22 +++++++++++++++++++++-
 distrib/utils/libhack/opendir.c   |  12 +++++++++++-
 distrib/utils/libhack/strsignal.c |  12 +++++++++++-
 8 files changed, 131 insertions(+), 18 deletions(-)

diffs (truncated from 303 to 300 lines):

diff -r 6e2df4a450fa -r e20655a30179 distrib/utils/libhack/getcap.c
--- a/distrib/utils/libhack/getcap.c    Fri Jun 15 17:24:19 2001 +0000
+++ b/distrib/utils/libhack/getcap.c    Fri Jun 15 17:26:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getcap.c,v 1.2 1999/03/13 19:11:54 sommerfe Exp $      */
+/*     $NetBSD: getcap.c,v 1.3 2001/06/15 17:26:50 tsutsui Exp $       */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -46,10 +46,23 @@
 #if 0
 static char sccsid[] = "@(#)getcap.c   8.3 (Berkeley) 3/25/94";
 #else
-__RCSID("$NetBSD: getcap.c,v 1.2 1999/03/13 19:11:54 sommerfe Exp $");
+__RCSID("$NetBSD: getcap.c,v 1.3 2001/06/15 17:26:50 tsutsui Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+#ifdef __weak_alias
+#define cgetcap                        _cgetcap
+#define cgetclose              _cgetclose
+#define cgetent                        _cgetent
+#define cgetfirst              _cgetfirst
+#define cgetmatch              _cgetmatch
+#define cgetnext               _cgetnext
+#define cgetnum                        _cgetnum
+#define cgetset                        _cgetset
+#define cgetstr                        _cgetstr
+#define cgetustr               _cgetustr
+#endif
+
 #include <sys/types.h>
 #include <ctype.h>
 #include <errno.h>     
@@ -70,6 +83,19 @@
 #define TCERR  (char)1
 #define        SHADOW  (char)2
 
+#ifdef __weak_alias
+__weak_alias(cgetcap,_cgetcap)
+__weak_alias(cgetclose,_cgetclose)
+__weak_alias(cgetent,_cgetent)
+__weak_alias(cgetfirst,_cgetfirst)
+__weak_alias(cgetmatch,_cgetmatch)
+__weak_alias(cgetnext,_cgetnext)
+__weak_alias(cgetnum,_cgetnum)
+__weak_alias(cgetset,_cgetset)
+__weak_alias(cgetstr,_cgetstr)
+__weak_alias(cgetustr,_cgetustr)
+#endif
+
 static size_t   topreclen;     /* toprec length */
 static char    *toprec;        /* Additional record specified by cgetset() */
 static int      gottoprec;     /* Flag indicating retrieval of toprecord */
diff -r 6e2df4a450fa -r e20655a30179 distrib/utils/libhack/getgrent.c
--- a/distrib/utils/libhack/getgrent.c  Fri Jun 15 17:24:19 2001 +0000
+++ b/distrib/utils/libhack/getgrent.c  Fri Jun 15 17:26:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getgrent.c,v 1.3 1999/03/13 19:08:44 sommerfe Exp $    */
+/*     $NetBSD: getgrent.c,v 1.4 2001/06/15 17:26:51 tsutsui Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -39,12 +39,32 @@
  * and then gutted, leaving only /etc/group support.
  */
 
+#include <sys/cdefs.h>
+
+#ifdef __weak_alias
+#define endgrent               _endgrent
+#define getgrent               _getgrent
+#define getgrgid               _getgrgid
+#define getgrnam               _getgrnam
+#define setgrent               _setgrent
+#define setgroupent            _setgroupent
+#endif
+
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <grp.h>
 
+#ifdef __weak_alias
+__weak_alias(endgrent,_endgrent)
+__weak_alias(getgrent,_getgrent)
+__weak_alias(getgrgid,_getgrgid)
+__weak_alias(getgrnam,_getgrnam)
+__weak_alias(setgrent,_setgrent)
+__weak_alias(setgroupent,_setgroupent)
+#endif
+
 static FILE *_gr_fp;
 static struct group _gr_group;
 static int _gr_stayopen;
diff -r 6e2df4a450fa -r e20655a30179 distrib/utils/libhack/gethost.c
--- a/distrib/utils/libhack/gethost.c   Fri Jun 15 17:24:19 2001 +0000
+++ b/distrib/utils/libhack/gethost.c   Fri Jun 15 17:26:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gethost.c,v 1.6 2001/04/28 14:56:42 kleink Exp $       */
+/*     $NetBSD: gethost.c,v 1.7 2001/06/15 17:26:51 tsutsui Exp $      */
 
 /*-
  * Copyright (c) 1985, 1988, 1993
@@ -60,15 +60,9 @@
 
 #include <sys/cdefs.h>
 
-#if defined(__weak_alias)
-/* From namespace.h: */
-#define gethostbyaddr  _gethostbyaddr
-#define gethostbyname  _gethostbyname
-#define gethostname    _gethostname
-
-__weak_alias(gethostbyaddr,_gethostbyaddr);
-__weak_alias(gethostbyname,_gethostbyname);
-__weak_alias(gethostbyname2,gethostbyname);
+#ifdef __weak_alias
+#define gethostbyaddr          _gethostbyaddr
+#define gethostbyname          _gethostbyname
 #endif
 
 #include <sys/param.h>
@@ -83,6 +77,11 @@
 #include <errno.h>
 #include <string.h>
 
+#ifdef __weak_alias
+__weak_alias(gethostbyaddr,_gethostbyaddr);
+__weak_alias(gethostbyname,_gethostbyname);
+#endif
+
 #define        MAXALIASES      35
 #define        MAXADDRS        35
 
diff -r 6e2df4a450fa -r e20655a30179 distrib/utils/libhack/getnet.c
--- a/distrib/utils/libhack/getnet.c    Fri Jun 15 17:24:19 2001 +0000
+++ b/distrib/utils/libhack/getnet.c    Fri Jun 15 17:26:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getnet.c,v 1.1 1997/12/12 03:05:59 gwr Exp $   */
+/*     $NetBSD: getnet.c,v 1.2 2001/06/15 17:26:51 tsutsui Exp $       */
 
 /* Copyright (c) 1993 Carlos Leandro and Rui Salgueiro
  *     Dep. Matematica Universidade de Coimbra, Portugal, Europe
@@ -45,6 +45,13 @@
  * and then gutted, leaving only stubs.
  */
 
+#include <sys/cdefs.h>
+
+#ifdef __weak_alias
+#define getnetbyaddr           _getnetbyaddr
+#define getnetbyname           _getnetbyname
+#endif
+
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -58,6 +65,11 @@
 #include <errno.h>
 #include <string.h>
 
+#ifdef __weak_alias
+__weak_alias(getnetbyaddr,_getnetbyaddr)
+__weak_alias(getnetbyname,_getnetbyname)
+#endif
+
 struct netent *
 getnetbyaddr(net, net_type)
        register u_long net;
diff -r 6e2df4a450fa -r e20655a30179 distrib/utils/libhack/getnetgr.c
--- a/distrib/utils/libhack/getnetgr.c  Fri Jun 15 17:24:19 2001 +0000
+++ b/distrib/utils/libhack/getnetgr.c  Fri Jun 15 17:26:50 2001 +0000
@@ -1,7 +1,23 @@
-/*     $NetBSD: getnetgr.c,v 1.3 1999/03/13 19:08:44 sommerfe Exp $    */
+/*     $NetBSD: getnetgr.c,v 1.4 2001/06/15 17:26:51 tsutsui Exp $     */
+
+#include <sys/cdefs.h>
+
+#ifdef __weak_alias
+#define endnetgrent            _endnetgrent
+#define innetgr                        _innetgr
+#define getnetgrent            _getnetgrent
+#define setnetgrent            _setnetgrent
+#endif
 
 #include <netgroup.h>
 
+#ifdef __weak_alias
+__weak_alias(endnetgrent,_endnetgrent)
+__weak_alias(getnetgrent,_getnetgrent)
+__weak_alias(innetgr,_innetgr)
+__weak_alias(setnetgrent,_setnetgrent)
+#endif
+
 /*
  * Just stub these out, so it looks like
  * we are not in any any netgroups.
diff -r 6e2df4a450fa -r e20655a30179 distrib/utils/libhack/getpwent.c
--- a/distrib/utils/libhack/getpwent.c  Fri Jun 15 17:24:19 2001 +0000
+++ b/distrib/utils/libhack/getpwent.c  Fri Jun 15 17:26:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getpwent.c,v 1.3 1999/03/13 19:08:44 sommerfe Exp $    */
+/*     $NetBSD: getpwent.c,v 1.4 2001/06/15 17:26:51 tsutsui Exp $     */
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -35,11 +35,31 @@
  * Needed by programs like: rsh, rlogin
  */
 
+#include <sys/cdefs.h>
+
+#ifdef __weak_alias
+#define endpwent               _endpwent
+#define getpwent               _getpwent
+#define getpwnam               _getpwnam
+#define getpwuid               _getpwuid
+#define setpassent             _setpassent
+#define setpwent               _setpwent
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <pwd.h>
 
+#ifdef __weak_alias
+__weak_alias(endpwent,_endpwent)
+__weak_alias(getpwent,_getpwent)
+__weak_alias(getpwnam,_getpwnam)
+__weak_alias(getpwuid,_getpwuid)
+__weak_alias(setpassent,_setpassent)
+__weak_alias(setpwent,_setpwent)
+#endif
+
 #define        PWNULL  (struct passwd *)0
 #define MAXFIELD 8
 
diff -r 6e2df4a450fa -r e20655a30179 distrib/utils/libhack/opendir.c
--- a/distrib/utils/libhack/opendir.c   Fri Jun 15 17:24:19 2001 +0000
+++ b/distrib/utils/libhack/opendir.c   Fri Jun 15 17:26:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: opendir.c,v 1.2 1999/05/23 22:08:17 gwr Exp $  */
+/*     $NetBSD: opendir.c,v 1.3 2001/06/15 17:26:51 tsutsui Exp $      */
 
 /*
  * Copyright (c) 1983, 1993
@@ -33,6 +33,12 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
+
+#ifdef __weak_alias
+#define opendir                        _opendir
+#endif
+
 #include <sys/param.h>
 #include <sys/mount.h>
 #include <sys/stat.h>
@@ -44,6 +50,10 @@
 #include <string.h>
 #include <unistd.h>
 
+#ifdef __weak_alias
+__weak_alias(opendir,_opendir)
+#endif
+
 /*
  * Open a directory.
  */
diff -r 6e2df4a450fa -r e20655a30179 distrib/utils/libhack/strsignal.c
--- a/distrib/utils/libhack/strsignal.c Fri Jun 15 17:24:19 2001 +0000
+++ b/distrib/utils/libhack/strsignal.c Fri Jun 15 17:26:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strsignal.c,v 1.2 1999/05/27 05:41:15 gwr Exp $        */
+/*     $NetBSD: strsignal.c,v 1.3 2001/06/15 17:26:51 tsutsui Exp $    */
 
 /*
  * Copyright (c) 1988 Regents of the University of California.
@@ -33,10 +33,20 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
+
+#ifdef __weak_alias
+#define strsignal              _strsignal
+#endif
+
 #include <stdio.h>
 #include <signal.h>
 #include <unistd.h>
 
+#ifdef __weak_alias
+__weak_alias(strsignal,_strsignal)
+#endif
+



Home | Main Index | Thread Index | Old Index