syssgi(2) syssgi(2) NAME syssgi - Silicon Graphics Inc. system call SYNOPSIS #include <sys/syssgi.h> ptrdiff_t syssgi (int request, ...); DESCRIPTION syssgi is a system interface specific to Silicon Graphics systems. The value of the request parameter determines the meaning of the remaining arguments. In the descriptions below, arg1, arg2, and arg3 refer to parameters following the request argument. The following requests are currently supported: SGI_SYSID Returns an identifier for the given system. This identifier is guaranteed to be unique within the Silicon Graphics product family. The argument arg1 for this request should be a pointer to a character buffer of MAXSYSIDSIZE characters. SGI_RDNAME Returns the process name for the process id specified in arg1. The arguments arg2 and arg3 give the address and length, respectively, of the buffer which will receive the name string. This name corresponds to the name in the COMMAND column of ps(1) for the given process. The returned string will be null-terminated unless the caller's buffer is too small, in which case the string is simply truncated at the size of the buffer. The return value gives the number of bytes copied to the buffer, which will be the minimum of the size of the buffer and the size of the field in the user structure that contains the process name. Note that this means that the returned length will typically be greater than the actual length of the name string (in the sense of strlen(3)). SGI_RDUBLK Was an obsolete feature and has been discontinued. Users are directed to the process filesystem (see proc(4).) to obtain information about a process. SGI_PROCSZ Was an obsolete feature and has been discontinued. Users are directed to the process filesystem (see proc(4).) to obtain information about a process. SGI_TUNE This request allows the superuser to redefine tunable variables to more accurately reflect system use. The argument arg1 is a buffer pointer which specifies a group name of the tunable variable. The argument arg2 is a buffer pointer which holds the address of the tunable variable. arg3 should be a buffer containing the tune value. systune(1M) is the preferred way to change these variables. This system call is only supported for 64 bit programs when running on 64 bit kernels. SGI_IDBG Used internally for kernel debugging. SGI_INVENT Returns information about the hardware inventory of the system. If arg1 is SGI_INV_SIZEOF then the size of an individual inventory item is returned. If arg1 is SGI_INV_READ then arg3 bytes worth of inventory records are read into the buffer specified by arg2. Applications should use getinvent(3) to access this information; this internal interface may change. SGI_SETLED If arg1 is 1, turn on an LED on the machine. 0 turns it off. This is only available on some SGI computers. SGI_SETNVRAM Sets nvram variable with given value. Nvram variables are subset of IRIS PROM Monitor environment variables, which are saved in EEPROM, and the values of which are preserved over power cycle. arg1 is a buffer pointer which specifies a name of nvram variable. arg2 is a buffer pointer which holds the value of the nvram variable. Both buffers pointed by arg1 and arg2 must be at least 128 bytes long. SGI_GETNVRAM Retrieve values of the IRIS PROM Monitor environment variables. (see sgikopt(2)). arg1 is a buffer pointer which specifies either name or index of a IRIS PROM Monitor variable. Both name and index must be ASCII string. arg2 is a buffer pointer in which the value be returned. Both buffers pointed by arg1 and arg2 should be at least 128 bytes long. SGI_SETSID SGI_SETPGID SGI_SYSCONF SGI_PATHCONF SGI_SETGROUPS SGI_GETGROUPS SGI_SETTIMEOFDAY SGI_SPROFIL SGI_RUSAGE SGI_SIGSTACK SGI_NETPROC SGI_NFSCNVT SGI_GETPGID SGI_GETSID SGI_MPCWAROFF SGI_SPIPE SGI_FDHI SGI_CREATE_UUID SGI_GETASH SGI_SETASH SGI_GETPRID SGI_GETDFLTPRID SGI_SETPRID SGI_GETSPINFO SGI_SETSPINFO SGI_ARSESS_CTL SGI_ARSESS_OP SGI_GETJUSAGE SGI_SETJUSAGE SGI_GETJLIMIT SGI_SETJLIMIT SGI_GETJID SGI_KILLJOB SGI_MAKENEWJOB SGI_SETWAITJOBPID SGI_WAITJOB SGI_NEWARRAYSESS These are all interfaces that are used to implement various libc functions. These are all subject to change and should not be called directly by applications. SGI_GETPLABEL SGI_SETPLABEL SGI_GETLABEL SGI_SETLABEL SGI_SATREAD SGI_SATWRITE SGI_SATCTL SGI_LOADATTR SGI_UNLOADATTR SGI_RECVLUMSG SGI_PLANGMOUNT SGI_GETPSOACL SGI_SETPSOACL These are all interfaces that are used to implement various libc and libnsl (enhanced security) functions. These are all subject to change and should not be called directly by applications. SGI_READB SGI_WRITEB These are used to read and write character special devices that are greater than 2Gb. arg1 is the file descriptor pointing to a character special device. arg2 is a buffer in the user's space where the data will be transferred from or to. arg3 is the block (512 bytes) offset of where to start the transaction. arg4 is the number of blocks to transfer. This interface is superseded in IRIX Release 5.3 by the use of lseek64, which provides 64-bit seek offsets. SGI_SSYNC Synchronously flush out all delayed write buffers. SGI_BDFLUSHCNT Allows the calling process to delay the kernel from writing out delayed write buffers by arg1 seconds. After that, the normal flush delay will apply. At the end of the system call, the kernel will return the old flush delay. This system call is intended to be used in conjunction with the SGI_SSYNC system call on a single processor machine to provide the calling process with an environment that is free of any unwanted disk activities for the period of arg1 seconds. SGI_QUERY_FTIMER Used by ftimer(1). SGI_CYCLECNTR_SIZE Returns the size of the integer needed to read the cycle counter. This is useful along with SGI_QUERY_CYCLECNTR to write machine independent code to read the free running hardware counter. On some machines the value needs to be read into a 32 bit integer, and on others the cycle counter needs to be read into a 64 bit integer. SGI_QUERY_CYCLECNTR It is best to use the clock_gettime(2) interface with the CLOCK_SGI_CYCLE clock instead of mapping the counter yourself. This is a much more portable solution. That said, this syssgi option returns information about the free running hardware counter on systems that support a high resolution timer. Upon successful completion, an address for the counter is returned. The size of the integer needed to hold the count can be found using the SGI_CYCLECNTR_SIZE syssgi call. On machines with 64-bit counters it can either be read with two separate 32-bit accesses (one at the returned address, and the other at the returned address plus four), or with a single 64-bit "long long" access in MIPS3 or MIPS4 applications. The address must be mapped read-only into the user process space via the mmap(2) system call into /dev/mmem before any access can be made. Not all systems return page aligned addresses, so the address must be masked to be page aligned, and the offset added back to the returned mmap address, in order for code to work on all systems, so typically you would see code like this (ignoring error checking): #include <stddef.h> #include <sys/types.h> #include <fcntl.h> #include <sys/mman.h> #include <sys/syssgi.h> #if CYCLE_COUNTER_IS_64BIT typedef unsigned long long iotimer_t; #else typedef unsigned int iotimer_t; #endif __psunsigned_t phys_addr, raddr; unsigned int cycleval; volatile iotimer_t counter_value, *iotimer_addr; int fd, poffmask; poffmask = getpagesize() - 1; phys_addr = syssgi(SGI_QUERY_CYCLECNTR, &cycleval); raddr = phys_addr & ~poffmask; fd = open("/dev/mmem", O_RDONLY); iotimer_addr = (volatile iotimer_t *)mmap(0, poffmask, PROT_READ, MAP_PRIVATE, fd, (off_t)raddr); iotimer_addr = (iotimer_t *)((__psunsigned_t)iotimer_addr + (phys_addr & poffmask)); counter_value = *iotimer_addr; For the Challenge/ONYX and OCTANE families 64-bit counter, define CYCLE_COUNTER_IS_64BIT. Sixty-four bit (MIPS 3, MIPS 4) applications may simply use the example above with CYCLE_COUNTER_IS_64BIT defined. Thirty-two bit applications need to read the halves separately and check for wrap-around. Pass iotimer_addr and two unsigned int pointers to the following routine: void read_time(volatile unsigned *iotimer_addr, unsigned *high, unsigned *low) { while (1) { *high = *iotimer_addr; *low = *(iotimer_addr + 1); if (*high == *iotimer_addr) { return; } } } This will put the top and bottom 32 bits of the time into the memory pointed to by high and low, respectively. If you only need 32-bit precision, you may use the original example but replace the counter_value assignment with counter_value = *(iotimer_addr + 1); SGI_SETTIMETRIM changes the value of timetrim from the initial value configured in /var/sysgen/mtune/kernel (see lboot(1M) and adjtime(2)). The argument arg1 is interpreted as an integer, which gives the new value of timetrim. SGI_GETTIMETRIM obtains the current value of timetrim. The argument arg1 must be a pointer to an integer, into which the timetrim value is stored. SGI_SET_AUTOPWRON Is used to set the time at which the system will automatically power on (if it is powered off at that time). If the system is not powered off at that time (hasn't yet been shutdown and powered off), the call has no effect. Rebooting the system clears the value. This is currently implemented only on OCTANE, Indy, Indigo2 and Challenge M systems. The 3rd argument is a time_t whose value is the time in seconds from 1 Jan 1970 midnight GMT at which to turn the system on. Also see the wakeupat(1M) man page. See the ENOPKG description below for systems not implementing this function. SGI_IOPROBE SGI_CONFIG These are used by lboot(1M) to determine the system configuration. SGI_MCONFIG Is used by lboot(1M) and ml(1M) to load, register, unload, unregister and list dynamically loadable kernel modules. This is subject to change and should not be called directly by applications. SGI_TOSSTSAVE Used by runtime linkers to remove any saved text address spaces. SGI_GET_UST This interface is used to implement various libdmedia functions. It is subject to change and should not be called directly by applications. SGI_SET_FP_PRECISE Modifies floating point exception mode for the current process. This is only meaningful on processors that support multiple modes. On these processors, the default mode is usually performance mode (also called imprecise exception mode) and non-sequential memory (nsmm) mode. On all other processors, the default is precise exception and sequential (smm) mode. arg1 should be non-zero in order to enable precise exception mode. A value of zero will disable precise exception mode thereby enabling performance mode. In precise exception mode, all floating point exceptions/interrupts are reported on the instruction that caused the exception, so floating point signal handlers can clean up the FP state and continue execution. In performance mode, floating point interrupts are asynchronous and the reported program counter is meaningless. Precise mode is provided as a means of debugging processes and/or backward compatibility for programs that have knowledge of the FP state. It causes significant performance degradation. Currently this call only has an affect on machines with an R8000 processor since that is the only processor which supports this dual execution mode. SGI_GET_FP_PRECISE Returns the floating point exception mode for the current process. A zero value indicates that precise exception mode is disabled. SGI_FP_IMPRECISE_SUPP Returns non-zero if the current processor supports imprecise exceptions for floating point instructions. SGI_SET_CONFIG_SMM Modifies the memory model for floating point instructions for the current process. Non-sequential memory access mode (turned on by default on processors that support it) allows the processor to do floating point and integer memory operations out of order, thus possibly providing better performance. SGI_GET_CONFIG_SMM Returns non-zero if the current process is in sequential memory mode. SGI_CONFIG_NSMM_SUPP Returns non-zero if the current processor supports non- sequential memory operations. SGI_SET_FP_PRESERVE Forces floating point state information (precise/imprecise exception mode as well as sequential/non-sequential memory mode) to be preserved across exec(2) system calls. SGI_FS_INUMBERS This interface is used to extract a list of valid inode numbers from a filesystem. It is intended to be called iteratively, to obtain the entire set of inodes. Currently the only filesystem type supporting this operation is the XFS filesystem. arg1 is a file descriptor either for the block or character device containing the filesystem of interest (it must be mounted) or for an open file in the filesystem of interest. arg2 is a pointer to a variable of type ino64_t containing the last inode returned, initially it should be 0. arg3 is the size of the array of structures specified by arg4. arg4 is the address of an array of structures, of type xfs_inogrp_t (definition found in <sys/fs/xfs_itable.h>). The structure has the following elements: xi_startino (starting inode number), xi_alloccount (count of bits set in xi_allocmask), and xi_allocmask (mask of allocated inodes in this group). The bitmask is 64 bits long, and the least significant bit corresponds to inode xi_startino. Each bit is set if the corresponding inode is in use. arg5 is a pointer to a count of returned values, filled in by the call. A count value of 0 means that the inode table has been exhausted. SGI_FS_BULKSTAT This interface is used to extract inode information (stat information) "in bulk" from a filesystem. It is intended to be called iteratively, to obtain information about the entire set of inodes in a filesystem. Currently the only filesystem type supporting this operation is the XFS filesystem. arg1 is a file descriptor either for the block or character device containing the filesystem of interest (it must be mounted) or for an open file in the filesystem of interest. arg2 is a pointer to a variable of type ino64_t containing the last inode returned, initially it should be 0. arg3 is the size of the array of structures specified by arg4. arg4 is the address of an array of structures, of type xfs_bstat_t (definition found in <sys/fs/xfs_itable.h>). Many of the elements in the structure are the same as for the stat structure. The structure has the following elements: bs_ino (inode number), bs_mode (type and mode), bs_nlink (number of links), bs_uid (user id), bs_gid (group id), bs_rdev (device value), bs_blksize (block size of the filesystem), bs_size (file size in bytes), bs_atime (access time), bs_mtime (modify time), bs_ctime (inode change time), bs_blocks (number of blocks used by the file), bs_xflags (extended flags), bs_extsize (extent size), bs_extents (number of extents), bs_gen (generation count), bs_projid (project id), bs_dmevmask (DMIG event mask), bs_dmstate (DMIG state information), and bs_aextents (attribute extent count). arg5 is a pointer to a count of returned values, filled in by the call. A count value of 0 means that the inode table has been exhausted. SGI_FS_BULKSTAT_SINGLE This interface is a variant of the SGI_FS_BULKSTAT interface, used to obtain information about a single inode. arg1 is a file descriptor either for the block or character device containing the filesystem of interest (it must be mounted) or for an open file in the filesystem of interest. arg2 is a pointer to a variable of type ino64_t containing the inode number of interest. arg3 is the address of a structure, of type xfs_bstat_t (definition found in <sys/fs/xfs_itable.h>). An error is returned if the inode number is invalid. SGI_XFS_FSOPERATIONS This interface is used to implement various filesystem operations on XFS filesystems. There are several sub- operations implemented. See the header file <sys/fs/xfs_fsops.h> for further information. arg1 is a file descriptor either for the block or character device containing the filesystem of interest (it must be mounted) or for an open file in the filesystem of interest. arg2 is the operation code, one of XFS_FS_GEOMETRY, XFS_FS_COUNTS, XFS_GROWFS_DATA, XFS_GROWFS_LOG, XFS_GROWFS_RT, XFS_FS_GOINGDOWN, XFS_FS_FREEZE, or XFS_FS_THAW. arg3 is a pointer to the input structure, of a type determined by the operation code; it may be null. arg4 is a pointer to the output structure, of a type determined by the operation code; it may be null. For XFS_FS_GEOMETRY (get filesystem mkfs- time information), the output structure is xfs_fsop_geom_t. For XFS_FS_COUNTS (get filesystem dynamic global information), the output structure is xfs_fsop_counts_t. The XFS_GROWFS_... operations are used to implement the xfs_growfs(1M) command, and are not described further. The XFS_FS_GOINGDOWN operation is used by umount(1M) to mark a busy filesystem as down before unmounting. The XFS_FS_FREEZE operation is used to flush buffers then block any further I/O to the disk. The XFS_FS_THAW operation enables resumption of I/O to the disk following the XFS_FS_FREEZE operation. Only the superuser may call functions that modify data or hinder access to the filesystem (XFS_GROWFS_DATA, XFS_GROWFS_LOG, XFS_GROWFS_RT, XFS_SET_RESBLKS, XFS_FS_GOINGDOWN, XFS_FS_FREEZE, and XFS_FS_THAW). SGI_PATH_TO_HANDLE SGI_PATH_TO_FSHANDLE SGI_FD_TO_HANDLE SGI_OPEN_BY_HANDLE SGI_READLINK_BY_HANDLE SGI_ATTR_LIST_BY_HANDLE SGI_ATTR_MULTI_BY_HANDLE SGI_FSSETDM_BY_HANDLE These are all interfaces that are used to implement various libdm functions. The only filesystem that supports these operations is XFS. They are all subject to change and should not be called directly by applications. SGI_ENUMASHS SGI_GETARSESS SGI_GETASMACHID SGI_PIDSINASH SGI_SETASMACHID These are all interfaces that are used to implement various libarray functions. They are all subject to change and should not be used directly by applications. SGI_ACL_GET SGI_ACL_SET SGI_ALLOCSHARENA SGI_BTOOLGET SGI_BTOOLREINIT SGI_BTOOLSIZE SGI_CACHEFS_SYS SGI_CAP_GET SGI_CAP_SET SGI_CKPT_SYS SGI_CONST SGI_DBA_CONFIG SGI_DYIELD SGI_ELFMAP SGI_ERROR_FORCE SGI_EVENTCTR SGI_FO_DUMP SGI_FO_SWITCH SGI_GETGRPPID SGI_GETSESPID SGI_GETVPID SGI_GET_CONTEXT_INFO SGI_GET_CONTEXT_NAME SGI_GET_DISMISSED_EXC_CNT SGI_GET_EVCONF SGI_GRIO SGI_IO_SHOW_AUX_INFO SGI_JOINARRAYSESS SGI_KAIO_READ SGI_KAIO_STATS SGI_KAIO_SUSPEND SGI_KAIO_USERINIT SGI_KAIO_WRITE SGI_KTHREAD SGI_LOCKDSYS SGI_MAC_GET SGI_MAC_SET SGI_MEMPROF_CLEARALL SGI_MEMPROF_GET SGI_MEMPROF_START SGI_MEMPROF_STOP SGI_MINRSS SGI_MODULE_INFO SGI_NFSNOTIFY SGI_NOFPE SGI_NUMA_STATS_GET SGI_NUMA_TESTS SGI_NUMA_TUNE SGI_NUM_MODULES SGI_OBJ_EVICT SGI_PART_OPERATIONS SGI_PHYSP SGI_PMOCTL SGI_PRIO_QUERY_BW SGI_PROC_ATTR_GET SGI_PROC_ATTR_SET SGI_READ_DANGID SGI_RELEASE_NAME SGI_REVOKE SGI_RT_TSTAMP_ADDR SGI_RT_TSTAMP_CREATE SGI_RT_TSTAMP_DELETE SGI_RT_TSTAMP_EOB_MODE SGI_RT_TSTAMP_MASK SGI_RT_TSTAMP_START SGI_RT_TSTAMP_STOP SGI_RT_TSTAMP_UPDATE SGI_RT_TSTAMP_WAIT SGI_SBE_CLR_INFO SGI_SBE_GET_INFO SGI_SETVPID SGI_SET_DISMISSED_EXC_CNT SGI_SIGALTSTACK SGI_SPECULATIVE_EXEC SGI_SYMTAB SGI_SYNCH_CACHE_HANDLER SGI_TUNE_SET SGI_ULI SGI_USE_FP_BCOPY SGI_XLV_ATTR_CURSOR SGI_XLV_ATTR_GET SGI_XLV_ATTR_SET SGI_XLV_NEXT_RQST SGI_XLV_SET_TAB These are all interfaces that are used to implement various system library functions. They are all subject to change and should not be called directly by applications. SGI_UNSUPPORTED_MAP_RESERVED_RANGE When arg1 is 1 the reserved range from 0x30000000 to 0x40000000 is disabled on all future calls to mmap(2) and shmat(2) made by the process or its children. The effect this causes is as if MAP_SGI_ANYADDR or SHM_SGI_ANYADDR were used in all future mmap(2) and shmat(2) calls. This option is part of the process state and is inherited across fork(2) and exec(2) system calls. The reserved range may be re- enabled at any point with this system call by specifying a value of 0 for arg1. See sgi_use_anyaddr(1) for more information about the reserved range. SGI_GET_SYSLOG_LOGOPT Return the current systune(1M) value of syslog_logopt_mask. This is used by openlog(3c) and vsyslog(3c). ERRORS The following error codes may be returned by syssgi: [EFAULT] A buffer is referenced which is not in a valid part of the calling program's address space. [ENODEV] Could not determine system ID for SGI_SYSID. [ESRCH] Could not find given process for SGI_RDNAME. [EPERM] The effective user ID is not superuser. SGI_TUNE and SGI_IDBG require superuser privilege. [EINVAL] For SGI_TUNE, the first argument was not valid, or the tune structure contained invalid values. For SGI_INVENT arg1 was neither SGI_INV_READ nor SGI_INV_SIZEOF. For SGI_SETNVRAM arg1 is not valid nvram variable name. For SGI_GETNVRAM arg1 is not valid IRIS PROM Monitor environment variable name. For SGI_FS_BULKSTAT_SINGLE arg2 does not refer to a valid inode number for this filesystem. [ENXIO] SGI_SETNVRAM is not supported. [ENOPKG] SGI_SET_AUTOPWRON is not supported on this system. [ENOMEM] The specified buffer was not large enough to hold the entire list of process ids returned by the SGI_PIDSINASH function. SEE ALSO ftimer(1), hinv(1), mpadmin(1), sgi_use_anyaddr(1). adjtime(2), clock_gettime(2), clock_settime(2), setitimer(2), sigaction(2), DIAGNOSTICS Upon successful completion, a command dependent value (default of zero) is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. Page 12