mailing list of musl libc
 help / color / mirror / code / Atom feed
43a8c9e36e1efee7b43dd69777b5cd78599fd0b6 blob 340 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
 
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int getloadavg(double *a, int n)
{
	int i;
	double b[3];
	FILE *f = fopen("/proc/loadavg", "rbe");
	if (!f) return -1;
	i = fscanf(f, "%lf %lf %lf", b, b+1, b+2);
	fclose(f);
	if (n > i) n = i;
	if (n < 0) return -1;
	memcpy(a, b, n * sizeof *a);
	return n;
}
debug log:

solving 43a8c9e ...
found 43a8c9e in https://git.vuxu.org/mirror/musl/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).