Mercurial > illumos > illumos-gate
changeset 13816:38db9df20f58
3052 uname compatibility should be implemented with redefine_extname
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Keith Wesolowski <keith.wesolowski@joyent.com>
Approved by: Garrett D'Amore <garrett@damore.org>
author | Richard Lowe <richlowe@richlowe.net> |
---|---|
date | Sun, 22 Jul 2012 16:03:46 -0400 |
parents | 61cf2631639d |
children | 8e6d00a24b13 |
files | usr/src/cmd/mdb/common/kmdb/kmdb_stubs.c usr/src/cmd/mdb/common/kmdb/mapfile_skel usr/src/cmd/mdb/common/modules/mdb_ds/mdb_ds.c usr/src/cmd/mdb/intel/Makefile.libstand usr/src/cmd/mdb/intel/libstand/uname.c usr/src/uts/common/sys/utsname.h |
diffstat | 6 files changed, 15 insertions(+), 109 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/mdb/common/kmdb/kmdb_stubs.c Fri Sep 14 12:26:23 2012 -0400 +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_stubs.c Sun Jul 22 16:03:46 2012 -0400 @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Stubs for basic system services otherwise unavailable to the debugger. */ @@ -33,7 +31,6 @@ #include <unistd.h> #include <libproc.h> #include <sys/time.h> -#include <sys/utsname.h> #include <kmdb/kmdb_dpi.h> #include <kmdb/kmdb_promif.h> @@ -179,12 +176,3 @@ kmdb_dpi_reboot(); #endif } - -#if defined(__i386) && !defined(__amd64) -/*ARGSUSED*/ -int -_nuname(struct utsname *buf) -{ - return (-1); -} -#endif
--- a/usr/src/cmd/mdb/common/kmdb/mapfile_skel Fri Sep 14 12:26:23 2012 -0400 +++ b/usr/src/cmd/mdb/common/kmdb/mapfile_skel Sun Jul 22 16:03:46 2012 -0400 @@ -49,11 +49,6 @@ /* There should be only one - ours */ errno; /* variable */ - /* <sys/utsname.h> implictly references this on x86 */ -#if defined(__i386) && !defined(__amd64) - _nuname; -#endif - mdb_tgt_aread; mdb_dis_create; mdb_dis_destroy;
--- a/usr/src/cmd/mdb/common/modules/mdb_ds/mdb_ds.c Fri Sep 14 12:26:23 2012 -0400 +++ b/usr/src/cmd/mdb/common/modules/mdb_ds/mdb_ds.c Sun Jul 22 16:03:46 2012 -0400 @@ -24,23 +24,12 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * MDB developer support module. This module is loaded automatically when the * proc target is initialized and the target is mdb itself. In the future, we * should document these facilities in the answerbook to aid module developers. */ -/* - * The mere inclusion of sys/utsname.h causes _uname() and uname() to be - * defined on Intel, along with an external reference to _nuname(). Since we - * don't actually use uname (or utsname, for that matter) in this dmod, we'll - * prevent its inclusion. - */ -#define _SYS_UTSNAME_H -struct utsname; - #define _MDB #include <mdb/mdb_modapi.h> #include <mdb/mdb_frame.h>
--- a/usr/src/cmd/mdb/intel/Makefile.libstand Fri Sep 14 12:26:23 2012 -0400 +++ b/usr/src/cmd/mdb/intel/Makefile.libstand Sun Jul 22 16:03:46 2012 -0400 @@ -23,12 +23,8 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -SRCS += \ - stat.c \ - uname.c +SRCS += stat.c %.o: ../../libstand/%.c $(COMPILE.c) $<
--- a/usr/src/cmd/mdb/intel/libstand/uname.c Fri Sep 14 12:26:23 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * The inclusion of <sys/utsname.h> in a source file causes an automatic - * inclusion of a static definition of uname() that calls _nuname(). - */ - -#include <sys/utsname.h> -#include <errno.h> - -/*ARGSUSED*/ -int -_nuname(struct utsname *utsp) -{ - return (EINVAL); -}
--- a/usr/src/uts/common/sys/utsname.h Fri Sep 14 12:26:23 2012 -0400 +++ b/usr/src/uts/common/sys/utsname.h Sun Jul 22 16:03:46 2012 -0400 @@ -31,8 +31,6 @@ #ifndef _SYS_UTSNAME_H #define _SYS_UTSNAME_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/feature_tests.h> #ifdef __cplusplus @@ -67,13 +65,9 @@ #if defined(__STDC__) -#if !defined(__lint) -static int uname(struct utsname *); -static int _uname(struct utsname *); -#else extern int uname(struct utsname *); extern int _uname(struct utsname *); -#endif + #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) extern int nuname(struct utsname *); #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ @@ -81,13 +75,9 @@ #else /* defined(__STDC__) */ -#if !defined(__lint) -static int uname(); -static int _uname(); -#else extern int uname(); extern int _uname(); -#endif + #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) extern int nuname(); #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ @@ -95,30 +85,20 @@ #endif /* defined(__STDC__) */ - -#if !defined(__lint) -static int -#if defined(__STDC__) -_uname(struct utsname *_buf) +/* + * On i386 in SVID.2 uname() returns a utsname structure with 8 byte members, + * and nuname() returns the real struct utsname. In SVID.3 uname and nuname + * are equivalent. Anyone who includes this header gets the SVID.3 behaviour. + * The SVID.2 behaviour exists solely for compatibility, and is what is + * implemented by the libc uname/_uname entrypoints. + */ +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname uname _nuname +#pragma redefine_extname _uname _nuname #else -_uname(_buf) -struct utsname *_buf; +#define uname _nuname +#define _uname _nuname #endif -{ - return (_nuname(_buf)); -} - -static int -#if defined(__STDC__) -uname(struct utsname *_buf) -#else -uname(_buf) -struct utsname *_buf; -#endif -{ - return (_nuname(_buf)); -} -#endif /* !defined(__lint) */ #else /* defined(__i386) */