Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
24036fe1
Commit
24036fe1
authored
Sep 29, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Sep 30, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Setting a process's affinity sets all of its threads' affinities too.
parent
ceb8577b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
4 deletions
+20
-4
info.c
dlls/ntdll/tests/info.c
+0
-2
process.c
server/process.c
+13
-1
thread.c
server/thread.c
+6
-1
thread.h
server/thread.h
+1
-0
No files found.
dlls/ntdll/tests/info.c
View file @
24036fe1
...
@@ -946,7 +946,6 @@ static void test_affinity(void)
...
@@ -946,7 +946,6 @@ static void test_affinity(void)
/* Setting the process affinity changes the thread affinity to match */
/* Setting the process affinity changes the thread affinity to match */
status
=
pNtQueryInformationThread
(
GetCurrentThread
(),
ThreadBasicInformation
,
&
tbi
,
sizeof
(
tbi
),
NULL
);
status
=
pNtQueryInformationThread
(
GetCurrentThread
(),
ThreadBasicInformation
,
&
tbi
,
sizeof
(
tbi
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
todo_wine
ok
(
tbi
.
AffinityMask
==
2
,
"Unexpected thread affinity
\n
"
);
ok
(
tbi
.
AffinityMask
==
2
,
"Unexpected thread affinity
\n
"
);
proc_affinity
=
(
1
<<
si
.
dwNumberOfProcessors
)
-
1
;
proc_affinity
=
(
1
<<
si
.
dwNumberOfProcessors
)
-
1
;
...
@@ -955,7 +954,6 @@ static void test_affinity(void)
...
@@ -955,7 +954,6 @@ static void test_affinity(void)
/* Resetting the process affinity also resets the thread affinity */
/* Resetting the process affinity also resets the thread affinity */
status
=
pNtQueryInformationThread
(
GetCurrentThread
(),
ThreadBasicInformation
,
&
tbi
,
sizeof
(
tbi
),
NULL
);
status
=
pNtQueryInformationThread
(
GetCurrentThread
(),
ThreadBasicInformation
,
&
tbi
,
sizeof
(
tbi
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
todo_wine
ok
(
tbi
.
AffinityMask
==
(
1
<<
si
.
dwNumberOfProcessors
)
-
1
,
ok
(
tbi
.
AffinityMask
==
(
1
<<
si
.
dwNumberOfProcessors
)
-
1
,
"Unexpected thread affinity"
);
"Unexpected thread affinity"
);
}
}
...
...
server/process.c
View file @
24036fe1
...
@@ -1095,6 +1095,18 @@ DECL_HANDLER(get_process_info)
...
@@ -1095,6 +1095,18 @@ DECL_HANDLER(get_process_info)
}
}
}
}
static
void
set_process_affinity
(
struct
process
*
process
,
affinity_t
affinity
)
{
struct
thread
*
thread
;
process
->
affinity
=
affinity
;
LIST_FOR_EACH_ENTRY
(
thread
,
&
process
->
thread_list
,
struct
thread
,
proc_entry
)
{
set_thread_affinity
(
thread
,
affinity
);
}
}
/* set information about a process */
/* set information about a process */
DECL_HANDLER
(
set_process_info
)
DECL_HANDLER
(
set_process_info
)
{
{
...
@@ -1103,7 +1115,7 @@ DECL_HANDLER(set_process_info)
...
@@ -1103,7 +1115,7 @@ DECL_HANDLER(set_process_info)
if
((
process
=
get_process_from_handle
(
req
->
handle
,
PROCESS_SET_INFORMATION
)))
if
((
process
=
get_process_from_handle
(
req
->
handle
,
PROCESS_SET_INFORMATION
)))
{
{
if
(
req
->
mask
&
SET_PROCESS_INFO_PRIORITY
)
process
->
priority
=
req
->
priority
;
if
(
req
->
mask
&
SET_PROCESS_INFO_PRIORITY
)
process
->
priority
=
req
->
priority
;
if
(
req
->
mask
&
SET_PROCESS_INFO_AFFINITY
)
process
->
affinity
=
req
->
affinity
;
if
(
req
->
mask
&
SET_PROCESS_INFO_AFFINITY
)
set_process_affinity
(
process
,
req
->
affinity
)
;
release_object
(
process
);
release_object
(
process
);
}
}
}
}
...
...
server/thread.c
View file @
24036fe1
...
@@ -404,6 +404,11 @@ struct thread *get_thread_from_pid( int pid )
...
@@ -404,6 +404,11 @@ struct thread *get_thread_from_pid( int pid )
return
NULL
;
return
NULL
;
}
}
void
set_thread_affinity
(
struct
thread
*
thread
,
affinity_t
affinity
)
{
thread
->
affinity
=
affinity
;
}
#define THREAD_PRIORITY_REALTIME_HIGHEST 6
#define THREAD_PRIORITY_REALTIME_HIGHEST 6
#define THREAD_PRIORITY_REALTIME_LOWEST -7
#define THREAD_PRIORITY_REALTIME_LOWEST -7
...
@@ -428,7 +433,7 @@ static void set_thread_info( struct thread *thread,
...
@@ -428,7 +433,7 @@ static void set_thread_info( struct thread *thread,
set_error
(
STATUS_INVALID_PARAMETER
);
set_error
(
STATUS_INVALID_PARAMETER
);
}
}
if
(
req
->
mask
&
SET_THREAD_INFO_AFFINITY
)
if
(
req
->
mask
&
SET_THREAD_INFO_AFFINITY
)
thread
->
affinity
=
req
->
affinity
;
set_thread_affinity
(
thread
,
req
->
affinity
)
;
if
(
req
->
mask
&
SET_THREAD_INFO_TOKEN
)
if
(
req
->
mask
&
SET_THREAD_INFO_TOKEN
)
security_set_thread_token
(
thread
,
req
->
token
);
security_set_thread_token
(
thread
,
req
->
token
);
}
}
...
...
server/thread.h
View file @
24036fe1
...
@@ -118,6 +118,7 @@ extern int thread_add_inflight_fd( struct thread *thread, int client, int server
...
@@ -118,6 +118,7 @@ extern int thread_add_inflight_fd( struct thread *thread, int client, int server
extern
int
thread_get_inflight_fd
(
struct
thread
*
thread
,
int
client
);
extern
int
thread_get_inflight_fd
(
struct
thread
*
thread
,
int
client
);
extern
struct
thread_snapshot
*
thread_snap
(
int
*
count
);
extern
struct
thread_snapshot
*
thread_snap
(
int
*
count
);
extern
struct
token
*
thread_get_impersonation_token
(
struct
thread
*
thread
);
extern
struct
token
*
thread_get_impersonation_token
(
struct
thread
*
thread
);
extern
void
set_thread_affinity
(
struct
thread
*
thread
,
affinity_t
affinity
);
/* ptrace functions */
/* ptrace functions */
...
...
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