Allocates use of a network device driver (NDD).
Item | Description |
---|---|
nddname | Specifies the device name to be allocated. |
nddpp | Indicates the address of the pointer to a ndd structure. |
The ns_alloc network service searches the Network Service (NS) device chain to find the device driver with the specified nddname parameter. If the service finds a match, it increments the reference count for the specified device driver. If the reference count is incremented to 1, the ndd_open subroutine specified in the ndd structure is called to open the device driver.
The following example illustrates the ns_alloc network service:
struct ndd *nddp;
error = ns_alloc("en0", &nddp);
If a match is found and the ndd_open subroutine to the device is successful, a pointer to the ndd structure for the specified device is stored in the nddpp parameter. If no match is found or the open of the device is unsuccessful, a non-zero value is returned.
Item | Description |
---|---|
0 | Indicates the operation was successful. |
ENODEV | Indicates an invalid network device. |
ENOENT | Indicates no network demuxer is available for this device. |
The ndd_open routine may specify other return values.