Query Config Option
Purpose
A set of subcommand calls (configuration operations) that retrieve the current value for a particular configuration setting. Each one returns the configuration setting as a character string in the co_string field.
The Format section and Example 1 use the CFGOP_QUERY_ADM_THREADS subcommand. Example 2 shows an example to query the syslevel. The other query subcommands (see Table 1) operate in a similar manner.
Format
syscall_parmlist
opcode int 180 CFGOP_QUERY_ADM_THREADS
parms[0] int offset to CFG_OPTION
parms[1] int offset to system name (optional)
parms[2] int 0
parms[3] int 0
parms[4] int 0
parms[5] int 0
parms[6] int 0
CFG_OPTION
co_eye char[4] "CFOP"
co_len short sizeof(CFG_OPTION)
co_ver char 1
co_string char[81] 0
co_value_reserved int[4] reserved
co_reserved char[24] 0
systemname char[9]
Return_value 0 if request is successful, -1 if it is not successful
Return_code
EBUSY Aggregate could not be quiesced
EINTR ZFS is shutting down
EMVSERR Internal error using an osi service
ENOENT Aggregate is not attached
EPERM Permission denied to perform request
Reason_code
0xEFnnxxxx See z/OS Distributed File Service Messages and Codes
Usage notes
- Reserved fields and undefined flags must be set to binary zeros.
- The output is the null-terminated string that is returned in co_string.
Privilege required
None.
Related services
- Set Config Option
Restrictions
None.
Examples
Example 1: The following example
shows an API to query admin threads.
#pragma linkage(BPX1PCT, OS)
extern void BPX1PCT(char *, int, int, char *, int *, int *, int *);
#include <stdio.h>
#define ZFSCALL_CONFIG 0x40000006
#define CFGOP_QUERY_ADM_THREADS 180 /* query number of admin threads */
typedef struct syscall_parmlist_t {
int opcode; /* Operation code to perform */
int parms[7]; /* Specific to type of operation, */
/* provides access to the parms */
/* parms[4]-parms[6] are currently unused*/
} syscall_parmlist;
typedef struct config_option_t {
char co_eye[4]; /* Eye catcher */
#define CFGO_EYE "CFOP"
short co_len; /* Length of structure */
char co_ver; /* Version of structure */
#define CO_VER_INITIAL 1 /* Initial version */
#define CO_SLEN 80 /* Sizeof string */
char co_string[CO_SLEN+1]; /* String value for option
must be 0 terminated */
int co_value[4]; /* Place for integer values */
char co_reserved[24]; /* Reserved for future use */
} CFG_OPTION;
struct parmstruct {
syscall_parmlist myparms;
CFG_OPTION co;
char system[9];
} myparmstruct;
int main(int argc, char **argv)
{
int bpxrv;
int bpxrc;
int bpxrs;
CFG_OPTION *coptr = &(myparmstruct.co);
/* This next field should only be set if parms[1] is non-zero */
/* strcpy(myparmstruct.system,"DCEIMGVN"); */ /* set system to query */
myparmstruct.myparms.opcode = CFGOP_QUERY_ADM_THREADS;
myparmstruct.myparms.parms[0] = sizeof(syscall_parmlist);
myparmstruct.myparms.parms[1] = 0;
/* Only specify a non-zero offset for the next field (parms[1]) if you are */
/* z/OS 1.7 and above, and you want to configquery to a different system */
/* myparmstruct.myparms.parms[1] = sizeof(syscall_parmlist) + */
/* sizeof(CFG_OPTION); */
myparmstruct.myparms.parms[2] = 0;
myparmstruct.myparms.parms[3] = 0;
myparmstruct.myparms.parms[4] = 0;
myparmstruct.myparms.parms[5] = 0;
myparmstruct.myparms.parms[6] = 0;
memset(coptr, 0, sizeof(CFG_OPTION));
memcpy(coptr->co_eye, CFGO_EYE, 4);
coptr->co_ver = CO_VER_INITIAL;
coptr->co_len = (int)sizeof(CFG_OPTION);
BPX1PCT("ZFS ",
ZFSCALL_CONFIG, /* Config operation */
sizeof(myparmstruct), /* Length of Argument */
(char *)&myparmstruct, /* Pointer to Argument */
&bpxrv, /* Pointer to Return_value */
&bpxrc, /* Pointer to Return_code */
&bpxrs); /* Pointer to Reason_code */
if (bpxrv < 0)
{
printf("Error querying config -adm_threads, "
"BPXRV = %d BPXRC = %d BPXRS = %x\n",
bpxrv, bpxrc, bpxrs);
return bpxrc;
}
else
{
printf("Config query -adm_threads = %s\n", myparmstruct.co.co_string);
}
return 0;
}
Example 2: The
following example shows an API to query the syslevel.
#pragma linkage(BPX1PCT, OS)
#pragma LANGLVL(EXTENDED)
extern void BPX1PCT(char *, int, int, char *, int *, int *, int *);
#include <stdio.h>
#include <string.h>
#define ZFSCALL_CONFIG 0x40000006
#define CFGOP_QUERY_SYSLEVEL 238 /* Query Config option - syslevel */
/* Not in a sysplex shared file system environment */
#define NO_SYSPLEX_SUPPORT 0
/* Admin level sysplex shared file system environment */
#define SYSPLEX_ADMIN_LEVEL 1
/* File level sysplex shared file system environment */
#define SYSPLEX_FILE_LEVEL 2
/* Sysplex-aware on a File system basis */
#define SYSPLEX_FILESYS_LEVEL 3
typedef struct syscall_parmlist_t {
int opcode; /* Operation code to perform */
int parms[7]; /* Specific to type of operation, */
/* provides access to the parms */
/* parms[4]-parms[6] are currently unused*/
} syscall_parmlist;
typedef struct config_option_t {
char co_eye[4]; /* Eye catcher */
#define CFGO_EYE "CFOP"
short co_len; /* Length of structure */
char co_ver; /* Version of structure */
#define CO_VER_INITIAL 1 /* Initial version */
#define CO_SLEN 80 /* Sizeof string */
char co_string[CO_SLEN+1]; /* String value for option must */
/* be 0 terminated */
int co_value[4]; /* Place for integer vaalues */
char co_reserved[24]; /* Reserved for future use */
} CFG_OPTION;
struct parmstruct {
syscall_parmlist myparms;
CFG_OPTION co;
char system[9];
} myparmstruct;
int main(int argc, char **argv)
{
int bpxrv;
int bpxrc;
int bpxrs;
CFG_OPTION *coptr = &(myparmstruct.co);
char *version,
*service,
*created,
*sysplex,
*interface,
*rwshare_default,
*rest;
int sysplex_level;
/* strcpy(myparmstruct.system,"DCEIMGVN"); */ /* set system to query */
myparmstruct.myparms.opcode = CFGOP_QUERY_SYSLEVEL;
myparmstruct.myparms.parms[0] = sizeof(syscall_parmlist);
myparmstruct.myparms.parms[1] = 0;
/* myparmstruct.myparms.parms[1] =sizeof(syscall_parmlist) + */
/* sizeof(CFG_OPTION); */
myparmstruct.myparms.parms[2] = 0;
myparmstruct.myparms.parms[3] = 0;
myparmstruct.myparms.parms[4] = 0;
myparmstruct.myparms.parms[5] = 0;
myparmstruct.myparms.parms[6] = 0;
memset(coptr, 0, sizeof(CFG_OPTION));
memcpy(coptr->co_eye, CFGO_EYE, 4);
coptr->co_ver = CO_VER_INITIAL;
coptr->co_len = (int)sizeof(CFG_OPTION);
BPX1PCT("ZFS ",
ZFSCALL_CONFIG, /* Config operation */
sizeof(myparmstruct), /* Length of Argument */
(char *)&myparmstruct, /* Pointer to Argument */
&bpxrv, /* Pointer to Return_value */
&bpxrc, /* Pointer to Return_code */
&bpxrs); /* Pointer to Reason_code */
if (bpxrv < 0)
{
printf("Error querying config -syslevel, "
"BPXRV = %d BPXRC = %d BPXRS = %x\n",
bpxrv, bpxrc, bpxrs);
return bpxrc;
}
else
{
/* Parse our configquery string */
/* format is */
/* "OSlevel\nServicelevel\ncreatetimestamp\" + */
/* "nsysplex_state\ninterface_level\nrwshare_default\0" */
version = myparmstruct.co.co_string;
service = strchr(version, '\n'); /* find the end of the */
/* version (for 2nd line) */
*service = '\0'; /* ensure end of string for version string */
service++; /* increment to next field (service) */
created = strchr(service, '\n'); /* find the end of the */
/*service (for 2nd line) */
*created = '\0'; /* ensure end of string for service string */
created++; /* increment to next field (creation) */
sysplex = strchr(created, '\n'); /* find the end of the */
/* creation timestamp */
*sysplex = '\0'; /* ensure end of string for creation string */
sysplex++; /* increment to next field (sysplex_state) */
interface = strchr(sysplex, '\n'); /* find end of the sysplex_state */
*interface = '\0'; /* ensure end of string for sysplex_state */
interface++; /* increment to next field (interface level) */
sysplex_level = atoi(sysplex);
if (sysplex_level == NO_SYSPLEX_SUPPORT)
{
printf("zFS kernel: z/OS File System\nVersion %s "
"Service Level %s.\n Created on %s.\n",
version, service, created);
}
else
{
char buffer[80];
/* find the end of the interface */
rwshare_default = strchr(interface, '\n');
if (rwshare_default != NULL)
{
*rwshare_default = '\0';
rwshare_default++;
}
if (sysplex_level == SYSPLEX_ADMIN_LEVEL)
sprintf(buffer, "sysplex(admin-only) interface(%s)", interface);
else /* if sysplex_level is SYSPLEX_FILE_LEVEL */
{
if (sysplex_level == SYSPLEX_FILE_LEVEL)
sprintf(buffer, "sysplex(file) interface(%s)", interface);
else
{ /* if sysplex_level is SYSPLEX_FILESYS_LEVEL */
if (sysplex_level == SYSPLEX_FILESYS_LEVEL)
{
/* find the end of rwshare_default */
rest = strchr(rwshare_default, '\n');
if (rest != NULL)
*rest = '\0'; /*ensure that rwshare_default is null terminated*/
sprintf(buffer, "sysplex(filesys,%s) interface(%s)",
rwshare_default, interface);
}
else
sprintf(buffer, "sysplex(%s) interface(%s)", sysplex, interface);
}
}
printf("zFS kernel: z/OS File System\nVersion "
"%s Service Level %s.\nCreated on %s.\n%s\n",
version, service, created, buffer);
}
}
return 0;
}