Showing with 47 additions and 0 deletions.
  1. +1 −0 mak/COPY
  2. +1 −0 mak/MANIFEST
  3. +39 −0 src/core/sys/linux/sys/sysinfo.d
  4. +3 −0 win32.mak
  5. +3 −0 win64.mak
1 change: 1 addition & 0 deletions mak/COPY
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ COPY=\
$(IMPDIR)\core\sys\linux\sys\inotify.d \
$(IMPDIR)\core\sys\linux\sys\mman.d \
$(IMPDIR)\core\sys\linux\sys\signalfd.d \
$(IMPDIR)\core\sys\linux\sys\sysinfo.d \
$(IMPDIR)\core\sys\linux\sys\xattr.d \
\
$(IMPDIR)\core\sys\osx\execinfo.d \
Expand Down
1 change: 1 addition & 0 deletions mak/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ MANIFEST=\
src\core\sys\linux\sys\inotify.d \
src\core\sys\linux\sys\mman.d \
src\core\sys\linux\sys\signalfd.d \
src\core\sys\linux\sys\sysinfo.d \
src\core\sys\linux\sys\xattr.d \
\
src\core\sys\osx\execinfo.d \
Expand Down
39 changes: 39 additions & 0 deletions src/core/sys/linux/sys/sysinfo.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* D header file for GNU/Linux.
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Authors: Martin Nowak
*/
module core.sys.linux.sys.sysinfo;

version(linux) extern(C) @nogc nothrow:

import core.sys.linux.config;

// linux/sysinfo.h
enum SI_LOAD_SHIFT = 16;

struct sysinfo_
{
c_long uptime; /* Seconds since boot */
c_ulong[3] loads; /* 1, 5, and 15 minute load averages */
c_ulong totalram; /* Total usable main memory size */
c_ulong freeram; /* Available memory size */
c_ulong sharedram; /* Amount of shared memory */
c_ulong bufferram; /* Memory used by buffers */
c_ulong totalswap; /* Total swap space size */
c_ulong freeswap; /* swap space still available */
ushort procs; /* Number of current processes */
ushort pad; /* Explicit padding for m68k */
c_ulong totalhigh; /* Total high memory size */
c_ulong freehigh; /* Available high memory size */
uint mem_unit; /* Memory unit size in bytes */
ubyte[20-2 * c_ulong.sizeof - uint.sizeof] _f; /* Padding: libc5 uses this.. */
}


int sysinfo(sysinfo_ *info);
int get_nprocs_conf();
int get_nprocs();
c_long get_phys_pages();
c_long get_avphys_pages();
3 changes: 3 additions & 0 deletions win32.mak
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ $(IMPDIR)\core\sys\linux\sys\mman.d : src\core\sys\linux\sys\mman.d
$(IMPDIR)\core\sys\linux\sys\signalfd.d : src\core\sys\linux\sys\signalfd.d
copy $** $@

$(IMPDIR)\core\sys\linux\sys\sysinfo.d : src\core\sys\linux\sys\sysinfo.d
copy $** $@

$(IMPDIR)\core\sys\linux\sys\xattr.d : src\core\sys\linux\sys\xattr.d
copy $** $@

Expand Down
3 changes: 3 additions & 0 deletions win64.mak
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ $(IMPDIR)\core\sys\linux\sys\mman.d : src\core\sys\linux\sys\mman.d
$(IMPDIR)\core\sys\linux\sys\signalfd.d : src\core\sys\linux\sys\signalfd.d
copy $** $@

$(IMPDIR)\core\sys\linux\sys\sysinfo.d : src\core\sys\linux\sys\sysinfo.d
copy $** $@

$(IMPDIR)\core\sys\linux\sys\xattr.d : src\core\sys\linux\sys\xattr.d
copy $** $@

Expand Down