crashconf.2 (2010 09)

c
crashconf(2) crashconf(2)
DT_KDDATA Kernel dynamic data pages
DT_FSDATA File system metadata pages
DT_USTACK User process stack pages
DT_SUPERPG Unused Superpage pool pages
DT_USERPG User process pages
Security Restrictions
The
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.
EXAMPLES
The following examples demonstrate the usage of
crashconf().
Example 1: Adding a Crash Dump Device
char *device_to_add[1];
int device_return[1];
...
crashconf(DC_DEVICES, 0, 0, 1, device_to_add, device_return);
Example 2: Force Dumping of Buffer Cache
crashconf(DC_INCLUDE, DT_BCACHE, 0, 0, NULL, NULL);
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, 0, DT_UNUSED, 0, NULL, NULL);
Example 6: Marking Dump Device List Persistent
crashconf(DC_PERSISTENT, 0, 0, 0, NULL, NULL);
HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3