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 /* 277c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 287c478bd9Sstevel@tonic-gate * Use is subject to license terms. 297c478bd9Sstevel@tonic-gate */ 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifndef _SYS_UTSNAME_H 327c478bd9Sstevel@tonic-gate #define _SYS_UTSNAME_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #ifdef __cplusplus 377c478bd9Sstevel@tonic-gate extern "C" { 387c478bd9Sstevel@tonic-gate #endif 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #define _SYS_NMLN 257 /* 4.0 size of utsname elements */ 417c478bd9Sstevel@tonic-gate /* Must be at least 257 to */ 427c478bd9Sstevel@tonic-gate /* support Internet hostnames. */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 457c478bd9Sstevel@tonic-gate #ifndef SYS_NMLN 467c478bd9Sstevel@tonic-gate #define SYS_NMLN _SYS_NMLN 477c478bd9Sstevel@tonic-gate #endif 487c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate struct utsname { 517c478bd9Sstevel@tonic-gate char sysname[_SYS_NMLN]; 527c478bd9Sstevel@tonic-gate char nodename[_SYS_NMLN]; 537c478bd9Sstevel@tonic-gate char release[_SYS_NMLN]; 547c478bd9Sstevel@tonic-gate char version[_SYS_NMLN]; 557c478bd9Sstevel@tonic-gate char machine[_SYS_NMLN]; 567c478bd9Sstevel@tonic-gate }; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 597c478bd9Sstevel@tonic-gate extern struct utsname utsname; 607c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate #if defined(__i386) && !defined(__amd64) 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate #if defined(__STDC__) 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate extern int uname(struct utsname *); 697c478bd9Sstevel@tonic-gate extern int _uname(struct utsname *); 70*edb432ddSRichard 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 767c478bd9Sstevel@tonic-gate #else /* defined(__STDC__) */ 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate extern int uname(); 797c478bd9Sstevel@tonic-gate extern int _uname(); 80*edb432ddSRichard Lowe 817c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 827c478bd9Sstevel@tonic-gate extern int nuname(); 837c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 847c478bd9Sstevel@tonic-gate extern int _nuname(); 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #endif /* defined(__STDC__) */ 877c478bd9Sstevel@tonic-gate 88*edb432ddSRichard Lowe /* 89*edb432ddSRichard Lowe * On i386 in SVID.2 uname() returns a utsname structure with 8 byte members, 90*edb432ddSRichard Lowe * and nuname() returns the real struct utsname. In SVID.3 uname and nuname 91*edb432ddSRichard Lowe * are equivalent. Anyone who includes this header gets the SVID.3 behaviour. 92*edb432ddSRichard Lowe * The SVID.2 behaviour exists solely for compatibility, and is what is 93*edb432ddSRichard Lowe * implemented by the libc uname/_uname entrypoints. 94*edb432ddSRichard Lowe */ 95*edb432ddSRichard Lowe #ifdef __PRAGMA_REDEFINE_EXTNAME 96*edb432ddSRichard Lowe #pragma redefine_extname uname _nuname 97*edb432ddSRichard Lowe #pragma redefine_extname _uname _nuname 987c478bd9Sstevel@tonic-gate #else 99*edb432ddSRichard Lowe #define uname _nuname 100*edb432ddSRichard Lowe #define _uname _nuname 1017c478bd9Sstevel@tonic-gate #endif 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #else /* defined(__i386) */ 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate #if defined(__STDC__) 1067c478bd9Sstevel@tonic-gate extern int uname(struct utsname *); 1077c478bd9Sstevel@tonic-gate #else 1087c478bd9Sstevel@tonic-gate extern int uname(); 1097c478bd9Sstevel@tonic-gate #endif /* (__STDC__) */ 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate #endif /* defined(__i386) */ 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate #else /* !(_KERNEL) */ 1147c478bd9Sstevel@tonic-gate /* 1157c478bd9Sstevel@tonic-gate * Routine to retrieve the nodename as seen in the current process's zone. 1167c478bd9Sstevel@tonic-gate */ 1177c478bd9Sstevel@tonic-gate extern char *uts_nodename(void); 1187c478bd9Sstevel@tonic-gate #endif /* !(_KERNEL) */ 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1217c478bd9Sstevel@tonic-gate } 1227c478bd9Sstevel@tonic-gate #endif 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate #endif /* _SYS_UTSNAME_H */ 125