summaryrefslogtreecommitdiffhomepage
path: root/src/sys.h
blob: 31c9950033aa53f65a0e39b5e51690311c4c06db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
 * @file sys.h
 * @brief The system's identity, its IPL, its storage and its address spaces.
 *
 * Everything here is a documented programming interface reached from the
 * CVT at PSA+0x10: CVTSNAME, CVTSMCA, CVTRLSTG, CVTASMVT and CVTASVT, the
 * ASVT/ASCB chain, and the SMCA and ASMVT control blocks behind them.
 * Reading them needs only problem state, so none of this needs an
 * authorized service.
 */
#ifndef ZTOP_SYS_H
#define ZTOP_SYS_H

#include <stdint.h>

enum { ZJOB_MAX = 512 };

/** @brief One address space. */
typedef struct zjob {
    unsigned int asid;
    uint32_t ascb;
    char name[9];
} zjob;

/** @brief The IPL date and time, decoded from the SMCA. */
typedef struct zipl {
    unsigned int year;
    unsigned int month;
    unsigned int day; /**< day of month */
    unsigned int hour;
    unsigned int minute;
    unsigned int second;
} zipl;

/** @brief What the system view shows. */
typedef struct zsys {
    char sysname[9];
    char host[65];
    char os[64];
    char machine[32];
    unsigned int slots; /**< ASVT entries, used or free */
    int njobs;
    zjob job[ZJOB_MAX];
    bool ipl_ok;
    zipl ipl;
    uint64_t real_k; /**< real storage online at IPL, in K */
    uint32_t cvt;
    uint32_t smca;
} zsys;

/**
 * @brief Decode SMCAIDTE (0CYYDDDF, packed) and SMCAITME (hundredths).
 * @param date SMCAIDTE as read.
 * @param hundredths SMCAITME as read.
 * @param out Where to write.
 * @return false when the fields do not describe a real date and time.
 */
bool zipl_decode(uint32_t date, uint32_t hundredths, zipl *out);

/**
 * @brief Fill @p z from the CVT, the SMCA and the ASVT.
 * @param z Where to write.
 * @return false when this is not z/OS, with @c z untouched.
 */
bool zsys_read(zsys *z);

/** @brief Auxiliary storage state, from the ASMVT. */
typedef struct zpage {
    bool common_pds; /**< a common page data set exists */
    bool common_full;
    bool plpa_pds;
    bool plpa_full;
    bool local_paging; /**< local page data sets are in use */
    bool vio_journaling;
    bool quick_start;
    bool warm_start;
    unsigned int vio_ci; /**< control intervals in the VIO journal */
    uint32_t asmvt;
} zpage;

/**
 * @brief Fill @p p from the ASMVT.
 * @param p Where to write.
 * @return false when this is not z/OS or there is no ASMVT.
 */
bool zpage_read(zpage *p);

#endif