Writes transmit data to generic data link control (GDLC).
#include <sys/uio.h>
#include <sys/device.h>
#include <sys/gdlextcb.h>
int dlcwrite (devno, uiop, chan, ext)
The dlcwrite entry point is called when a user application program invokes a writex subroutine or when a kernel user calls the fp_write kernel service. An extended write is used in order to specify the type of data being sent, as well as the service access point (SAP) and link station (LS) identifiers.
The following fields in the uio and iov structures are used to control the write data transfer operation:
Field | Description |
---|---|
uio_iov | Points to an iovec structure. |
uio_iovcnt | Indicates the number of elements in the iovec structure. This must be set to a value of 1 for the kernel user, indicating that there is a single communications memory buffer (mbuf) chain associated with the write subroutine. |
uio_offset | Specifies the file offset established by a previous fp_lseek kernel service. This field is ignored by GDLC. |
uio_segflag | Indicates whether the data area is in application or kernel space. This field is set to the UIO_USERSPACE value by the file I/O subsystem if the data area is in application space. The field must be set to the UIO_SYSSPACE value by the kernel user to indicate kernel space. |
uio_fmode | Contains the value of the file mode set during an application open subroutine to GDLC or can be set directly during a fp_open kernel service to GDLC. |
uio_resid | Contains the total byte count of the transmit data area for application users. For kernel users, GDLC ignores this field since the communications memory buffer (mbuf) also carries this information. |
iovec structure | Contains the starting address and length of the transmit. |
iov_base | Specifies a variable in the iovec structure where GDLC gets the address of the application user's transmit data area or the address of the kernel user's transmit mbuf. |
iov_len | Specifies a variable in the iovec structure that contains the byte length of the application user's transmit data area. This variable is ignored by GDLC for kernel users, since the transmit mbuf contains a length field. |
Each GDLC supports the dlcwrite entry point as its switch table entry for the writex subroutine. The file system calls this entry point from the process environment only.
Item | Description |
---|---|
devno | Indicates major and minor device numbers. This is a dev_t device number that specifies both the major and minor device numbers of the GDLC device manager. One dev_t device number exists for each type of GDLC, such as Ethernet, Token-Ring, or SDLC. |
uiop | Points to the uio structure containing the write parameters. |
chan | Specifies the channel ID assigned by GDLC in the dlcmpx routine at open time. |
ext | Specifies the extended subroutine parameter. This is a pointer to the extended I/O structure. This data must be in the application space if the uio_fmode field indicates an application subroutine or in the kernel space if the uio_fmode field indicates a kernel subroutine. |
The following return values are defined in the /usr/include/sys/errno.h file:
Value | Description |
---|---|
0 | Indicates a successful operation. |
EAGAIN | Indicates that transmit is temporarily blocked and a sleep cannot be issued. |
EBADF | Indicates a bad file number (application). |
EINTR | Indicates that a signal interrupted the routine before it could complete successfully. |
EINVAL | Indicates an invalid value, such as too much data for a single packet. |
ENOMEM | Indicates insufficient resources to satisfy the write subroutine, such as a lack of communications memory buffers (mbufs). |
ENXIO | Indicates an invalid file pointer (kernel). |