[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 1

open Subroutine Interface for Data Link Control (DLC) Devices

Purpose

Opens the generic data link control (GDLC) device manager by special file name.

Syntax

#include <fcntl.h>
#include <sys/gdlextcb.h>
int open (path, oflag, mode)
or
int openx (path, oflag, mode, ext)
char *path;
int oflag;
int mode;
int ext;

Description

The open subroutine allows the application user to open a GDLC device manager by specifying the DLC special file name and the target device handler special file name. Since the GDLC device manager is multiplexed, more than one process can open it (or the same process many times) and still have unique channel identifications.

Each open carries the communications device handler's special file name so that the DLC knows on which port to transfer data. This name must directly follow the DLC's special file name. For example, in the /dev/dlcether/ent0 character string, ent0 is the special file name of the Ethernet device handler. GDLC obtains this name using its dlcmpx routine.

Parameters

path Consists of a character string containing the /dev special file name of the GDLC device manager, with the name of the communications device handler appended as follows:
/dev/dlcether/ent0
oflag Specifies a value for the file status flag. The GDLC device manager ignores all but the following flags:
O_RDWR Open for reading and writing. This must be set for GDLC or the open will fail.
O_NDELAY, O_NONBLOCK Subsequent reads with no data present and writes that cannot get enough resources will return immediately. The calling process is not put to sleep.
mode Specifies the O_CREAT mode parameter. This is ignored by GDLC.
ext Specifies the extended subroutine parameter. This is a pointer to the dlc_open_ext extended I/O structure for the open subroutines. See "open Subroutine Extended Parameters for DLC" for more information on this parameter.

Return Values

Upon successful completion, the open subroutine returns a valid file descriptor that identifies the opened GDLC channel.

If an error occurs, a value of -1 is returned with one of the following error values available using the errno global variable, as defined in the /usr/include/sys/errno.h file:

ECHILD Indicates that the device manager cannot create a kernel process.
EINVAL Indicates an invalid value.
ENODEV Indicates that no such device handler is present.
ENOMEM Indicates insufficient resources to satisfy the open subroutine.
EFAULT Indicates that a kernel service, such as the copyin or initp kernel service, has failed.

Implementation Specifics

Each GDLC supports the open subroutine interface by way of its dlcopen and dlcmpx entry points. This subroutine may be called from the process environment only.

Related Information

The dlcmpx entry point.

The copyin kernel service, initp kernel service.

close Subroutine Interface for Data Link Control (DLC) Devices, open Subroutine Extended Parameters for DLC.

Generic Data Link Control (GDLC) Environment Overview in AIX Version 4.3 Communications Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]