HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)

c
crashconf(2) crashconf(2)
Example 3: Disable Dumps
crashconf(DC_EXCLUDE | DC_REPLACE, 0, DT_ALL, 0, NULL, NULL);
Example 4: Using CCERR_STRINGS and CCWARN_STRINGS
Assume 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]);
}
Example 5: Setting Compressed Dump ON, Excluding Unused Pages
crashconf(DC_SETCOMPRESS | DC_EXCLUDE, DT_UNUSED, 0, NULL, NULL);
RETURN VALUE
Upon 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.
ERRORS
crashconf() fails if one or more of the following is true:
[EPERM] The calling process is not owned by superuser or not privileged.
[EINVAL] operation does not have at least one of
DC_INCLUDE , DC_EXCLUDE ,
DC_SETCOMPRESS, DC_SETNOCOMPRESS
,orDC_DEVICES set.
[EINVAL] operation has both
DC_INCLUDE and DC_EXCLUDE set, and the same class (bit) is
specified in both includeClasses and excludeClasses.
[EINVAL] operation has both
DC_SETCOMPRESS and DC_SETNOCOMPRESS
set.
[EINVAL] operation has
DC_DEVICES set, and deviceCount is less than zero or greater than
DC_MAXDEVICES .
WARNINGS
On 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).)
SEE ALSO
crashconf(1M), vxassist(1M), pstat_getcrashinfo(2), pstat_getcrashdev(2), privileges(5).
HP-UX 11i Version 2: December 2007 Update 3 Hewlett-Packard Company 73