Closing Interface Special Files - HP 9000 Series 300 Tutorials Manual

Device i/o and user interfacing hp-ux concepts and tutorials
Hide thumbs Also See for HP 9000 Series 300:
Table of Contents

Advertisement

Closing Interface Special Files
Good programming practice dictates that an open interface special file should
be closed when a program is through using it by executing a close(2) system
call. This guideline is valid even though any open files are automatically closed
by the HP-UX operating system when a process terminates (via exit(2) or a
return from the main routine).
Note
HP-UX limits the number of files a given process (program)
can have open at one time to NO_FILE as defined in the
/usr/include/param.h header file. Series 300 systems limit
the number of open DIL files in the entire system to the value
of the configurable parameter ndilbuffers (default is 30). See
the HP- UX System Administrator Manual for information on
changing this value. Series 800 systems limit the number of
open DIL files to 16 per interface.
The close system call requires the entity identifier corresponding to the open
interface special file that is being closed. The following code segment shows
how to open and close an HP -IB interface:
#include <fcntl.h>
#include <errno.h>
maine)
{
}
int eid;
if ((eid
=
open ("/dev/raw_hpib", O_RDWR))
==
-1) {
printf("open failed, errno
=
%d\n", errno);
exit(2);
}
/* Code to perform I/O operations
(read/write in this case) on the open interface. */
close(eid);
Upon completion of the close system call, the entity identifier is no longer valid
and is available for the system to assign to another file. If the file is again
2-6
General-Purpose Routines

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Hp 9000 series 800

Table of Contents