Rebase against b21a3240705fdaf9f70a0eb1d2ff4736efcd35c9.

This commit is contained in:
Sebastian Lackner
2016-02-05 19:52:28 +01:00
parent f6e35db051
commit 750454d6f1
8 changed files with 324 additions and 262 deletions

View File

@ -1,4 +1,4 @@
From c6d16cb51a12109111ca19308c2062338da82ed4 Mon Sep 17 00:00:00 2001
From bb902548f15deec4dc9d9eaaf6e78b4cbdb01f87 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 4 Dec 2015 10:36:47 +0100
Subject: server: Introduce a new alloc_handle object callback. (v2)
@ -98,12 +98,12 @@ index 7b92706..fa3aa51 100644
no_destroy /* destroy */
};
diff --git a/server/completion.c b/server/completion.c
index 072bc0a1..909df81 100644
index 759c6e2..bca0963 100644
--- a/server/completion.c
+++ b/server/completion.c
@@ -75,6 +75,7 @@ static const struct object_ops completion_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
@ -158,7 +158,7 @@ index 2eb794a..a2c07ba 100644
debug_ctx_destroy /* destroy */
};
diff --git a/server/device.c b/server/device.c
index c6e95b1..8ff6cde 100644
index a8f6f5d..4fdf7ad 100644
--- a/server/device.c
+++ b/server/device.c
@@ -81,6 +81,7 @@ static const struct object_ops irp_call_ops =
@ -178,8 +178,8 @@ index c6e95b1..8ff6cde 100644
device_manager_destroy /* destroy */
};
@@ -158,6 +160,7 @@ static const struct object_ops device_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
device_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
@ -194,40 +194,40 @@ index c6e95b1..8ff6cde 100644
device_file_destroy /* destroy */
};
diff --git a/server/directory.c b/server/directory.c
index 56c5bf1..a12fb00 100644
index 45683b9..445c35c 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -67,6 +67,7 @@ static const struct object_ops object_type_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
@@ -102,6 +103,7 @@ static const struct object_ops directory_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
directory_destroy /* destroy */
};
diff --git a/server/event.c b/server/event.c
index cc4ef4f..8325b09 100644
index c9a0ebb..36ea8fd 100644
--- a/server/event.c
+++ b/server/event.c
@@ -68,6 +68,7 @@ static const struct object_ops event_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
@@ -101,6 +102,7 @@ static const struct object_ops keyed_event_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
@ -339,18 +339,18 @@ index 3a0e4b4..dc653b8 100644
hook_table_destroy /* destroy */
};
diff --git a/server/mailslot.c b/server/mailslot.c
index 9f18083..1c5e0d5 100644
index a0fa6e2..bff0208 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -88,6 +88,7 @@ static const struct object_ops mailslot_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
@@ -89,6 +89,7 @@ static const struct object_ops mailslot_ops =
mailslot_link_name, /* link_name */
default_unlink_name, /* unlink_name */
mailslot_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
fd_close_handle, /* close_handle */
mailslot_destroy /* destroy */
};
@@ -143,6 +144,7 @@ static const struct object_ops mail_writer_ops =
@@ -144,6 +145,7 @@ static const struct object_ops mail_writer_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
no_open_file, /* open_file */
@ -358,51 +358,51 @@ index 9f18083..1c5e0d5 100644
fd_close_handle, /* close_handle */
mail_writer_destroy /* destroy */
};
@@ -199,6 +201,7 @@ static const struct object_ops mailslot_device_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
@@ -200,6 +202,7 @@ static const struct object_ops mailslot_device_ops =
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
mailslot_device_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
fd_close_handle, /* close_handle */
mailslot_device_destroy /* destroy */
};
diff --git a/server/mapping.c b/server/mapping.c
index 9504996..b2749d2 100644
index 4384cec..fc6404f 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -94,6 +94,7 @@ static const struct object_ops mapping_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
fd_close_handle, /* close_handle */
mapping_destroy /* destroy */
};
diff --git a/server/mutex.c b/server/mutex.c
index 08a2477..bfa56a7 100644
index ca0da59..3598ac9 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -71,6 +71,7 @@ static const struct object_ops mutex_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
mutex_destroy /* destroy */
};
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 0bd6064..9eef654 100644
index 1e4169d..ade9165 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -134,6 +134,7 @@ static const struct object_ops named_pipe_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
@@ -135,6 +135,7 @@ static const struct object_ops named_pipe_ops =
named_pipe_link_name, /* link_name */
default_unlink_name, /* unlink_name */
named_pipe_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
named_pipe_destroy /* destroy */
};
@@ -165,6 +166,7 @@ static const struct object_ops pipe_server_ops =
@@ -166,6 +167,7 @@ static const struct object_ops pipe_server_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
no_open_file, /* open_file */
@ -410,7 +410,7 @@ index 0bd6064..9eef654 100644
fd_close_handle, /* close_handle */
pipe_server_destroy /* destroy */
};
@@ -209,6 +211,7 @@ static const struct object_ops pipe_client_ops =
@@ -210,6 +212,7 @@ static const struct object_ops pipe_client_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
no_open_file, /* open_file */
@ -418,19 +418,19 @@ index 0bd6064..9eef654 100644
fd_close_handle, /* close_handle */
pipe_client_destroy /* destroy */
};
@@ -257,6 +260,7 @@ static const struct object_ops named_pipe_device_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
@@ -258,6 +261,7 @@ static const struct object_ops named_pipe_device_ops =
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
named_pipe_device_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
fd_close_handle, /* close_handle */
named_pipe_device_destroy /* destroy */
};
diff --git a/server/object.c b/server/object.c
index 4f23e0c..c641e4e 100644
index b8be122..8310067 100644
--- a/server/object.c
+++ b/server/object.c
@@ -564,6 +564,10 @@ struct object *no_open_file( struct object *obj, unsigned int access, unsigned i
@@ -563,6 +563,10 @@ struct object *no_open_file( struct object *obj, unsigned int access, unsigned i
return NULL;
}
@ -442,7 +442,7 @@ index 4f23e0c..c641e4e 100644
{
return 1; /* ok to close */
diff --git a/server/object.h b/server/object.h
index 3d6ba8a..353a9e2 100644
index c4bc40b..16bf089 100644
--- a/server/object.h
+++ b/server/object.h
@@ -90,8 +90,10 @@ struct object_ops
@ -457,8 +457,8 @@ index 3d6ba8a..353a9e2 100644
/* destroy on refcount == 0 */
void (*destroy)(struct object *);
};
@@ -150,6 +152,7 @@ extern struct object *no_lookup_name( struct object *obj, struct unicode_str *na
extern int no_link_name( struct object *obj, struct object_name *name, struct object *parent );
@@ -161,6 +163,7 @@ extern int no_link_name( struct object *obj, struct object_name *name, struct ob
extern void default_unlink_name( struct object *obj, struct object_name *name );
extern struct object *no_open_file( struct object *obj, unsigned int access, unsigned int sharing,
unsigned int options );
+extern void no_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle );
@ -466,7 +466,7 @@ index 3d6ba8a..353a9e2 100644
extern void no_destroy( struct object *obj );
#ifdef DEBUG_OBJECTS
diff --git a/server/process.c b/server/process.c
index d51c884..0f37a3b 100644
index c9bcabb..cc9c01c 100644
--- a/server/process.c
+++ b/server/process.c
@@ -84,6 +84,7 @@ static const struct object_ops process_ops =
@ -486,8 +486,8 @@ index d51c884..0f37a3b 100644
startup_info_destroy /* destroy */
};
@@ -177,6 +179,7 @@ static const struct object_ops job_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
job_close_handle, /* close_handle */
@ -538,12 +538,12 @@ index dfa4485..122de96 100644
master_socket_destroy /* destroy */
};
diff --git a/server/semaphore.c b/server/semaphore.c
index 515f49e..a0df7cf 100644
index c77bd58..9c06ce4 100644
--- a/server/semaphore.c
+++ b/server/semaphore.c
@@ -68,6 +68,7 @@ static const struct object_ops semaphore_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
@ -606,12 +606,12 @@ index dc10d2a..a11964f 100644
ifchange_destroy /* destroy */
};
diff --git a/server/symlink.c b/server/symlink.c
index 09443b8..a74fa7c 100644
index bd09d34..6607e47 100644
--- a/server/symlink.c
+++ b/server/symlink.c
@@ -70,6 +70,7 @@ static const struct object_ops symlink_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
@ -638,12 +638,12 @@ index ca02a8a..71b4d7b 100644
destroy_thread /* destroy */
};
diff --git a/server/timer.c b/server/timer.c
index ef9aa08..c80069a 100644
index 0d81d90..966d65d 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -75,6 +75,7 @@ static const struct object_ops timer_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
@ -662,20 +662,20 @@ index ca12813..e13d03a 100644
token_destroy /* destroy */
};
diff --git a/server/winstation.c b/server/winstation.c
index 6e1c754..ab3dd05 100644
index 9dc348d..17c312a 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -72,6 +72,7 @@ static const struct object_ops winstation_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
@@ -73,6 +73,7 @@ static const struct object_ops winstation_ops =
directory_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
winstation_close_handle, /* close_handle */
winstation_destroy /* destroy */
};
@@ -95,6 +96,7 @@ static const struct object_ops desktop_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
@@ -96,6 +97,7 @@ static const struct object_ops desktop_ops =
desktop_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
+ no_alloc_handle, /* alloc_handle */
desktop_close_handle, /* close_handle */

View File

@ -1,4 +1,4 @@
From b66d03524b625b22f92f60b1856c7ac89197e809 Mon Sep 17 00:00:00 2001
From 02981c79c3ad972000fd3f397371f284ce9fade6 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 4 Dec 2015 01:22:29 +0100
Subject: server: Track desktop handle count more correctly.
@ -88,7 +88,7 @@ index f1deb79..1347836 100644
extern struct handle_table *alloc_handle_table( struct process *process, int count );
extern struct handle_table *copy_handle_table( struct process *process, struct process *parent );
diff --git a/server/process.c b/server/process.c
index 0f37a3b..0bc1edd 100644
index cc9c01c..b43e1f8 100644
--- a/server/process.c
+++ b/server/process.c
@@ -838,7 +838,6 @@ static void process_killed( struct process *process )
@ -100,28 +100,28 @@ index 0f37a3b..0bc1edd 100644
process->desktop = 0;
close_process_handles( process );
diff --git a/server/winstation.c b/server/winstation.c
index ab3dd05..9924cbe 100644
index 17c312a..46ade3b 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -50,6 +50,7 @@ static void winstation_destroy( struct object *obj );
static unsigned int winstation_map_access( struct object *obj, unsigned int access );
@@ -51,6 +51,7 @@ static unsigned int winstation_map_access( struct object *obj, unsigned int acce
static void desktop_dump( struct object *obj, int verbose );
static struct object_type *desktop_get_type( struct object *obj );
static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent );
+static void desktop_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle );
static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
static void desktop_destroy( struct object *obj );
static unsigned int desktop_map_access( struct object *obj, unsigned int access );
@@ -96,7 +97,7 @@ static const struct object_ops desktop_ops =
no_link_name, /* link_name */
NULL, /* unlink_name */
@@ -97,7 +98,7 @@ static const struct object_ops desktop_ops =
desktop_link_name, /* link_name */
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
- no_alloc_handle, /* alloc_handle */
+ desktop_alloc_handle, /* alloc_handle */
desktop_close_handle, /* close_handle */
desktop_destroy /* destroy */
};
@@ -240,14 +241,54 @@ static struct object_type *desktop_get_type( struct object *obj )
return get_object_type( &str );
@@ -253,14 +254,54 @@ static int desktop_link_name( struct object *obj, struct object_name *name, stru
return 1;
}
+static void close_desktop_timeout( void *private )
@ -175,7 +175,7 @@ index ab3dd05..9924cbe 100644
return 1;
}
@@ -255,6 +296,7 @@ static void desktop_destroy( struct object *obj )
@@ -268,6 +309,7 @@ static void desktop_destroy( struct object *obj )
{
struct desktop *desktop = (struct desktop *)obj;
@ -183,7 +183,7 @@ index ab3dd05..9924cbe 100644
free_hotkeys( desktop, 0 );
if (desktop->top_window) destroy_window( desktop->top_window );
if (desktop->msg_window) destroy_window( desktop->msg_window );
@@ -282,40 +324,6 @@ struct desktop *get_thread_desktop( struct thread *thread, unsigned int access )
@@ -294,40 +336,6 @@ struct desktop *get_thread_desktop( struct thread *thread, unsigned int access )
return get_desktop_obj( thread->process, thread->desktop, access );
}
@ -224,7 +224,7 @@ index ab3dd05..9924cbe 100644
/* set the process default desktop handle */
void set_process_default_desktop( struct process *process, struct desktop *desktop,
obj_handle_t handle )
@@ -332,12 +340,6 @@ void set_process_default_desktop( struct process *process, struct desktop *deskt
@@ -344,12 +352,6 @@ void set_process_default_desktop( struct process *process, struct desktop *deskt
LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
if (!thread->desktop) thread->desktop = handle;
@ -237,7 +237,7 @@ index ab3dd05..9924cbe 100644
if (old_desktop) release_object( old_desktop );
}
@@ -387,8 +389,8 @@ done:
@@ -399,8 +401,8 @@ done:
void close_process_desktop( struct process *process )
{
struct desktop *desktop;