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
ed75a7b3
Commit
ed75a7b3
authored
Dec 02, 2018
by
Roderick Colenbrander
Committed by
Alexandre Julliard
Dec 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Parse sysfs cpu_shared_map using helper function.
Signed-off-by:
Roderick Colenbrander
<
thunderbird2k@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9988bb5e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
nt.c
dlls/ntdll/nt.c
+31
-9
No files found.
dlls/ntdll/nt.c
View file @
ed75a7b3
...
...
@@ -1604,6 +1604,36 @@ static inline BOOL logical_proc_info_add_group(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
}
#ifdef linux
/* Helper function for counting bitmap values as commonly used by the Linux kernel
* for storing CPU masks in sysfs. The format is comma separated lists of hex values
* each max 32-bit e.g. "00ff" or even "00,00000000,0000ffff".
*
* Example files include:
* - /sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map
* - /sys/devices/system/cpu/cpu0/topology/thread_siblings
*/
static
BOOL
sysfs_parse_bitmap
(
const
char
*
filename
,
ULONG_PTR
*
const
mask
)
{
FILE
*
f
;
DWORD
r
;
f
=
fopen
(
filename
,
"r"
);
if
(
!
f
)
return
FALSE
;
while
(
!
feof
(
f
))
{
char
op
;
if
(
!
fscanf
(
f
,
"%x%c "
,
&
r
,
&
op
))
break
;
*
mask
=
(
sizeof
(
ULONG_PTR
)
>
sizeof
(
int
)
?
*
mask
<<
(
8
*
sizeof
(
DWORD
))
:
0
)
+
r
;
}
fclose
(
f
);
return
TRUE
;
}
/* for 'data', max_len is the array count. for 'dataex', max_len is in bytes */
static
NTSTATUS
create_logical_proc_info
(
SYSTEM_LOGICAL_PROCESSOR_INFORMATION
**
data
,
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
**
dataex
,
DWORD
*
max_len
)
...
...
@@ -1693,15 +1723,7 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **
ULONG_PTR
mask
=
0
;
sprintf
(
name
,
cache_info
,
i
,
j
,
"shared_cpu_map"
);
f
=
fopen
(
name
,
"r"
);
if
(
!
f
)
continue
;
while
(
!
feof
(
f
))
{
if
(
!
fscanf
(
f
,
"%x%c "
,
&
r
,
&
op
))
break
;
mask
=
(
sizeof
(
ULONG_PTR
)
>
sizeof
(
int
)
?
mask
<<
(
8
*
sizeof
(
DWORD
))
:
0
)
+
r
;
}
fclose
(
f
);
if
(
!
sysfs_parse_bitmap
(
name
,
&
mask
))
continue
;
sprintf
(
name
,
cache_info
,
i
,
j
,
"level"
);
f
=
fopen
(
name
,
"r"
);
...
...
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