ZCOM C I/F Library Routines

PTFIND (3X)

Method 3: Retrieve the next terminal whose table has a sequence of matching bit patterns.

This mode is similar to Method 2 except that the caller also specifies a mask buffer, which is used to mask some unused bits in the physical terminal table before comparing with the specified data.

The mask buffer is AND’ed with the table content before comparison. Hence, the mask buffer should contain zeros for those unused bits and ones for those bits to be compared. The data buffer should have zeros for those unused bits, 0 or 1 for the bits to be compared.

Similarly, the search starts from the next terminal after the specified ZLU. (In fact, method 2 may be treated as a special case of this, if the mask buffer contains all ones.)

The libraries libzcom_c.a and libpthread.a must be linked into the calling program by giving the options “-lzcom_c -lpthread” to cc(1) or ld(1).

Threads

This routine may be called from a multi-threaded application using the

Considerations

POSIX (1003.1c) kernel threads API package. This routine has the

 

following characteristics when called by a multi-threaded application:

 

cancellation point

Thread cancellation can occur when a thread

 

 

calls this routine.

 

async-cancel unsafe

The calling thread’s cancelability type must be

 

 

PTHREAD_CANCEL_DEFERRED if

 

 

cancellation is enabled.

 

async-signal unsafe

It cannot be called from a signal handler.

 

fork unsafe

It cannot be called by a child process after

 

 

fork(2) but before exec(2).

164

Chapter 4