|
FunctionThe vn_bind operation associates
a name with a socket.
Input parameter formatvn_bind (Token_structure,
OSI_structure,
Audit_structure,
Sockaddr_length,
Sockaddr,
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.
- Return_value
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
A fullword in which the vn_bind 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 completed 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_bind operation stores
the return code. The vn_bind operation returns Return_code only if
Return_value is -1. See z/OS UNIX System Services Messages and Codes for
a complete list of supported return code values.
The vn_bind operation should support at least the following
error values: Return_code |
Explanation |
---|
EAFNOSUPPORT |
The address family that was specified is not supported. |
EINVAL |
The length of the name is either too short or negative. |
- Reason_code
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
A fullword where the vn_bind operation stores the
reason code. The vn_bind 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_bind 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 bind() function.
- Specific processing notes
- An unbind flag can be passed in the first word of the system data
area of the Token_structure, ts_sysdl. A value of 1 in this word indicates
that the socket should be reset to an unbound state, if possible.
If the socket can be reset to an unbound state, then a subsequent
vn_bind call with a different Sockaddr might be successful. If the
socket cannot be unbound, the call should be rejected. All other parameters
are the same as on a successful vn_bind call. There is no external
application interface for this function; it is used internally by
the Common INET (CINET) layer so that CINET can try to place an application
socket back into a state where another call to bind() may succeed
after a bind() has succeeded on some transports but failed on others.
A
bind with source address selection flag can be passed in the first
word of the system data area of the Token_structure, ts_sysd1. A value
of 2 in this word indicates that the socket should be bound using
the source address selection preferences. (bind2addrsel())
The
function specifies the destination IP address. When this function
is used, the socket is bound to the "best" source address for the
provided destination IP address.
The caller's suggestion of
"best" source address is set by using the setsockopt () call with
the IPv6 socket option Sock#IPV6_ADDR_PREFERENCES. Port number is
irrelevant for bind2addrsel() function.
The return value, return
code, and reason code are same as the bind() operation. The external
application interface for this function is the BPX1BAS,
BPX4BAS, and bind2addrsel() functions. See these functions
in z/OS UNIX System Services Programming: Assembler Callable Services Reference for
more details.
- Serialization provided by the LFS
- The vn_bind operation is invoked with an exclusive latch held
on the vnode of the socket.
- Security calls to be made by the PFS
- When a program specifies a port value less than 1024 decimal,
the PFS must call SAF's Check Privilege function to verify that the
caller has the authority to do so.
|