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


vn_accept — Accept a socket connection request

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

Function

The vn_accept operation accepts a connection request for a socket server from a socket client. It returns a new socket descriptor.

Environment on entry and exit

See Environment for PFS operations.

Input parameter format

vn_accept   (Token_structure,
             OSI_structure,
             Audit_structure,
             Sockaddr_length,
             Sockaddr,
             Open_flags,
             Vnode_token,
             Return_value,
             Return_code,
             Reason_code)

Parameters

Token_structure
Supplied parameter
Type:
TOKSTR
Length:
Specified by TOKSTR.ts_hdr.cblen.

The Token_structure represents the file (vnode) that is being operated on. It contains the PFS's initialization token, mount token, and the file token. Refer to LFS/PFS control block structure for a discussion of this structure, and to the TOKSTR typedef in BPXYPFSI in Interface structures for C language servers and clients for its mapping.

OSI_structure
Supplied and returned parameter
Type:
OSI
Length:
Specified by OSI.osi_hdr.cblen.

The OSI_structure contains information that is used by the OSI operations that may be called by the PFS. See OSI services for more information.

It also contains MVS-specific information that needs to be passed to the PFS, including SMF accounting fields, a work area, a recovery area, and an optional pointer to an output ATTR structure. For more details on the OSI structure, see The OSI structure.

This area is mapped by the OSI typedef in BPXYPFSI in Interface structures for C language servers and clients.

Audit_structure
Supplied parameter
Type:
CRED
Length:
Specified by CRED.cred_hdr.cblen.

The Audit_structure contains information that is used by the security product for access checks and auditing. It is passed to most SAF routines that are invoked by the PFS.

Refer to Security responsibilities and considerations for a discussion of security processing, and to the CRED typedef in BPXYPFSI in Interface structures for C language servers and clients for the mapping of this structure.

Sockaddr_length
Supplied and returned parameter
Type:
Integer
Length:
Fullword

A fullword that supplies the length of the Sockaddr buffer and returns the length of the Sockaddr structure that is returned.

Sockaddr
Supplied and returned parameter
Type:
SOCK
Length:
Specified by Sockaddr_length

A structure that varies depending on the address family type. On return, it contains the address that was used for this operation. For an example of this mapping for AF_INET, see in.h.

Open_flags
Supplied parameter
Type:
Structure
Length:
Fullword

A fullword that contains the bits that are associated with the socket. The defined values for this field are mapped by fcntl.h.

Vnode_token
Returned parameter
Type:
Token
Length:
8 bytes

An area in which a token that represents the newly created socket is returned.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword
A fullword in which the vn_accept operation returns the results of the operation, as one of the following:
Return_value
Meaning
-1
The operation was not successful. The Return_code and Reason_Code values must be filled in by the PFS when Return_value is -1.
0
The operation was successful.
Return_code
Returned parameter
Type:
Integer
Length:
Fullword

A fullword in which the vn_accept operation stores the return code. The vn_accept operation returns Return_code only if Return_value is -1. For a complete list of supported return code values, see z/OS UNIX System Services Messages and Codes.

The vn_accept operation should support at least the following error values:
Return_code Explanation
EINTR The request was interrupted by a signal.
EINVAL An incorrect request, such as a socket for which a listen has not been issued (that is, a server), was received.
EWOULDBLOCK The operation would have required a blocking wait, and this socket was marked as nonblocking.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

A fullword where the vn_accept operation stores the reason code. The vn_accept operation returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. These reason codes are documented by the PFS.

Implementation notes

  • Overview of vn_accept processing
    • For more information on vn_accept, refer to Creating, referring to, and closing socket vnodes.

      For more information on the semantics of this operation for a POSIX-conforming PFS, refer to the publications mentioned in Finding more information about sockets for the accept function.

    • The vn_accept service can be used from a multithreaded server, that is, a server with several threads simultaneously calling accept() on the same socket. The PFS must handle queuing for vn_accept requests on the same socket that are waiting to be satisfied. When a connection arrives it is given to one of the waiting vn_accept requestors. All the server threads are expected to be equal; their requests may be satisfied in any order.
  • Serialization provided by the LFS

    The vn_accept operation is invoked with an exclusive latch held on the vnode of the socket.

  • Security calls to be made by the PFS: None.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014