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


vn_connect — Connect to a socket

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

Function

The vn_connect operation connects to a socket. The socket can be either a stream socket or a datagram socket. The connection is done for stream sockets by a client; a bind and a listen request must have preceded this request at the server.

Environment on entry and exit

See Environment for PFS operations.

Input parameter format

vn_connect  (Token_structure,
             OSI_structure,
             Audit_structure,
             Sockaddr_length,
             Sockaddr,
             Open_flags,
             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 parameter
Type:
Integer
Length:
Fullword

A fullword that contains the length of sockaddr.

Sockaddr
Supplied parameter
Type:
SOCK
Length:
Specified by Sockaddr_length

A structure that varies depending on the address family type. It contains the address that is to be 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.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword
A fullword in which the vn_connect 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_connect operation stores the return code. The vn_connect 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_connect operation should support at least the following error values:
Return_code Explanation
ECONNREFUSED The connection request was rejected.
EINTR The request was interrupted by a signal.
EINVAL The length of the name specified was too short, or negative.
EISCONN The socket is already connected.
ENOAFSUPPORT The PFS does not support this address family.
EOPNOTSUPP The socket that was specified is a server; a listen has been done.
EPROTOTYPE The request is for an incorrect socket type.
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 in which the vn_connect operation stores the reason code. The vn_connect 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_connect processing

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

Specific processing notes
The connect() function performs a different action for each of the following types of initiating sockets:
  • If the initiating socket is SOCK_DGRAM, the connect() function establishes the peer address. The peer address identifies the socket to which all datagrams are sent on subsequent send() functions. No connections are made by this connect() function.
  • If the initiating socket is SOCK_STREAM, the connect() function attempts to make a connection to the socket that is specified by the Sockaddr parameter.
Serialization provided by the LFS

The vn_connect 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