[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

ns_alloc Network Service

Purpose

Allocates use of a network device driver (NDD).

Syntax

#include <sys/ndd.h>
int ns_alloc (nddname, nddpp)
       char *nddname;
       struct ndd **nddpp;

Parameters

nddname Specifies the device name to be allocated.
nddpp Indicates the address of the pointer to a ndd structure.

Description

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.

Examples

The following example illustrates the ns_alloc network service:

struct ndd   *nddp;
error = ns_alloc("en0", &nddp);

Return Values

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.

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.

Related Information

The ns_free network service.


[ Previous | Next | Contents | Home | Search ]