Attaches a network device to the network subsystem.
#include <sys/ndd.h>
int ns_attach (nddp)
struct ndd * nddp;
Item | Description |
---|---|
nddp | Specifies a pointer to an ndd structure describing the device to be attached. |
The ns_attach network service places the device into the available network service (NS) device chain. The network device driver (NDD) should be prepared to be opened after the ns_attach network service is called.
The following example illustrates the ns_attach network service:
struct ndd ndd;
ndd.ndd_name = "en0";
ndd.ndd_addrlen = 6;
ndd.ndd_hdrlen = 14;
ndd.ndd_mtu = ETHERMTU;
ndd.ndd_mintu = 60;
ndd.ndd_type = NDD_ETHER;
ndd.ndd_flags =
NDD_BROADCAST | NDD_SIMPLEX;
ndd.ndd_open = entopen;
ndd.ndd_output = entwrite;
ndd.ndd_ctl = entctl;
ndd.ndd_close = entclose;
.
.
.
ns_attach(&ndd);
Item | Description |
---|---|
0 | Indicates the operation was successful. |
EEXIST | Indicates the device is already in the available NS device chain. |