projects
/
musl
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
fix the use of uninitialized value in regcomp
[musl]
/
src
/
legacy
/
getloadavg.c
1
#define _GNU_SOURCE
2
#include <stdlib.h>
3
#include <sys/sysinfo.h>
4
5
int getloadavg(double *a, int n)
6
{
7
struct sysinfo si;
8
if (n <= 0) return n ? -1 : 0;
9
sysinfo(&si);
10
if (n > 3) n = 3;
11
for (int i=0; i<n; i++)
12
a[i] = 1.0/(1<<SI_LOAD_SHIFT) * si.loads[i];
13
return n;
14
}