__server_init() — Initialize server

Standards

Standards / Extensions C or C++ Dependencies

z/OS® UNIX

both  

Format

#include <sys/server.h>

int __server_init(int *managertype, const char *subsystype,
                  const char *subsysname, const char *applenv, int paralleleu);

General description

The __server_init() function provides the ability for a server address space to connect to WorkLoad Manager (WLM) for the purpose of queueing and servicing work requests.

The parameters supported are:
*managertype
Points to one or more of the following values that indicate the type of WLM manager the caller is requesting to become. The following are the supported values:
SRV_WORKMGR
Indicates that WLM work management services be made available to the calling address space. This value can be combined with the SRV_QUEUEMGR and SRV_SERVERMGR values.
SRV_QUEUEMGR
Indicates that WLM queue management services be made available to the calling address space. This value can be combined with the SRV_WORKMGR and SRV_SERVERMGR values.
SRV_SERVERMGR
Indicates that WLM server management services be made available to the calling address space. This value can be combined with the SRV_WORKMGR and SRV_QUEUEMGR values.
SRV_SERVERMGRDYNAMIC
Indicates that the WLM work management is to track the number of threads this address space will need. It prepares the address space to support the __service_thread_query() function. For SRV_SERVERMGRDYNAMIC the paralleleu parameter has the same effect as it does for SRV_SERVERMGR, in that, it indicates the maximum number of parallel work units that the server can create. The server would initially create some number of threads less than this maximum. The dynamic capability then allows the server to tap into WLM to tell the server when to increase or decrease the number of threads in the address space.
*subsystype
Points to a NULL-terminated character string containing the generic subsystem type (CICS, IMS, WEB, etc.). When SRV_WORKMGR is specified for the managertype parameter this is the primary category under which WLM classification rules are grouped. The character string can be up to 4 bytes in length.
*subsysname
Points to a NULL-terminated character string containing the subsystem name used for classifying work requests when SRV_WORKMGR is specified for the managertype parameter. When SRV_SERVERMGR is specified for the managertype parameter the subsystem name should match the subsystem name specified on the corresponding call to __server_init() for a work manager (SRV_WORKMGR managertype). The character string can be up to 8 bytes in length. When SRV_QUEUEMGR is specified for the managertype parameter the combination of the subsystype and subsysname parameter values must be unique to a single MVS™ system.
*applenv
Points to a NULL-terminated character string that contains the name of the application environment under which work requests are served. The character string can be up to 32 bytes in length. This parameter is only valid when SRV_SERVERMGR is specified for the managertype parameter. It should be NULL for all other managertype values.
paralleleu
Specifies the maximum number of tasks within the address space which will be created to process concurrent work requests. This parameter is valid when both or either SRV_SERVERMGR and SRV_SERVERMGRDYNAMIC are specified for the managertype parameter. It is ignored for all other managertype values.

A successful call to __server_init() results in the calling address space being connected to WLM for the WLM management services requested. Additionally, for a successful server manager WLM connection call (SRV_SERVERMGR managertype), the calling process is made a child of, and is placed in the session and process group of the corresponding work manager. The corresponding work manager is the process that called server_init() for the managertype combination SRV_WORKMGR+SRV_QUEUEMGR with the same subsystype and subsysname values specified as the server manager process. This parent/child relationship allows the server manager and the work manager to use signals to communicate with each other.

Returned value

If successful, __server_init() returns 0.

If unsuccessful, __server_init() returns -1 and sets errno to one of the following values:
Error Code
Description
EINVAL
The managertype parameter contains a value that is not correct.
EMVSSAF2ERR
An error occurred in the security product.
EMVSWLMERROR
A WLM service failed. Use __errno2() to obtain the WLM service reason code for the failure.
EPERM
The calling thread's address space is not permitted to the BPX.WLMSERVER Facility class. The caller's address space must be permitted to the BPX.WLMSERVER Facility class, if the BPX.WLMSERVER is defined. If BPX.WLMSERVER is not defined, the calling process is not defined as a superuser (UID=0).

Related information