Get information about the channels owned by the specified process.
#include <sys/procfs.h> #define DCMD_PROC_CHANNELS __DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 29, procfs_channel)
The arguments to devctl() are:
Argument | Value |
---|---|
filedes | A file descriptor for the process. |
dcmd | DCMD_PROC_CHANNELS |
dev_data_ptr | NULL, or an array of procfs_channel structures |
n_bytes | 0, or the size of the array |
dev_info_ptr | A pointer to an integer, where the number of channels will be stored |
Call this the first time with an argument of NULL to get the number of channels:
devctl(fd, DCMD_PROC_CHANNELS, NULL, 0, &n);
Next, allocate a buffer that's large enough to hold a procfs_channel structure (see debug_channel_t in <sys/debug.h>) for each channel, and pass it to another devctl() call:
my_buffer = (procfs_channel *) malloc( sizeof(procfs_channel) * n ); if ( my_buffer == NULL ) { /* Not enough memory. */ } devctl( fd, DCMD_PROC_CHANNELS, my_buffer, sizeof(procfs_channel) * n, &dummy);