diff options
author | 2015-09-05 11:25:29 +0000 | |
---|---|---|
committer | 2015-09-05 11:25:29 +0000 | |
commit | e969daf4a8f765131cbd48e476dd61c41663bd01 (patch) | |
tree | 8536e445c12d68dfd334f28ebcb70c61a890f461 /lib/libc | |
parent | typos in comments: xfree -> free (diff) | |
download | wireguard-openbsd-e969daf4a8f765131cbd48e476dd61c41663bd01.tar.xz wireguard-openbsd-e969daf4a8f765131cbd48e476dd61c41663bd01.zip |
Use new framework for wrapping cat{open,gets,close}(), eliminating
_cat* in the process.
ok kettenis@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/Symbols.list | 3 | ||||
-rw-r--r-- | lib/libc/hidden/nl_types.h | 30 | ||||
-rw-r--r-- | lib/libc/include/namespace.h | 5 | ||||
-rw-r--r-- | lib/libc/nls/Makefile.inc | 5 | ||||
-rw-r--r-- | lib/libc/nls/_catclose.c | 23 | ||||
-rw-r--r-- | lib/libc/nls/_catgets.c | 23 | ||||
-rw-r--r-- | lib/libc/nls/_catopen.c | 23 | ||||
-rw-r--r-- | lib/libc/nls/catclose.c | 5 | ||||
-rw-r--r-- | lib/libc/nls/catgets.c | 5 | ||||
-rw-r--r-- | lib/libc/nls/catopen.c | 6 | ||||
-rw-r--r-- | lib/libc/string/strerror_r.c | 5 |
11 files changed, 42 insertions, 91 deletions
diff --git a/lib/libc/Symbols.list b/lib/libc/Symbols.list index 10e01678c7d..0da28d95e17 100644 --- a/lib/libc/Symbols.list +++ b/lib/libc/Symbols.list @@ -1196,9 +1196,6 @@ setservent_r sockatmark /* nls */ -_catclose -_catgets -_catopen catclose catgets catopen diff --git a/lib/libc/hidden/nl_types.h b/lib/libc/hidden/nl_types.h new file mode 100644 index 00000000000..bb76c473ef4 --- /dev/null +++ b/lib/libc/hidden/nl_types.h @@ -0,0 +1,30 @@ +/* $OpenBSD: nl_types.h,v 1.1 2015/09/05 11:25:30 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +/* $OpenBSD: nl_types.h,v 1.1 2015/09/05 11:25:30 guenther Exp $ */ +/* $NetBSD: nl_types.h,v 1.6 1996/05/13 23:11:15 jtc Exp $ */ + +#ifndef _LIBC_NL_TYPES_H_ +#define _LIBC_NL_TYPES_H_ + +#include_next <nl_types.h> +#include "namespace.h" + +PROTO_NORMAL(catclose); +PROTO_NORMAL(catgets); +PROTO_NORMAL(catopen); + +#endif /* _LIBC_NL_TYPES_H_ */ diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h index b0cad502a31..381ccc35be7 100644 --- a/lib/libc/include/namespace.h +++ b/lib/libc/include/namespace.h @@ -1,12 +1,9 @@ -/* $OpenBSD: namespace.h,v 1.3 2015/08/31 02:53:56 guenther Exp $ */ +/* $OpenBSD: namespace.h,v 1.4 2015/09/05 11:25:30 guenther Exp $ */ #ifndef _LIBC_NAMESPACE_H_ #define _LIBC_NAMESPACE_H_ /* These will be replaced with symbol renaming ala PROTO_NORMAL */ -#define catclose _catclose -#define catgets _catgets -#define catopen _catopen #define strtoq _strtoq #define strtouq _strtouq #define sys_errlist _sys_errlist diff --git a/lib/libc/nls/Makefile.inc b/lib/libc/nls/Makefile.inc index ac8eabe2d36..7d77149a6b1 100644 --- a/lib/libc/nls/Makefile.inc +++ b/lib/libc/nls/Makefile.inc @@ -1,9 +1,6 @@ -# $OpenBSD: Makefile.inc,v 1.4 1998/11/20 11:18:45 d Exp $ +# $OpenBSD: Makefile.inc,v 1.5 2015/09/05 11:25:30 guenther Exp $ .PATH: ${LIBCSRCDIR}/nls SRCS+= catclose.c catgets.c catopen.c MAN+= catclose.3 catgets.3 catopen.3 - -# indirect reference stubs, to be removed soon. -SRCS+= _catclose.c _catgets.c _catopen.c diff --git a/lib/libc/nls/_catclose.c b/lib/libc/nls/_catclose.c deleted file mode 100644 index 4fdf78781d6..00000000000 --- a/lib/libc/nls/_catclose.c +++ /dev/null @@ -1,23 +0,0 @@ -/* $OpenBSD: _catclose.c,v 1.6 2012/12/05 23:20:00 deraadt Exp $ */ -/* - * Written by J.T. Conklin, 10/05/94 - * Public domain. - */ - -#include <sys/types.h> - -#ifdef __indr_reference -__indr_reference(_catclose,catclose); -#else - -#include <nl_types.h> - -extern int _catclose(nl_catd); - -int -catclose(nl_catd catd) -{ - return _catclose(catd); -} - -#endif diff --git a/lib/libc/nls/_catgets.c b/lib/libc/nls/_catgets.c deleted file mode 100644 index 532faeec6cf..00000000000 --- a/lib/libc/nls/_catgets.c +++ /dev/null @@ -1,23 +0,0 @@ -/* $OpenBSD: _catgets.c,v 1.6 2012/12/05 23:20:00 deraadt Exp $ */ -/* - * Written by J.T. Conklin, 10/05/94 - * Public domain. - */ - -#include <sys/types.h> - -#ifdef __indr_reference -__indr_reference(_catgets,catgets); -#else - -#include <nl_types.h> - -extern char * _catgets(nl_catd, int, int, const char *); - -char * -catgets(nl_catd catd, int set_id, int msg_id, const char *s) -{ - return _catgets(catd, set_id, msg_id, s); -} - -#endif diff --git a/lib/libc/nls/_catopen.c b/lib/libc/nls/_catopen.c deleted file mode 100644 index 5107826ecfc..00000000000 --- a/lib/libc/nls/_catopen.c +++ /dev/null @@ -1,23 +0,0 @@ -/* $OpenBSD: _catopen.c,v 1.7 2012/12/05 23:20:00 deraadt Exp $ */ -/* - * Written by J.T. Conklin, 10/05/94 - * Public domain. - */ - -#include <sys/types.h> - -#ifdef __indr_reference -__indr_reference(_catopen,catopen); -#else - -#include <nl_types.h> - -extern nl_catd _catopen(const char *, int); - -nl_catd -catopen(const char *name, int oflag) -{ - return _catopen(name, oflag); -} - -#endif diff --git a/lib/libc/nls/catclose.c b/lib/libc/nls/catclose.c index 887fd0bc695..c68b68493aa 100644 --- a/lib/libc/nls/catclose.c +++ b/lib/libc/nls/catclose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: catclose.c,v 1.7 2008/06/26 05:42:05 ray Exp $ */ +/* $OpenBSD: catclose.c,v 1.8 2015/09/05 11:25:30 guenther Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. @@ -37,7 +37,7 @@ #include <stdlib.h> int -_catclose(nl_catd catd) +catclose(nl_catd catd) { if (catd == (nl_catd) -1) { errno = EBADF; @@ -51,3 +51,4 @@ _catclose(nl_catd catd) return 0; } +DEF_WEAK(catclose); diff --git a/lib/libc/nls/catgets.c b/lib/libc/nls/catgets.c index e5a034da8a1..b0ecc598f00 100644 --- a/lib/libc/nls/catgets.c +++ b/lib/libc/nls/catgets.c @@ -1,4 +1,4 @@ -/* $OpenBSD: catgets.c,v 1.8 2008/06/26 05:42:05 ray Exp $ */ +/* $OpenBSD: catgets.c,v 1.9 2015/09/05 11:25:30 guenther Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. @@ -36,7 +36,7 @@ #include <nl_types.h> char * -_catgets(nl_catd catd, int set_id, int msg_id, const char *s) +catgets(nl_catd catd, int set_id, int msg_id, const char *s) { struct _nls_cat_hdr *cat_hdr; struct _nls_set_hdr *set_hdr; @@ -94,3 +94,4 @@ _catgets(nl_catd catd, int set_id, int msg_id, const char *s) /* not found */ return (char *) s; } +DEF_WEAK(catgets); diff --git a/lib/libc/nls/catopen.c b/lib/libc/nls/catopen.c index cd1c70047b1..e3ba4724a5e 100644 --- a/lib/libc/nls/catopen.c +++ b/lib/libc/nls/catopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: catopen.c,v 1.16 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: catopen.c,v 1.17 2015/09/05 11:25:30 guenther Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. @@ -45,9 +45,8 @@ static nl_catd load_msgcat(const char *); -/* ARGSUSED */ nl_catd -_catopen(const char *name, int oflag) +catopen(const char *name, int oflag) { char tmppath[PATH_MAX]; char *nlspath; @@ -156,6 +155,7 @@ _catopen(const char *name, int oflag) return (nl_catd) -1; } +DEF_WEAK(catopen); static nl_catd load_msgcat(const char *path) diff --git a/lib/libc/string/strerror_r.c b/lib/libc/string/strerror_r.c index 90aa012360d..2262cb512d5 100644 --- a/lib/libc/string/strerror_r.c +++ b/lib/libc/string/strerror_r.c @@ -1,10 +1,7 @@ -/* $OpenBSD: strerror_r.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: strerror_r.c,v 1.10 2015/09/05 11:25:30 guenther Exp $ */ /* Public Domain <marc@snafu.org> */ #ifdef NLS -#define catclose _catclose -#define catgets _catgets -#define catopen _catopen #include <nl_types.h> #endif |