Added patch to implement support for waiting on job object.

This commit is contained in:
Sebastian Lackner 2015-02-28 07:01:09 +01:00
parent d4871a1b6e
commit c9d3b931f7
4 changed files with 81 additions and 7 deletions

1
debian/changelog vendored
View File

@ -24,6 +24,7 @@ wine-staging (1.7.38) UNRELEASED; urgency=low
* Added patch to implement JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE.
* Added patch to implement PROGDLG_AUTOTIME for IProgressDialog.
* Added patch to implement support for NULL job handles in IsProcessInJob.
* Added patch to implement support for waiting on job object.
* Removed patch to properly call DriverUnload when unloading device drivers (accepted upstream).
* Removed patch to allow Accept-Encoding for HTTP/1.0 in wininet (accepted upstream).
* Removed patch to declare pDirectInputCreateEx in a MSVC compatible way (accepted upstream).

View File

@ -3364,6 +3364,7 @@ if test "$enable_server_JobObjects" -eq 1; then
patch_apply server-JobObjects/0014-server-Implement-JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE.patch
patch_apply server-JobObjects/0015-server-Support-NULL-job-handles-in-IsProcessInJob.patch
patch_apply server-JobObjects/0016-kernel32-tests-Add-tests-for-waiting-on-an-job-objec.patch
patch_apply server-JobObjects/0017-server-Implement-waiting-for-job-objects.patch
(
echo '+ { "Sebastian Lackner", "kernel32/tests: Allow multiple subprocess commands in process tests.", 1 },';
echo '+ { "Andrew Cook", "kernel32/tests: Add tests for IsProcessInJob.", 1 },';
@ -3381,6 +3382,7 @@ if test "$enable_server_JobObjects" -eq 1; then
echo '+ { "Andrew Cook", "server: Implement JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE.", 1 },';
echo '+ { "Andrew Cook", "server: Support NULL job handles in IsProcessInJob.", 1 },';
echo '+ { "Sebastian Lackner", "kernel32/tests: Add tests for waiting on an job object.", 1 },';
echo '+ { "Sebastian Lackner", "server: Implement waiting for job objects.", 1 },';
) >> "$patchlist"
fi

View File

@ -1,17 +1,17 @@
From a3247ac2aff0df776fde55fe2da6f2b9f1324abc Mon Sep 17 00:00:00 2001
From b495ef0dc754b1dcdda42e0f42a6a5305682e26c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 28 Feb 2015 06:09:16 +0100
Subject: kernel32/tests: Add tests for waiting on an job object.
---
dlls/kernel32/tests/process.c | 86 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
dlls/kernel32/tests/process.c | 85 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index 44d98f7..0454bb2 100644
index 44d98f7..e0da270 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -2475,6 +2475,91 @@ static void test_KillOnJobClose(void)
@@ -2475,6 +2475,90 @@ static void test_KillOnJobClose(void)
CloseHandle(pi.hThread);
}
@ -57,7 +57,6 @@ index 44d98f7..0454bb2 100644
+
+ /* the object is not reset immediately */
+ dwret = WaitForSingleObject(job, 100);
+ todo_wine
+ ok(dwret == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", dwret);
+
+ CloseHandle(pi.hProcess);
@ -103,7 +102,7 @@ index 44d98f7..0454bb2 100644
static HANDLE test_LimitActiveProcesses(void)
{
JOBOBJECT_BASIC_LIMIT_INFORMATION limit_info;
@@ -2731,6 +2816,7 @@ START_TEST(process)
@@ -2731,6 +2815,7 @@ START_TEST(process)
test_QueryInformationJobObject();
test_CompletionPort();
test_KillOnJobClose();

View File

@ -0,0 +1,72 @@
From 0bd977f5878df0fbe053847aecf9ae0ed7cd110d Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 28 Feb 2015 06:58:48 +0100
Subject: server: Implement waiting for job objects.
---
dlls/kernel32/tests/process.c | 2 --
server/process.c | 7 ++++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index e0da270..cf2c1df 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -2501,7 +2501,6 @@ static void test_WaitForJobObject(void)
ok(ret, "TerminateJobObject error %u\n", GetLastError());
dwret = WaitForSingleObject(job, 500);
- todo_wine
ok(dwret == WAIT_OBJECT_0 || broken(dwret == WAIT_TIMEOUT),
"WaitForSingleObject returned %u\n", dwret);
@@ -2510,7 +2509,6 @@ static void test_WaitForJobObject(void)
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
CloseHandle(job);
- todo_wine
win_skip("TerminateJobObject doesn't signal job, skipping tests\n");
return;
}
diff --git a/server/process.c b/server/process.c
index db5a3b5..673ce20 100644
--- a/server/process.c
+++ b/server/process.c
@@ -151,6 +151,7 @@ struct job
int num_processes; /* count of running processes */
int limit_flags; /* limit flags */
int terminating; /* job is terminating */
+ int signaled; /* job is signaled */
struct completion *completion_port;
apc_param_t completion_key;
};
@@ -193,6 +194,7 @@ static struct job *create_job_object( struct directory *root, const struct unico
job->num_processes = 0;
job->limit_flags = 0;
job->terminating = 0;
+ job->signaled = 0;
job->completion_port = NULL;
job->completion_key = 0;
}
@@ -290,6 +292,8 @@ static void terminate_job( struct job *job, int exit_code )
}
job->terminating = 0;
+ job->signaled = 1;
+ wake_up( &job->obj, 0 );
}
static int job_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
@@ -327,7 +331,8 @@ static void job_dump( struct object *obj, int verbose )
static int job_signaled( struct object *obj, struct wait_queue_entry *entry )
{
- return 0;
+ struct job *job = (struct job *)obj;
+ return job->signaled;
}
struct ptid_entry
--
2.3.0