DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

uadmin(S)


uadmin -- administrative control

Syntax

cc . . . -lc
#include <sys/uadmin.h>
#include <prototype.h>

int uadmin(int cmd, int fcn, char *mdep);

Description

The uadmin system call provides control for basic administrative functions. This system call is tightly coupled to the system administrative procedures and is not intended for general use.

As specified by cmd, the following commands are available:


A_CLOCK
Sets the correction in seconds from GMT to local time which is used when reading/writing the real-time clock, for example via the sysi86 RTODC command to convert to local time the times passed by the user from/to GMT.

A_BDEVSYNC
Does an fsync(S) of the specified block device.

A_GETDEV
Gets the major number of a block or character device named in mdep. Set fcn to b for block devices or to c for character devices. mdep is the two- to four-character device driver prefix name. These names are listed in the first (``xnamex'') column of the /etc/conf/cf.d/mdevice file. If mdep is not specified, the following message is displayed:

A_GETDEV requires the mdep argument

The A_GETDEV command supports the following actions:


AD_GETBMAJ
Gets the major number of a block device.

AD_GETCMAJ
Gets the major number of a character device.

The following call gets the block major device number for the hard disk block device driver:

uadmin(A_GETDEV, AD_GETBMAJ, "hd")

A_SHUTDOWN
The system is shutdown. All user processes are killed, the buffer cache is flushed, and the root file system is unmounted. The action to be taken after the system has been shut down is specified by fcn. The functions are generic; the hardware capabilities vary on specific machines.

AD_HALT
Halt the processor until a key is entered to reboot the system.

AD_BOOT
Interactive reboot; user is prompted for system name.

AD_IBOOT
Interactive reboot; user is prompted for system name.

AD_PWRDOWN
Halt the processor; system remains down with no reboot option given.

AD_PWRNAP
Similar to AD_PWRDOWN, except that no action is taken if A/C power is available.


A_REBOOT
The system stops immediately without any further processing. The action to be taken next is specified by fcn: the supported actions are as for A_SHUTDOWN.

A_REMOUNT
The root file system is mounted again after having been fixed. This should be used only during the startup process.

A_SETCONFIG
Sets the system configuration. Currently, only the following function is available:

AD_PANICBOOT
If mdep is 1, this function causes the machine to reboot automatically after a kernel panic. If mdep is 0, this function causes the machine to wait for user intervention at the console before rebooting after a kernel panic.
The uadmin system call fails if any of the following is true:

EPERM
The effective user ID is not super user.

Diagnostics

Upon successful completion, the value returned depends on cmd as follows:

A_CLOCK
0

A_BDEVSYNC
0

A_GETDEV
Major number of specified device

A_SHUTDOWN
No return value

A_REBOOT
No return value

A_REMOUNT
0

A_SETCONFIG
0
Otherwise, a value of -1 is returned, and errno is set to indicate the error.

See also

fsync(S), mdevice(F)

Standards conformance

The uadmin routine is an extension of AT&T System V provided by The Santa Cruz Operation.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003