mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 13:49:11 +02:00
* fix linux sysinfo struct and function (bug 9523)
git-svn-id: trunk@8330 -
This commit is contained in:
parent
9525a96db7
commit
89eeb8aa63
@ -25,21 +25,25 @@ uses
|
|||||||
ctypes;
|
ctypes;
|
||||||
|
|
||||||
type
|
type
|
||||||
TSysinfo = packed record
|
SysInfo = record
|
||||||
uptime : longint;
|
uptime: clong; //* Seconds since boot */
|
||||||
loads : array[1..3] of longint;
|
loads: array[0..2] of culong; //* 1, 5, and 15 minute load averages */
|
||||||
totalram,
|
totalram: culong; //* Total usable main memory size */
|
||||||
freeram,
|
freeram: culong; //* Available memory size */
|
||||||
sharedram,
|
sharedram: culong; //* Amount of shared memory */
|
||||||
bufferram,
|
bufferram: culong; //* Memory used by buffers */
|
||||||
totalswap,
|
totalswap: culong; //* Total swap space size */
|
||||||
freeswap : longint;
|
freeswap: culong; //* swap space still available */
|
||||||
procs : integer;
|
procs: cushort; //* Number of current processes */
|
||||||
s : string[18];
|
pad: cushort; //* explicit padding for m68k */
|
||||||
|
totalhigh: culong; //* Total high memory size */
|
||||||
|
freehigh: culong; //* Available high memory size */
|
||||||
|
mem_unit: cuint; //* Memory unit size in bytes */
|
||||||
|
_f: array[0..19-2*sizeof(clong)-sizeof(cint)] of cChar; //* Padding: libc5 uses this.. */
|
||||||
end;
|
end;
|
||||||
PSysInfo = ^TSysInfo;
|
PSysInfo = ^TSysInfo;
|
||||||
|
|
||||||
function Sysinfo(var Info:TSysinfo):Boolean; {$ifdef FPC_USE_LIBC} cdecl; external name 'sysinfo'; {$endif}
|
function Sysinfo(Info: PSysinfo): cInt; {$ifdef FPC_USE_LIBC} cdecl; external name 'sysinfo'; {$endif}
|
||||||
|
|
||||||
const
|
const
|
||||||
CSIGNAL = $000000ff; // signal mask to be sent at exit
|
CSIGNAL = $000000ff; // signal mask to be sent at exit
|
||||||
@ -294,13 +298,10 @@ implementation
|
|||||||
{$ifndef FPC_USE_LIBC}
|
{$ifndef FPC_USE_LIBC}
|
||||||
Uses Syscall;
|
Uses Syscall;
|
||||||
|
|
||||||
Function Sysinfo(var Info:TSysinfo):Boolean;
|
function Sysinfo(Info: PSysinfo): cInt;
|
||||||
{
|
begin
|
||||||
Get system info
|
Sysinfo := do_SysCall(SysCall_nr_Sysinfo, TSysParam(info));
|
||||||
}
|
end;
|
||||||
Begin
|
|
||||||
Sysinfo:=do_SysCall(SysCall_nr_Sysinfo,TSysParam(@info))=0;
|
|
||||||
End;
|
|
||||||
|
|
||||||
{$ifdef clone_implemented}
|
{$ifdef clone_implemented}
|
||||||
function clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
|
function clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
|
||||||
|
Loading…
Reference in New Issue
Block a user