diff options
author | Rich Felker <dalias@aerifal.cx> | 2016-01-22 03:39:07 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-01-22 03:39:07 +0000 |
commit | 66215afc2e09f0153a63d58d3baec25cf0122b7b (patch) | |
tree | 13a9fe809bedd0c09191fcc14af64ef37a434b85 /arch/x32/src/sysinfo.c | |
parent | 513c043694f500a01bd8d899ff73441aa7457a1f (diff) | |
download | musl-66215afc2e09f0153a63d58d3baec25cf0122b7b.tar.gz |
move x32 sysinfo impl and syscall fixup code out of arch/x32/src
all such arch-specific translation units are being moved to
appropriate arch dirs under the main src tree.
Diffstat (limited to 'arch/x32/src/sysinfo.c')
-rw-r--r-- | arch/x32/src/sysinfo.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/arch/x32/src/sysinfo.c b/arch/x32/src/sysinfo.c deleted file mode 100644 index d1c1b148..00000000 --- a/arch/x32/src/sysinfo.c +++ /dev/null @@ -1,50 +0,0 @@ -#include <sys/sysinfo.h> -#include "syscall.h" -#include "libc.h" - -#define klong long long -#define kulong unsigned long long - -struct kernel_sysinfo { - klong uptime; - kulong loads[3]; - kulong totalram; - kulong freeram; - kulong sharedram; - kulong bufferram; - kulong totalswap; - kulong freeswap; - short procs; - short pad; - kulong totalhigh; - kulong freehigh; - unsigned mem_unit; -}; - -int __lsysinfo(struct sysinfo *info) -{ - struct kernel_sysinfo tmp; - int ret = syscall(SYS_sysinfo, &tmp); - if(ret == -1) return ret; - info->uptime = tmp.uptime; - info->loads[0] = tmp.loads[0]; - info->loads[1] = tmp.loads[1]; - info->loads[2] = tmp.loads[2]; - kulong shifts; - kulong max = tmp.totalram | tmp.totalswap; - __asm__("bsr %1,%0" : "=r"(shifts) : "r"(max)); - shifts = shifts >= 32 ? shifts - 31 : 0; - info->totalram = tmp.totalram >> shifts; - info->freeram = tmp.freeram >> shifts; - info->sharedram = tmp.sharedram >> shifts; - info->bufferram = tmp.bufferram >> shifts; - info->totalswap = tmp.totalswap >> shifts; - info->freeswap = tmp.freeswap >> shifts; - info->procs = tmp.procs ; - info->totalhigh = tmp.totalhigh >> shifts; - info->freehigh = tmp.freehigh >> shifts; - info->mem_unit = (tmp.mem_unit ? tmp.mem_unit : 1) << shifts; - return ret; -} - -weak_alias(__lsysinfo, sysinfo); |