Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f41ecf37
Commit
f41ecf37
authored
May 07, 2002
by
Olivier Houchard
Committed by
Alexandre Julliard
May 07, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for getting memory size on FreeBSD.
parent
0bd249dd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
7 deletions
+39
-7
global.c
memory/global.c
+39
-7
No files found.
memory/global.c
View file @
f41ecf37
...
...
@@ -28,6 +28,9 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
#include "wine/winbase16.h"
#include "wine/exception.h"
...
...
@@ -1524,13 +1527,22 @@ VOID WINAPI GlobalMemoryStatus(
#ifdef linux
FILE
*
f
;
#endif
#ifdef __FreeBSD__
int
*
tmp
;
int
size_sys
;
#endif
if
(
time
(
NULL
)
==
cache_lastchecked
)
{
memcpy
(
lpmem
,
&
cached_memstatus
,
sizeof
(
MEMORYSTATUS
));
return
;
}
cache_lastchecked
=
time
(
NULL
);
lpmem
->
dwMemoryLoad
=
0
;
lpmem
->
dwTotalPhys
=
16
*
1024
*
1024
;
lpmem
->
dwAvailPhys
=
16
*
1024
*
1024
;
lpmem
->
dwTotalPageFile
=
16
*
1024
*
1024
;
lpmem
->
dwAvailPageFile
=
16
*
1024
*
1024
;
#ifdef linux
f
=
fopen
(
"/proc/meminfo"
,
"r"
);
if
(
f
)
...
...
@@ -1578,16 +1590,36 @@ VOID WINAPI GlobalMemoryStatus(
lpmem
->
dwMemoryLoad
=
(
TotalPhysical
-
AvailPhysical
)
/
(
TotalPhysical
/
100
);
}
}
#elif defined(__FreeBSD__)
sysctlbyname
(
"hw.physmem"
,
NULL
,
&
size_sys
,
NULL
,
0
);
tmp
=
malloc
(
size_sys
*
sizeof
(
int
));
sysctlbyname
(
"hw.physmem"
,
tmp
,
&
size_sys
,
NULL
,
0
);
if
(
tmp
&&
*
tmp
)
{
lpmem
->
dwTotalPhys
=
*
tmp
;
free
(
tmp
);
sysctlbyname
(
"hw.usermem"
,
NULL
,
&
size_sys
,
NULL
,
0
);
tmp
=
malloc
(
size_sys
*
sizeof
(
int
));
sysctlbyname
(
"hw.usermem"
,
tmp
,
&
size_sys
,
NULL
,
0
);
if
(
tmp
&&
*
tmp
)
{
lpmem
->
dwAvailPhys
=
*
tmp
;
lpmem
->
dwTotalPageFile
=
*
tmp
;
lpmem
->
dwAvailPageFile
=
*
tmp
;
lpmem
->
dwMemoryLoad
=
lpmem
->
dwTotalPhys
-
lpmem
->
dwAvailPhys
;
}
else
#endif
{
/* FIXME: should do something for other systems */
lpmem
->
dwAvailPhys
=
lpmem
->
dwTotalPhys
;
lpmem
->
dwTotalPageFile
=
lpmem
->
dwTotalPhys
;
lpmem
->
dwAvailPageFile
=
lpmem
->
dwTotalPhys
;
lpmem
->
dwMemoryLoad
=
0
;
lpmem
->
dwTotalPhys
=
16
*
1024
*
1024
;
lpmem
->
dwAvailPhys
=
16
*
1024
*
1024
;
lpmem
->
dwTotalPageFile
=
16
*
1024
*
1024
;
lpmem
->
dwAvailPageFile
=
16
*
1024
*
1024
;
}
free
(
tmp
);
}
#endif
/* FIXME: should do something for other systems */
GetSystemInfo
(
&
si
);
lpmem
->
dwTotalVirtual
=
si
.
lpMaximumApplicationAddress
-
si
.
lpMinimumApplicationAddress
;
/* FIXME: we should track down all the already allocated VM pages and substract them, for now arbitrarily remove 64KB so that it matches NT */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment