The loadhfs service loads an executable program by path name into the caller's process.
Operation | Environment |
---|---|
Authorization: | Supervisor or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1LOD): | 31-bit |
AMODE (BPX4LOD): | 64-bit |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
|
The name of a fullword that contains the length of the Filename parameter. The length can be a value in the range 1 to 1023.
The name of a field that contains the file name of the program that is to be loaded. If the Filename parameter does not contain a slash (/), it is treated as a base name; it should be in one of the directories listed in the supplied Libpath parameter. If the Libpath parameter is null, the file must be in the current directory. If the file name is not a base name (that is, it contains at least one slash), the name is used as is; the Libpath parameter is not used to locate the file.
If the file name is a base name, it can be up to 255 characters long.
If the Filename parameter represents a path name, each component of the path name (directory name, subdirectory name, or file name) can be up to 255 characters long. The complete path name can be up to 1023 characters long, and does not require an ending NUL character.
Constant | Description |
---|---|
Lod_Error_St_ExLink | Indicates that LOAD processing is to be bypassed if the file
is an external link or has the sticky bit set on. If the file is sticky or is an external link, the request fails with return code EPERM (the operation is not permitted) and a reason code of JrExternalLink or JrStickyBit. |
Lod_Ignore_Sticky | Indicates that the sticky bit for a file is to be ignored. If the file is sticky, it is loaded from the z/OS UNIX file system. |
The name of a fullword that contains the length of the library path parameter. If a value of zero is specified, the library path parameter is ignored.
The name of a field that contains the library path to be searched to determine the fully qualified path name of the file that is specified. The library path can contain a series of path names separated by colons. The path names in the list are searched one at a time until the specified file name is located. If the list of path names begins or ends with a colon, the working directory of the calling process is used to locate the file. Each path name in the list can have a maximum length of 1021 bytes.
The name of a field that contains the entry point.
The name of a fullword in which the loadhfs service returns -1 if it is not successful. If it is successful, the loadhfs service returns the entry point address of the program that was loaded into storage. If the loaded program is an AMODE 31 program, the high-order bit of the return value is turned on. For this reason, applications that test for a failure condition must explicitly check for a -1 return value. Checking for a value of less than zero will not produce the desired results.
For AMODE 64 programs, if the return value is 0, the entry point address of the loaded program is returned in the Entry_point parameter.
Return_code | Explanation |
---|---|
EACCES | The caller does not have appropriate permissions to run the specified file. It may lack permission to search a directory named in the Pathname parameter; it may lack execute permission for the file to be run; or the file to be run is not a regular file, and the system cannot run files of its type. |
EAGAIN | The file changed during load processing (JrFileChangeDuringLoad). |
ELOOP | A loop exists in symbolic links that were encountered during resolution of the Filename parameter. This error is issued if more than 24 symbolic links are detected in the resolution of Filename. |
EMVSERR | An error occurred while loading a z/OS UNIX program (JrMVSLoadFailure or JrMVSPgmNotFound). Or an error occurred checking the caller's environment against the authorization of the file (JrNoListAuthPgmPath, JrNoListPgmCntlPath, JrProgCntl, JrAuthCaller). |
ENAMETOOLONG | Filename is longer than 1023 characters; or some component of the file name is longer than 255 characters. Name truncation is not supported. |
ENOENT | No file name was specified, or one or more of the components of the specified Filename parameter were not found. |
ENOEXEC | The specified file has execute permission, but it is not in the proper format to be a process image file. |
ENOMEM | The file that is to be loaded requires more memory than is permitted by the hardware or the operating system. |
ENOTDIR | A directory component of Filename is not a directory. |
EINVAL | An invalid parameter value was specified. The invalid parameter might be one of the following: Filename_length. |
EPERM | The operation is not permitted. The Flags parameter was set to Lod_Error_St_ExLink, and either the file is an external link (JrExternalLink), or it has the sticky bit set on (JrStickyBit). |
The name of a fullword in which the loadhfs service stores the reason code. The loadhfs service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.
The following usage notes apply for shared library programs:
When a shared library program is loaded anew into the shared region or reloaded from the shared region, the program is mapped from the shared region into the private area of the calling address space. It is important to note that, because the program is not actually reloaded from DASD into the private area of each calling address space, but only remapped from the shared region, shared library programs are more efficient in their utilization of system resources than normal private area programs. For this reason, programs that are to be shared across several address spaces in the system are good candidates for identification as shared library programs.
If a target program is not in the shared library region and cannot be loaded into the region because of its attributes, the program is treated like a private area program and is loaded into the caller's private area storage.
Additionally, if the calling address space cannot accommodate the target address for the shared library program, the program is treated like a private area program.
There are no restrictions on the use of the loadhfs service.
For an example using this callable service, see BPX1LOD (loadHFS) example.