Skip Navigation Links | |
Exit Print View | |
man pages section 3: Extended Library Functions, Volume 1 Oracle Solaris 11.1 Information Library |
Extended Library Functions, Volume 1
CIRCLEQ_HEAD_INITIALIZER(3EXT)
cpc_walk_generic_events_all(3CPC)
cpc_walk_generic_events_pic(3CPC)
ct_dev_status_get_aset(3CONTRACT)
ct_dev_status_get_dev_state(3CONTRACT)
ct_dev_status_get_minor(3CONTRACT)
ct_dev_status_get_noneg(3CONTRACT)
ct_dev_tmpl_clear_noneg(3CONTRACT)
ct_dev_tmpl_get_aset(3CONTRACT)
ct_dev_tmpl_get_minor(3CONTRACT)
ct_dev_tmpl_get_noneg(3CONTRACT)
ct_dev_tmpl_set_aset(3CONTRACT)
ct_dev_tmpl_set_minor(3CONTRACT)
ct_dev_tmpl_set_noneg(3CONTRACT)
ct_event_read_critical(3CONTRACT)
ct_pr_event_get_exitstatus(3CONTRACT)
ct_pr_event_get_gcorefile(3CONTRACT)
ct_pr_event_get_pcorefile(3CONTRACT)
ct_pr_event_get_pid(3CONTRACT)
ct_pr_event_get_ppid(3CONTRACT)
ct_pr_event_get_sender(3CONTRACT)
ct_pr_event_get_senderct(3CONTRACT)
ct_pr_event_get_signal(3CONTRACT)
ct_pr_event_get_zcorefile(3CONTRACT)
ct_pr_status_get_contracts(3CONTRACT)
ct_pr_status_get_fatal(3CONTRACT)
ct_pr_status_get_members(3CONTRACT)
ct_pr_status_get_param(3CONTRACT)
ct_pr_status_get_svc_aux(3CONTRACT)
ct_pr_status_get_svc_creator(3CONTRACT)
ct_pr_status_get_svc_ctid(3CONTRACT)
ct_pr_status_get_svc_fmri(3CONTRACT)
ct_pr_tmpl_get_fatal(3CONTRACT)
ct_pr_tmpl_get_param(3CONTRACT)
ct_pr_tmpl_get_svc_aux(3CONTRACT)
ct_pr_tmpl_get_svc_fmri(3CONTRACT)
ct_pr_tmpl_get_transfer(3CONTRACT)
ct_pr_tmpl_set_fatal(3CONTRACT)
ct_pr_tmpl_set_param(3CONTRACT)
ct_pr_tmpl_set_svc_aux(3CONTRACT)
ct_pr_tmpl_set_svc_fmri(3CONTRACT)
ct_pr_tmpl_set_transfer(3CONTRACT)
ct_status_get_cookie(3CONTRACT)
ct_status_get_critical(3CONTRACT)
ct_status_get_holder(3CONTRACT)
ct_status_get_informative(3CONTRACT)
ct_status_get_nevents(3CONTRACT)
ct_status_get_nevid(3CONTRACT)
ct_status_get_ntime(3CONTRACT)
ct_status_get_qtime(3CONTRACT)
ct_status_get_state(3CONTRACT)
ct_status_get_zoneid(3CONTRACT)
ct_tmpl_get_critical(3CONTRACT)
ct_tmpl_get_informative(3CONTRACT)
ct_tmpl_set_critical(3CONTRACT)
ct_tmpl_set_informative(3CONTRACT)
dat_evd_clear_unwaitable(3DAT)
dat_get_consumer_context(3DAT)
dat_registry_add_provider(3DAT)
dat_registry_list_providers(3DAT)
dat_registry_remove_provider(3DAT)
dat_set_consumer_context(3DAT)
devid_deviceid_to_nmlist(3DEVID)
di_link_next_by_lnode(3DEVINFO)
di_link_next_by_node(3DEVINFO)
di_lnode_private_get(3DEVINFO)
di_lnode_private_set(3DEVINFO)
di_minor_private_get(3DEVINFO)
di_minor_private_set(3DEVINFO)
di_path_client_devfs_path(3DEVINFO)
di_path_client_next_path(3DEVINFO)
di_path_phci_next_path(3DEVINFO)
di_path_prop_lookup_bytes(3DEVINFO)
di_path_prop_lookup_int64s(3DEVINFO)
di_path_prop_lookup_ints(3DEVINFO)
di_path_prop_lookup_strings(3DEVINFO)
di_path_prop_strings(3DEVINFO)
di_prom_prop_lookup_bytes(3DEVINFO)
di_prom_prop_lookup_ints(3DEVINFO)
di_prom_prop_lookup_strings(3DEVINFO)
di_prop_lookup_bytes(3DEVINFO)
di_prop_lookup_int64(3DEVINFO)
di_prop_lookup_strings(3DEVINFO)
ea_match_object_catalog(3EXACCT)
- create and destroy a snapshot of kernel device tree
cc [ flag... ] file... -ldevinfo [ library... ] #include <libdevinfo.h> di_node_t di_init(const char *phys_path, uint_t flags);
void di_fini(di_node_t root);
Snapshot content specification. The possible values can be a bitwise OR of at least one of the following:
Include subtree.
Include properties.
Include minor node data.
Include all of the above.
Include multipath path node data.
Include device layering data.
Include only a single node without properties, minor nodes, or path nodes.
Physical path of the root device node of the snapshot. See di_devfs_path(3DEVINFO).
Handle obtained by calling di_init().
The di_init() function creates a snapshot of the kernel device tree and returns a handle of the root device node. The caller specifies the contents of the snapshot by providing flag and phys_path.
The di_fini() function destroys the snapshot of the kernel device tree and frees the associated memory. All handles associated with this snapshot become invalid after the call to di_fini().
Upon success, di_init() returns a handle. Otherwise, DI_NODE_NIL is returned and errno is set to indicate the error.
The di_init() function can set errno to any error code that can also be set by open(2), ioctl(2) or mmap(2). The most common error codes include:
Insufficient privilege for accessing device configuration data.
Either the device named by phys_path is not present in the system, or the devinfo(7D) driver is not installed properly.
Either phys_path is incorrectly formed or the flags argument is invalid.
Example 1 Using the libdevinfo Interfaces To Print All Device Tree Node Names
The following is an example using the libdevinfo interfaces to print all device tree device node names:
/* * Code to print all device tree device node names */ #include <stdio.h> #include <libdevinfo.h> int prt_nodename(di_node_t node, void *arg) { printf("%s\n", di_node_name(node)); return (DI_WALK_CONTINUE); } main() { di_node_t root_node; if((root_node = di_init("/", DINFOSUBTREE)) == DI_NODE_NIL) { fprintf(stderr, "di_init() failed\n"); exit(1); } di_walk_node(root_node, DI_WALK_CLDFIRST, NULL, prt_nodename); di_fini(root_node); }
Example 2 Using the libdevinfo Interfaces To Print The Physical Path Of SCSI Disks
The following example uses the libdevinfo interfaces to print the physical path of SCSI disks:
/* * Code to print physical path of scsi disks */ #include <stdio.h> #include <libdevinfo.h> #define DISK_DRIVER "sd" /* driver name */ void prt_diskinfo(di_node_t node) { int instance; char *phys_path; /* * If the device node exports no minor nodes, * there is no physical disk. */ if (di_minor_next(node, DI_MINOR_NIL) == DI_MINOR_NIL) { return; } instance = di_instance(node); phys_path = di_devfs_path(node); printf("%s%d: %s\n", DISK_DRIVER, instance, phys_path); di_devfs_path_free(phys_path); } void walk_disknodes(di_node_t node) { node = di_drv_first_node(DISK_DRIVER, node); while (node != DI_NODE_NIL) { prt_diskinfo(node); node = di_drv_next_node(node); } } main() { di_node_t root_node; if ((root_node = di_init("/", DINFOCPYALL)) == DI_NODE_NIL) { fprintf(stderr, "di_init() failed\n"); exit(1); } walk_disknodes(root_node); di_fini(root_node); }
See attributes(5) for descriptions of the following attributes:
|