JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 2: System Calls     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

System Calls

access(2)

acct(2)

acl(2)

adjtime(2)

alarm(2)

brk(2)

chdir(2)

chmod(2)

chown(2)

chroot(2)

close(2)

creat(2)

dup(2)

exec(2)

execl(2)

execle(2)

execlp(2)

execv(2)

execve(2)

execvex(2)

execvp(2)

_Exit(2)

_exit(2)

exit(2)

faccessat(2)

facl(2)

fchdir(2)

fchmod(2)

fchmodat(2)

fchown(2)

fchownat(2)

fchroot(2)

fcntl(2)

fexecve(2)

fgetlabel(2)

fork1(2)

fork(2)

forkall(2)

forkallx(2)

forkx(2)

fpathconf(2)

fstat(2)

fstatat(2)

fstatvfs(2)

futimens(2)

futimesat(2)

getacct(2)

getcontext(2)

getdents(2)

getegid(2)

geteuid(2)

getgid(2)

getgroups(2)

getisax(2)

getitimer(2)

getlabel(2)

getmsg(2)

getpflags(2)

getpgid(2)

getpgrp(2)

getpid(2)

getpmsg(2)

getppid(2)

getppriv(2)

getprojid(2)

getrctl(2)

getrlimit(2)

getsid(2)

gettaskid(2)

getuid(2)

getustack(2)

ioctl(2)

issetugid(2)

kill(2)

lchown(2)

link(2)

linkat(2)

llseek(2)

lseek(2)

lstat(2)

_lwp_cond_broadcast(2)

_lwp_cond_reltimedwait(2)

_lwp_cond_signal(2)

_lwp_cond_timedwait(2)

_lwp_cond_wait(2)

_lwp_continue(2)

_lwp_info(2)

_lwp_kill(2)

_lwp_mutex_lock(2)

_lwp_mutex_trylock(2)

_lwp_mutex_unlock(2)

_lwp_self(2)

_lwp_sema_init(2)

_lwp_sema_post(2)

_lwp_sema_trywait(2)

_lwp_sema_wait(2)

_lwp_suspend(2)

memcntl(2)

meminfo(2)

mincore(2)

mkdir(2)

mkdirat(2)

mknod(2)

mknodat(2)

mmap(2)

mmapobj(2)

mount(2)

mprotect(2)

msgctl(2)

msgget(2)

msgids(2)

msgrcv(2)

msgsnap(2)

msgsnd(2)

munmap(2)

nice(2)

ntp_adjtime(2)

ntp_gettime(2)

open(2)

openat(2)

pathconf(2)

pause(2)

pcsample(2)

pipe(2)

poll(2)

p_online(2)

ppoll(2)

pread(2)

priocntl(2)

priocntlset(2)

processor_bind(2)

processor_info(2)

profil(2)

pset_assign(2)

pset_bind(2)

pset_create(2)

pset_destroy(2)

pset_getattr(2)

pset_info(2)

pset_list(2)

pset_setattr(2)

putacct(2)

putmsg(2)

putpmsg(2)

pwrite(2)

read(2)

readlink(2)

readlinkat(2)

readv(2)

rename(2)

renameat(2)

resolvepath(2)

rmdir(2)

sbrk(2)

semctl(2)

semget(2)

semids(2)

semop(2)

semtimedop(2)

setcontext(2)

setegid(2)

seteuid(2)

setgid(2)

setgroups(2)

setitimer(2)

setpflags(2)

setpgid(2)

setpgrp(2)

setppriv(2)

setrctl(2)

setregid(2)

setreuid(2)

setrlimit(2)

setsid(2)

settaskid(2)

setuid(2)

setustack(2)

shmadv(2)

shmat(2)

shmctl(2)

shmdt(2)

shmget(2)

shmids(2)

shmop(2)

sigaction(2)

sigaltstack(2)

sigpending(2)

sigprocmask(2)

sigsend(2)

sigsendset(2)

sigsuspend(2)

sigwait(2)

__sparc_utrap_install(2)

stat(2)

statvfs(2)

stime(2)

swapctl(2)

symlink(2)

symlinkat(2)

sync(2)

sysfs(2)

sysinfo(2)

time(2)

times(2)

uadmin(2)

ulimit(2)

umask(2)

umount(2)

umount2(2)

uname(2)

unlink(2)

unlinkat(2)

ustat(2)

utime(2)

utimensat(2)

utimes(2)

uucopy(2)

vfork(2)

vforkx(2)

vhangup(2)

waitid(2)

wracct(2)

write(2)

writev(2)

yield(2)

sysinfo

- get and set system information strings

Synopsis

#include <sys/systeminfo.h>

int sysinfo(int command, char *buf, long count);

Description

The sysinfo() function copies information relating to the operating system on which the process is executing into the buffer pointed to by buf. It can also set certain information where appropriate commands are available. The count parameter indicates the size of the buffer.

The POSIX P1003.1 interface (see standards(5)) sysconf(3C) provides a similar class of configuration information, but returns an integer rather than a string.

The values for command are as follows:

SI_SYSNAME

Copy into the array pointed to by buf the string that would be returned by uname(2) in the sysnamefield. This is the name of the implementation of the operating system, for example, SunOS or UTS.

SI_HOSTNAME

Copy into the array pointed to by buf a string that names the present host machine. This is the string that would be returned by uname() in the nodenamefield. This hostname or nodename is often the name the machine is known by locally. The hostname is the name of this machine as a node in some network. Different networks might have different names for the node, but presenting the nodename to the appropriate network directory or name-to-address mapping service should produce a transport end point address. The name might not be fully qualified. Internet host names can be up to 256 bytes in length (plus the terminating null).

SI_SET_HOSTNAME

Copy the null-terminated contents of the array pointed to by buf into the string maintained by the kernel whose value will be returned by succeeding calls to sysinfo() with the command SI_HOSTNAME. This command requires that {PRIV_SYS_ADMIN} is asserted in the effective set of the calling process.

SI_RELEASE

Copy into the array pointed to by buf the string that would be returned by uname(2) in the release field. Typical values might be 5.2 or 4.1.

SI_VERSION

Copy into the array pointed to by buf the string that would be returned by uname(2) in the versionfield. The syntax and semantics of this string are defined by the system provider.

SI_MACHINE

Copy into the array pointed to by buf the string that would be returned by uname(2) in the machine field, for example, sun4u.

SI_ARCHITECTURE

Copy into the array pointed to by buf a string describing the basic instruction set architecture of the current system, for example, sparc, mc68030, m32100, or i386. These names might not match predefined names in the C language compilation system.

SI_ARCHITECTURE_64

Copy into the array pointed to by buf a string describing the 64-bit instruction set architecture of the current system, for example, sparcv9 or amd64. These names might not match predefined names in the C language compilation system. This subcode is not recognized on systems that do not allow a 64-bit application to run.

SI_ARCHITECTURE_32

Copy into the array pointed to by buf a string describing the 32-bit instruction set architecture of the current system, for example, sparc or i386. These names might not match predefined names in the C language compilation system.

SI_ARCHITECTURE_K

Copy into the array pointed to by buf a string describing the kernel instruction set architecture of the current system for example sparcv9 or i386. These names might not match predefined names in the C language compilation system.

SI_ARCHITECTURE_NATIVE

Copy into the array pointed to by buf a string describing the native instruction set architecture of the current system, for example sparcv9 or i386. These names might not match predefined names in the C language compilation system.

SI_ISALIST

Copy into the array pointed to by buf the names of the variant instruction set architectures executable on the current system.

The names are space-separated and are ordered in the sense of best performance. That is, earlier-named instruction sets might contain more instructions than later-named instruction sets; a program that is compiled for an earlier-named instruction set will most likely run faster on this machine than the same program compiled for a later-named instruction set.

Programs compiled for an instruction set that does not appear in the list will most likely experience performance degradation or not run at all on this machine.

The instruction set names known to the system are listed in isalist(5); these names might not match predefined names or compiler options in the C language compilation system.

This command is obsolete and might be removed in a future release. See getisax(2) and the Linker and Libraries Guide for a better way to handle instruction set extensions.

SI_PLATFORM

Copy into the array pointed to by buf a string describing the specific model of the hardware platform, for example, SUNW,Sun-Blade-1500, SUNW,Sun-Fire-T200, or i86pc.

SI_HW_PROVIDER

Copies the name of the hardware manufacturer into the array pointed to by buf.

SI_HW_SERIAL

Copy into the array pointed to by buf a string which is the ASCII representation of the hardware-specific serial number of the physical machine on which the function is executed. This might be implemented in Read-Only Memory, using software constants set when building the operating system, or by other means, and might contain non-numeric characters. If the function is executed within a non-global zone that emulates a host identifier, then the ASCII representation of the zone's host identifier is copied into the array pointed to by buf. It is anticipated that manufacturers will not issue the same “serial number” to more than one physical machine. The pair of strings returned by SI_HW_PROVIDER and SI_HW_SERIAL is not guaranteed to be unique across all vendor's SVR4 implementations and could change over the lifetime of a given system.

SI_SRPC_DOMAIN

Copies the Secure Remote Procedure Call domain name into the array pointed to by buf.

SI_SET_SRPC_DOMAIN

Set the string to be returned by sysinfo() with the SI_SRPC_DOMAIN command to the value contained in the array pointed to by buf. This command requires that {PRIV_SYS_ADMIN} is asserted in the effective set of the calling process.

SI_DHCP_CACHE

Copy into the array pointed to by buf an ASCII string consisting of the ASCII hexidecimal encoding of the name of the interface configured by boot(1M) followed by the DHCPACK reply from the server. This command is intended for use only by the dhcpagent(1M) DHCP client daemon for the purpose of adopting the DHCP maintenance of the interface configured by boot.

Return Values

Upon successful completion, the value returned indicates the buffer size in bytes required to hold the complete value and the terminating null character. If this value is no greater than the value passed in count, the entire string was copied. If this value is greater than count, the string copied into buf has been truncated to count-1 bytes plus a terminating null character.

Otherwise, -1 is returned and errno is set to indicate the error.

Errors

The sysinfo() function will fail if:

EFAULT

The buf argument does not point to a valid address.

EINVAL

The count argument for a non-SET command is less than 0 or the data for a SET command exceeds the limits established by the implementation.

EPERM

The {PRIV_SYS_ADMIN} was not asserted in the effective set of the calling process.

Usage

In many cases there is no corresponding programming interface to set these values; such strings are typically settable only by the system administrator modifying entries in /etc/system or the code provided by the particular OEM reading a serial number or code out of read-only memory, or hard-coded in the version of the operating system.

A good estimation for count is 257, which is likely to cover all strings returned by this interface in typical installations.

See Also

boot(1M), dhcpagent(1M), getisax(2), uname(2), gethostid(3C), gethostname(3C), sysconf(3C), isalist(5), privileges(5), standards(5), zones(5)

Linker and Libraries Guide