2
2
* sar, sadc, sadf, mpstat and iostat common routines.
3
* (C) 1999-2009 by Sebastien GODARD (sysstat <at> orange.fr)
3
* (C) 1999-2010 by Sebastien GODARD (sysstat <at> orange.fr)
5
5
***************************************************************************
6
6
* This program is free software; you can redistribute it and/or modify it *
266
266
***************************************************************************
267
* Find number of NFS-mounted points that are registered in
268
* /proc/self/mountstats.
267
* Read /proc/devices file and get device-mapper major number.
268
* If device-mapper entry is not found in file, use DEFAULT_DEMAP_MAJOR
271
* Number of NFS-mounted points.
272
* Device-mapper major number.
272
273
***************************************************************************
274
int get_nfs_mount_nr(void)
275
unsigned int get_devmap_major(void)
279
unsigned int nfs = 0;
281
if ((fp = fopen(NFSMOUNTSTATS, "r")) == NULL)
282
/* File non-existent */
285
while (fgets(line, 8192, fp) != NULL) {
287
if ((strstr(line, "mounted")) && (strstr(line, "on")) &&
288
(strstr(line, "with")) && (strstr(line, "fstype"))) {
290
sscanf(strstr(line, "fstype") + 6, "%10s", type_name);
291
if ((!strncmp(type_name, "nfs", 3)) && (strncmp(type_name, "nfsd", 4))) {
279
unsigned int dm_major = DEFAULT_DEVMAP_MAJOR;
281
if ((fp = fopen(DEVICES, "r")) == NULL)
284
while (fgets(line, 128, fp) != NULL) {
286
if (strstr(line, "device-mapper")) {
287
/* Read device-mapper major number */
288
sscanf(line, "%u", &dm_major);
325
if (((e = getenv(ENV_TIME_FMT)) != NULL) && !strcmp(e, K_ISO)) {
320
if (rectime == NULL) {
321
strcpy(cur_date, "?/?/?");
323
else if (((e = getenv(ENV_TIME_FMT)) != NULL) && !strcmp(e, K_ISO)) {
326
324
strftime(cur_date, sizeof(cur_date), "%Y-%m-%d", rectime);
420
418
while ((slash = strchr(name, '/'))) {
423
snprintf(syspath, sizeof(syspath), "/sys/block/%s", name);
421
snprintf(syspath, sizeof(syspath), "%s/%s", SYSFS_BLOCK, name);
425
423
return !(access(syspath, F_OK));