6,534
edits
Changes
use <source> tag instead of pre where appropriate
The system call description is
<presource lang="c">
long ubstat(int func, unsigned long luid, void *notif, void *buf, int size);
</presource>
The macros and data typed used are declared in <code>include/ub/ub_stat.h</code> file.
'''1. <code>UBSTAT_READ_ONE</code>''' format is
<presource lang="c">
typedef unsigned long ubstattime_t;
ubstatparm_t param[1];
}
</presource>
It contains the time period for which the stats are returned and the <code>maxheld</code> and <code>failcnt</code> for the resource.
'''2. <code>UBSTAT_READ_ALL</code>''' format is
<presource lang="c">
typedef unsigned long ubstattime_t;
ubstatparm_t param[UB_RESOURCES];
}
</presource>
It contains the same info as the <code>UBSTAT_READ_ONE</code> does, but for all the resources.
'''3. <code>UBSTAT_READ_FULL</code>''' format is
<presource lang="c">
typedef unsigned long ubstattime_t;
ubstatparmf_t param[UB_RESOURCES];
}
</presource>
It contains the extended info for all the resources.
'''6. UBSTAT_GETTIME''' format is
<presource lang="c">
typedef unsigned long ubstattime_t;
ubstattime_t cur_time;
};
</presource>
It returns the time interval within which the stats are collected and the current time.
The <code>notif</code> should point to
<presource lang="c">
typedef struct {
long maxinterval;
int signum;
} ubnotifrq_t;
</presource>
The <code>maxinterval</code> is the time after which the notification will be delivered. It should be more than 1 (second).
== Demo ==
The following program demonstrates how you can (but not should) use the described API. This example is deliberately made very stupid and simple to demonstrate the main idea and will only work on x86_64.
<presource lang="c">
#include <stdio.h>
#include <unistd.h>
return 0;
}
</presource>
== Implementation constraints ==