/* * Scan /proc/sysinfo line by line and read out values for * Manufacturer:, Type: and Model:, for example: * Manufacturer: IBM * Type: 2964 * Model: 702 N96 * The first word is the Model Capacity and the second word is * Model (can be omitted). Both words have a maximum size of 16 * bytes.
*/
memset(manufacturer, 0, sizeof(manufacturer));
memset(type, 0, sizeof(type));
memset(model, 0, sizeof(model));
memset(version, 0, sizeof(version));
memset(authorization, 0, sizeof(authorization));
sysinfo = fopen(SYSINFO, "r"); if (sysinfo == NULL) return errno;
while ((read = getline(&line, &line_sz, sysinfo)) != -1) { if (!strncmp(line, SYSINFO_MANU, strlen(SYSINFO_MANU))) {
line2 = line + strlen(SYSINFO_MANU);
/* Missing manufacturer, type or model information should not happen */ if (!manufacturer[0] || !type[0] || !model[0]) return EINVAL;
/* * Scan /proc/service_levels and return the CPU-MF counter facility * version number and authorization level. * Optional, does not exist on z/VM guests.
*/
sysinfo = fopen(SRVLVL, "r"); if (sysinfo == NULL) goto skip_sysinfo; while ((read = getline(&line, &line_sz, sysinfo)) != -1) { if (strncmp(line, SRVLVL_CPUMF, strlen(SRVLVL_CPUMF))) continue;
line2 = line + strlen(SRVLVL_CPUMF); while ((cp = strtok_r(line2, "\n ", &line2))) { if (!strncmp(cp, SRVLVL_VERSION,
strlen(SRVLVL_VERSION))) { char *sep = strchr(cp, '=');
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.