
TPMC118-SW-95 – QNX6 Neutrino Device Driver
Page 7 of 30
3 Device Input/Output functions
This chapter describes the interface to the device driver I/O system.
3.1 open()
NAME
open() - open a file descriptor
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int open (const char *pathname, int flags)
DESCRIPTION
The
open
function creates and returns a new file descriptor for the TPMC118 named by pathname.
The flags argument controls how the file is to be opened. TPMC118 devices must be opened
O_RDWR.
EXAMPLE
int fd;
fd = open(“/dev/tpmc118_0”, O_RDWR);
RETURNS
The normal return value from open is a non-negative integer file descriptor. In the case of an error, a
value of –1 is returned. The global variable
errno
contains the detailed error code.
ERRORS
Returns only Neutrino specific error codes, see Neutrino Library Reference.
SEE ALSO
Library Reference - open()