added entropy
This commit is contained in:

committed by
Aaron Marcher (drkhsh)

parent
bf2cdd102e
commit
5a943fa59c
23
slstatus.c
23
slstatus.c
@ -181,6 +181,29 @@ disk_perc(const char *mountpoint)
|
||||
return smprintf("%d%%", perc);
|
||||
}
|
||||
|
||||
/* entropy available */
|
||||
char *
|
||||
entropy(const char *null)
|
||||
{
|
||||
int entropy = 0;
|
||||
FILE *fp;
|
||||
|
||||
/* open entropy file */
|
||||
if (!(fp = fopen("/proc/sys/kernel/random/entropy_avail", "r"))) {
|
||||
fprintf(stderr, "Could not open entropy file.\n");
|
||||
return smprintf("n/a");
|
||||
}
|
||||
|
||||
/* extract entropy */
|
||||
fscanf(fp, "%d", &entropy);
|
||||
|
||||
/* close entropy file */
|
||||
fclose(fp);
|
||||
|
||||
/* return entropy */
|
||||
return smprintf("%d", entropy);
|
||||
}
|
||||
|
||||
/* ram percentage */
|
||||
char *
|
||||
ram_perc(const char *null)
|
||||
|
Reference in New Issue
Block a user