Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src avoid linker warning for compat symbols that are used intern...
details: https://anonhg.NetBSD.org/src/rev/f944cc60ef38
branches: trunk
changeset: 790369:f944cc60ef38
user: christos <christos%NetBSD.org@localhost>
date: Fri Oct 04 20:49:16 2013 +0000
description:
avoid linker warning for compat symbols that are used internally in libc,
by introducing a hidden compat_foo() function, using that internally in
libc, and exposing foo as a strong alias to compat_foo(). I am open for
better ideas.
diffstat:
lib/libc/compat/gen/compat___fts13.c | 8 ++++----
lib/libc/compat/gen/compat___fts30.c | 8 ++++----
lib/libc/compat/gen/compat___fts31.c | 8 ++++----
lib/libc/compat/gen/compat___fts32.c | 8 ++++----
lib/libc/compat/gen/compat_fts.c | 6 +++++-
lib/libc/compat/gen/compat_getmntinfo.c | 17 ++++++++---------
lib/libc/compat/gen/compat_glob.c | 6 +++++-
lib/libc/compat/gen/compat_time.c | 5 ++++-
lib/libc/compat/gen/compat_times.c | 5 ++++-
lib/libc/compat/sys/compat___fhstat30.c | 10 ++++++----
lib/libc/compat/sys/compat___stat13.c | 16 ++++++++++------
lib/libc/compat/sys/compat___stat30.c | 17 +++++++++++------
lib/libc/compat/sys/compat_getrusage.c | 8 +++++---
lib/libc/compat/sys/compat_gettimeofday.c | 8 +++++---
lib/libc/compat/sys/compat_mknod.c | 8 +++++---
lib/libc/compat/sys/compat_stat.c | 14 +++++++++-----
lib/libc/compat/sys/compat_statfs.c | 17 +++++++++++------
lib/libc/ssp/gets_chk.c | 9 +++++----
lib/libc/stdio/gets.c | 11 ++++++++---
lib/libc/stdio/local.h | 4 +++-
sys/compat/sys/mount.h | 21 ++++++++++++---------
sys/compat/sys/resource.h | 4 ++--
sys/compat/sys/stat.h | 22 +++++++++++-----------
sys/compat/sys/time.h | 5 +++--
24 files changed, 148 insertions(+), 97 deletions(-)
diffs (truncated from 811 to 300 lines):
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/gen/compat___fts13.c
--- a/lib/libc/compat/gen/compat___fts13.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/gen/compat___fts13.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat___fts13.c,v 1.9 2012/03/14 00:25:19 christos Exp $ */
+/* $NetBSD: compat___fts13.c,v 1.10 2013/10/04 20:49:16 christos Exp $ */
#include "namespace.h"
#include <sys/cdefs.h>
@@ -42,9 +42,9 @@
((a) > USHRT_MAX ? USHRT_MAX : (unsigned short)(a))
#endif
-#define stat __stat13
-#define lstat __lstat13
-#define fstat __fstat13
+#define stat compat___stat13
+#define lstat compat___lstat13
+#define fstat compat___fstat13
#undef fts_children
#define fts_children __fts_children13
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/gen/compat___fts30.c
--- a/lib/libc/compat/gen/compat___fts30.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/gen/compat___fts30.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat___fts30.c,v 1.6 2012/03/14 00:25:19 christos Exp $ */
+/* $NetBSD: compat___fts30.c,v 1.7 2013/10/04 20:49:16 christos Exp $ */
#include "namespace.h"
#include <sys/cdefs.h>
@@ -32,9 +32,9 @@
#define __fts_dev_t uint32_t
#define __fts_level_t short
-#define stat __stat30
-#define lstat __lstat30
-#define fstat __fstat30
+#define stat compat___stat30
+#define lstat compat___lstat30
+#define fstat compat___fstat30
#ifndef ftsent_namelen_truncate
#define ftsent_namelen_truncate(a) \
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/gen/compat___fts31.c
--- a/lib/libc/compat/gen/compat___fts31.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/gen/compat___fts31.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat___fts31.c,v 1.4 2012/03/14 00:25:19 christos Exp $ */
+/* $NetBSD: compat___fts31.c,v 1.5 2013/10/04 20:49:16 christos Exp $ */
#include "namespace.h"
#include <sys/cdefs.h>
@@ -40,9 +40,9 @@
((a) > USHRT_MAX ? USHRT_MAX : (unsigned short)(a))
#endif
-#define stat __stat30
-#define lstat __lstat30
-#define fstat __fstat30
+#define stat compat___stat30
+#define lstat compat___lstat30
+#define fstat compat___fstat30
#undef fts_children
#define fts_children __fts_children31
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/gen/compat___fts32.c
--- a/lib/libc/compat/gen/compat___fts32.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/gen/compat___fts32.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat___fts32.c,v 1.3 2009/10/19 17:52:05 christos Exp $ */
+/* $NetBSD: compat___fts32.c,v 1.4 2013/10/04 20:49:16 christos Exp $ */
#include "namespace.h"
#include <sys/cdefs.h>
@@ -46,8 +46,8 @@
#define __FTS_COMPAT_LEVEL
-#define stat __stat30
-#define lstat __lstat30
-#define fstat __fstat30
+#define stat compat___stat30
+#define lstat compat___lstat30
+#define fstat compat___fstat30
#include "gen/fts.c"
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/gen/compat_fts.c
--- a/lib/libc/compat/gen/compat_fts.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/gen/compat_fts.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_fts.c,v 1.6 2012/03/15 16:47:38 christos Exp $ */
+/* $NetBSD: compat_fts.c,v 1.7 2013/10/04 20:49:16 christos Exp $ */
/*
* Written by Jason R. Thorpe <thorpej%NetBSD.org@localhost>, October 21, 1997.
@@ -62,4 +62,8 @@
#define __FTS_COMPAT_LENGTH
#define __FTS_COMPAT_LEVEL
+#define stat compat_stat
+#define lstat compat_lstat
+#define fstat compat_fstat
+
#include "gen/fts.c"
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/gen/compat_getmntinfo.c
--- a/lib/libc/compat/gen/compat_getmntinfo.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/gen/compat_getmntinfo.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_getmntinfo.c,v 1.2 2012/03/20 17:05:59 matt Exp $ */
+/* $NetBSD: compat_getmntinfo.c,v 1.3 2013/10/04 20:49:16 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getmntinfo.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: compat_getmntinfo.c,v 1.2 2012/03/20 17:05:59 matt Exp $");
+__RCSID("$NetBSD: compat_getmntinfo.c,v 1.3 2013/10/04 20:49:16 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -50,15 +50,13 @@
#include <errno.h>
#include <stdlib.h>
-#ifdef __weak_alias
-__weak_alias(getmntinfo,_getmntinfo)
-#endif
+__strong_alias(getmntinfo, compat_getmntinfo)
/*
* Return information about mounted filesystems.
*/
int
-getmntinfo(struct statfs12 **mntbufp, int flags)
+compat_getmntinfo(struct statfs12 **mntbufp, int flags)
{
static struct statfs12 *mntbuf;
static int mntsize;
@@ -67,10 +65,10 @@
_DIAGASSERT(mntbufp != NULL);
if (mntsize <= 0 &&
- (mntsize = getfsstat(NULL, 0L, MNT_NOWAIT)) == -1)
+ (mntsize = compat_getfsstat(NULL, 0L, MNT_NOWAIT)) == -1)
return (0);
if (bufsize > 0 &&
- (mntsize = getfsstat(mntbuf, (long)bufsize, flags)) == -1)
+ (mntsize = compat_getfsstat(mntbuf, (long)bufsize, flags)) == -1)
return (0);
while (bufsize <= mntsize * sizeof(struct statfs12)) {
if (mntbuf)
@@ -78,7 +76,8 @@
bufsize = (mntsize + 1) * sizeof(struct statfs12);
if ((mntbuf = malloc(bufsize)) == NULL)
return (0);
- if ((mntsize = getfsstat(mntbuf, (long)bufsize, flags)) == -1)
+ if ((mntsize = compat_getfsstat(mntbuf, (long)bufsize,
+ flags)) == -1)
return (0);
}
*mntbufp = mntbuf;
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/gen/compat_glob.c
--- a/lib/libc/compat/gen/compat_glob.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/gen/compat_glob.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_glob.c,v 1.2 2009/01/11 02:46:25 christos Exp $ */
+/* $NetBSD: compat_glob.c,v 1.3 2013/10/04 20:49:16 christos Exp $ */
/*
* Written by Jason R. Thorpe <thorpej%NetBSD.org@localhost>, October 21, 1997.
@@ -28,4 +28,8 @@
__warn_references(globfree,
"warning: reference to compatibility globfree(); include <glob.h> for correct reference")
+#define stat compat_stat
+#define lstat compat_lstat
+#define fstat compat_fstat
+
#include "gen/glob.c"
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/gen/compat_time.c
--- a/lib/libc/compat/gen/compat_time.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/gen/compat_time.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_time.c,v 1.2 2009/01/11 02:46:25 christos Exp $ */
+/* $NetBSD: compat_time.c,v 1.3 2013/10/04 20:49:16 christos Exp $ */
/*
* Written by Jason R. Thorpe <thorpej%NetBSD.org@localhost>, October 21, 1997.
@@ -24,4 +24,7 @@
#define timeval timeval50
#define time_t int32_t
+
+#define gettimeofday compat_gettimeofday
+
#include "gen/time.c"
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/gen/compat_times.c
--- a/lib/libc/compat/gen/compat_times.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/gen/compat_times.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_times.c,v 1.2 2009/01/11 02:46:25 christos Exp $ */
+/* $NetBSD: compat_times.c,v 1.3 2013/10/04 20:49:16 christos Exp $ */
/*
* Ben Harris, 2002.
@@ -25,4 +25,7 @@
#define __times_rusage struct rusage50
#define __times_timeval struct timeval50
+#define getrusage compat_getrusage
+#define gettimeofday compat_gettimeofday
+
#include "gen/times.c"
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/sys/compat___fhstat30.c
--- a/lib/libc/compat/sys/compat___fhstat30.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/sys/compat___fhstat30.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat___fhstat30.c,v 1.4 2009/01/11 02:46:25 christos Exp $ */
+/* $NetBSD: compat___fhstat30.c,v 1.5 2013/10/04 20:49:16 christos Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: compat___fhstat30.c,v 1.4 2009/01/11 02:46:25 christos Exp $");
+__RCSID("$NetBSD: compat___fhstat30.c,v 1.5 2013/10/04 20:49:16 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#define __LIBC12_SOURCE__
@@ -45,11 +45,13 @@
__warn_references(fhstat,
"warning: reference to compatibility __fhstat30(); include <sys/mount.h> to generate correct reference")
+__strong_alias(__fhstat30, compat___fhstat30)
+
/*
* Convert old fhstat() call to new calling convention
*/
int
-__fhstat30(const struct compat_30_fhandle *fhp, struct stat30 *sb)
+compat___fhstat30(const struct compat_30_fhandle *fhp, struct stat30 *sb)
{
- return __fhstat40(fhp, FHANDLE30_SIZE, sb);
+ return compat___fhstat40(fhp, FHANDLE30_SIZE, sb);
}
diff -r 3cbc933ab20b -r f944cc60ef38 lib/libc/compat/sys/compat___stat13.c
--- a/lib/libc/compat/sys/compat___stat13.c Fri Oct 04 18:08:02 2013 +0000
+++ b/lib/libc/compat/sys/compat___stat13.c Fri Oct 04 20:49:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat___stat13.c,v 1.4 2009/01/11 02:46:26 christos Exp $ */
+/* $NetBSD: compat___stat13.c,v 1.5 2013/10/04 20:49:16 christos Exp $ */
/*
* Copyright (c) 1997 Frank van der Linden
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: compat___stat13.c,v 1.4 2009/01/11 02:46:26 christos Exp $");
+__RCSID("$NetBSD: compat___stat13.c,v 1.5 2013/10/04 20:49:16 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#define __LIBC12_SOURCE__
@@ -58,6 +58,10 @@
__warn_references(fhstat,
"warning: reference to compatibility fhstat(); include <sys/mount.h> to generate correct reference")
+__strong_alias(__stat13, compat___stat13)
+__strong_alias(__fstat13, compat___fstat13)
+__strong_alias(__lstat13, compat___lstat13)
+__strong_alias(fhstat, compat_fhstat)
/*
* Convert from a new to an old stat structure.
@@ -92,7 +96,7 @@
}
int
-__stat13(const char *file, struct stat13 *ost)
+compat___stat13(const char *file, struct stat13 *ost)
{
struct stat nst;
int ret;
@@ -104,7 +108,7 @@
}
int
-__fstat13(int f, struct stat13 *ost)
+compat___fstat13(int f, struct stat13 *ost)
{
struct stat nst;
int ret;
@@ -116,7 +120,7 @@
}
Home |
Main Index |
Thread Index |
Old Index