xref: /titanic_51/usr/src/uts/common/sys/utsname.h (revision ba3594ba9b5dd4c846c472a8d657edcb7c8109ac)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
237c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*
27*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28*ba3594baSGarrett D'Amore  *
297c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
307c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
317c478bd9Sstevel@tonic-gate  */
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifndef _SYS_UTSNAME_H
347c478bd9Sstevel@tonic-gate #define	_SYS_UTSNAME_H
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #define	_SYS_NMLN	257	/* 4.0 size of utsname elements	*/
437c478bd9Sstevel@tonic-gate 				/* Must be at least 257 to	*/
447c478bd9Sstevel@tonic-gate 				/* support Internet hostnames.	*/
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
477c478bd9Sstevel@tonic-gate #ifndef	SYS_NMLN
487c478bd9Sstevel@tonic-gate #define	SYS_NMLN	_SYS_NMLN
497c478bd9Sstevel@tonic-gate #endif
507c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate struct utsname {
537c478bd9Sstevel@tonic-gate 	char	sysname[_SYS_NMLN];
547c478bd9Sstevel@tonic-gate 	char	nodename[_SYS_NMLN];
557c478bd9Sstevel@tonic-gate 	char	release[_SYS_NMLN];
567c478bd9Sstevel@tonic-gate 	char	version[_SYS_NMLN];
577c478bd9Sstevel@tonic-gate 	char	machine[_SYS_NMLN];
587c478bd9Sstevel@tonic-gate };
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
617c478bd9Sstevel@tonic-gate extern struct utsname utsname;
627c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #if !defined(_KERNEL)
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #if defined(__i386) && !defined(__amd64)
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate extern int uname(struct utsname *);
697c478bd9Sstevel@tonic-gate extern int _uname(struct utsname *);
70edb432ddSRichard Lowe 
717c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
727c478bd9Sstevel@tonic-gate extern int nuname(struct utsname *);
737c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
747c478bd9Sstevel@tonic-gate extern int _nuname(struct utsname *);
757c478bd9Sstevel@tonic-gate 
76edb432ddSRichard Lowe /*
77edb432ddSRichard Lowe  * On i386 in SVID.2 uname() returns a utsname structure with 8 byte members,
78edb432ddSRichard Lowe  * and nuname() returns the real struct utsname.  In SVID.3 uname and nuname
79edb432ddSRichard Lowe  * are equivalent.  Anyone who includes this header gets the SVID.3 behaviour.
80edb432ddSRichard Lowe  * The SVID.2 behaviour exists solely for compatibility, and is what is
81edb432ddSRichard Lowe  * implemented by the libc uname/_uname entrypoints.
82edb432ddSRichard Lowe  */
83edb432ddSRichard Lowe #ifdef __PRAGMA_REDEFINE_EXTNAME
84edb432ddSRichard Lowe #pragma redefine_extname	uname	_nuname
85edb432ddSRichard Lowe #pragma redefine_extname	_uname	_nuname
867c478bd9Sstevel@tonic-gate #else
87edb432ddSRichard Lowe #define	uname	_nuname
88edb432ddSRichard Lowe #define	_uname	_nuname
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #else	/* defined(__i386) */
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate extern int uname(struct utsname *);
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate #endif	/* defined(__i386) */
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate #else	/* !(_KERNEL) */
987c478bd9Sstevel@tonic-gate /*
997c478bd9Sstevel@tonic-gate  * Routine to retrieve the nodename as seen in the current process's zone.
1007c478bd9Sstevel@tonic-gate  */
1017c478bd9Sstevel@tonic-gate extern char *uts_nodename(void);
1027c478bd9Sstevel@tonic-gate #endif	/* !(_KERNEL) */
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1057c478bd9Sstevel@tonic-gate }
1067c478bd9Sstevel@tonic-gate #endif
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate #endif	/* _SYS_UTSNAME_H */
109