z/OS UNIX System Services File System Interface Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Cancel phase

z/OS UNIX System Services File System Interface Reference
SA23-2285-00

The LFS goes through the Cancel phase by invoking vn_select(Cancel) for each file descriptor when:
  • One of the PFS events has occurred and osi_selpost is called
  • Any PFS reported status during the Query phase
  • The timeout value expires
Note that if a PFS reported status during the Query phase, the loop that was doing the queries is terminated; therefore, a cancel request may be received by a PFS even though no query was done.
During vn_select(Cancel), the PFS is expected to do the following:
  1. Scan the pending-select structures that are chained from the inode for one with a matching select token. If one is found, it is removed so that osi_selpost is not invoked for that select token after the PFS returns from this vn_select(Cancel) call.
    Note: It is the PFS's responsibility to serialize the cancellation of a pending select with its asynchronous event handler, which may be attempting to call osi_selpost. It is critical that osi_selpost never be called for a particular select token after the PFS returns to the LFS from a call to vn_select(Cancel) for that same select token.

    It is not unusual for the PFS not to find a pending select to be canceled, as it could have been already removed by the event handler, or this PFS may not have been queried in the first place.

  2. After the PFS ensures that the select is no longer pending, it checks for the requested status and returns this information to the LFS.
The LFS collects status from all of the files and reports it back to the program that called select().
Note: Although it is rare in practice, there is nothing to stop a user from selecting and reading on the same socket from two different processes or threads. Consequently, it is technically possible that an event that is reported by select may no longer be true when the selecting program finally acts on the information. A selecting program may not act on the information, but pass it off to another process to handle. Therefore, reporting back on select does not reserve the data or buffers for the caller; it merely reports the status of the file at that time.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014