|
|
HP-UX Reference > Ccrashconf(2)HP-UX 11i Version 2: December 2007 Update |
|
NAMEcrashconf() — configure system crash dumps SYNOPSIS#include <sys/crashconf.h> int crashconf( int operation, int includeClasses, int excludeClasses, int deviceCount, char **devices, int *deviceReturn ); DESCRIPTIONcrashconf() changes the current system crash dump configuration. The crash dump configuration consists of:
Most system memory classes are in neither the included class list nor the excluded class list. Instead, the system determines whether or not to dump those classes of memory based on the type of crash that occurs. Note the system operator may request a full crash dump at the time the dump is taken. In this case, a full dump will be performed regardless of the contents of the excluded class list. Turning compression mode ON will result in smaller and faster dumps. Copying of compressed dump from the dump device over to the filesystem will also be faster using savecrash(1M). Since compressed dump requires additional processors and memory to do the compression, the system may fall back on uncompressed dump if it is not able to identify the processing resources required to do compressed dump after a system crash. Configuration changes made using crashconf() take effect immediately and remain in effect until the next system reboot, or until changed with a subsequent call to crashconf(). Parametersoperation is a bitmask specifying what crashconf() should do. It must have at least one of the following flags set:
operation may also have the following flag set:
includeClasses is a bitmask of classes that must be dumped. If it is set to DT_ALL, all dumps will be full dumps. Other allowed values are described under Classes, below. excludeClasses is a bitmask of classes that may not be dumped unless a full dump is required (due to the cause of the dump, or by explicit operator request). If it is set to DT_ALL, dumps will be disabled. Other allowed values are described under Classes, below. devices is an array of deviceCount pathnames of block device files for crash dump devices. To be valid, a device must be accessible and must not contain a file system. Where LVM partitions are in use, the device number must be for a partition, not the physical disk that contains it, and must represent a partition that is strictly contiguous on the physical disk. (LVM bad-block reallocation, and striping features may not be in use on the partition.) Depending on the disk type, the dump space may be restricted to the first 2GB or 4GB of the physical disk. deviceReturn is an array of deviceCount integers for returning the results of attempting to configure the corresponding device from the devices array. Upon return, each element is set to a numeric value indicating the result of configuring the corresponding device as follows:
Any parameters which are not used for the given operation should be set to zero. Note that both devices and deviceReturn must be specified if DC_DEVICES is specified. ClassesThe following system memory classes have been defined as of this writing. Refer to the output of the crashconf command or to /usr/include/sys/crashconf.h for definitions of any classes added since publication. The memory page size is 4Kb.
Security RestrictionsThe crashconf() system call is restricted to processes owned by superusers or with the DEVOPS privilege. See privileges(5) for more information about privileged access on systems that support fine-grained privileges. EXAMPLESThe following examples demonstrate the usage of crashconf(). Example 1: Adding a Crash Dump Devicechar *device_to_add[1]; int device_return[1]; ... crashconf(DC_DEVICES, 0, 0, 1, device_to_add, device_return); Example 4: Using CCERR_STRINGS and CCWARN_STRINGSAssume only one device, devices[0], is being added to the dump configuration. The following code will check the device_return[0] value and print corresponding error or warning messages. char *ccerrs[] = { CCERR_STRINGS }; int num_ccerrs = sizeof(ccerrs)/sizeof(*ccerrs); char *ccwarns[] = { CCWARN_STRINGS }; int num_ccwarns = sizeof(ccwarns)/sizeof(*ccwarns); char *device_to_add[1]; int device_return[1]; ... crashconf(DC_DEVICES, 0, 0, 1, device_to_add, device_return); if (device_return[0] < 0) { if (device_return[0] > -num_ccerrs) fprintf(stderr, "%s: error: %s", device_to_add[0], ccerrs[-device_return[0]]); } else if (device_return[0] > 0) { int warn_num; for (warn_num = 0; warn_num < NUM_CCWARNS; warn_num++) if (device_return[0] & (1 << warn_num)) fprintf(stderr,"%s: warning: %s", device_to_add[0], ccwarns[warn_num]); } RETURN VALUEUpon successful completion, zero is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. If DC_DEVICES is set, a one (1) may be returned to indicate that at least one device has been configured but one or more devices failed to configure. ERRORScrashconf() fails if one or more of the following is true:
WARNINGSOn systems running VxVM 3.5, the swap volumes to be configured for system crash dumps should be created with the usage type as swap during the creation of the swap volume. Not doing so will cause dump corruption. You could use the -U option of the vxassist command to do the same. (See vxassist(1M).) |
|