Added add_queue/remove_queue to server object operations.
Moved select() loop functions to select.c.

diff --git a/include/server/object.h b/include/server/object.h
index a968dda..c00fbc0 100644
--- a/include/server/object.h
+++ b/include/server/object.h
@@ -20,13 +20,22 @@
 struct object;
 struct object_name;
 struct thread;
+struct wait_queue_entry;
 
 struct object_ops
 {
-    void (*dump)(struct object *,int);                  /* dump the object (for debugging) */
-    int  (*signaled)(struct object *,struct thread *);  /* is object signaled? */
-    int  (*satisfied)(struct object *,struct thread *); /* wait satisfied; return 1 if abandoned */
-    void (*destroy)(struct object *);                   /* destroy on refcount == 0 */
+    /* dump the object (for debugging) */
+    void (*dump)(struct object *,int);
+    /* add a thread to the object wait queue */
+    void (*add_queue)(struct object *,struct wait_queue_entry *);
+    /* remove a thread from the object wait queue */
+    void (*remove_queue)(struct object *,struct wait_queue_entry *);
+    /* is object signaled? */
+    int  (*signaled)(struct object *,struct thread *);
+    /* wait satisfied; return 1 if abandoned */
+    int  (*satisfied)(struct object *,struct thread *);
+    /* destroy on refcount == 0 */
+    void (*destroy)(struct object *);
 };
 
 struct object
@@ -65,8 +74,27 @@
 extern void trace_reply( struct thread *thread, int type, int pass_fd,
                          struct iovec *vec, int veclen );
 
+/* select functions */
+
+#define READ_EVENT    1
+#define WRITE_EVENT   2
+
+struct select_ops
+{
+    void (*event)( int fd, int event, void *private );
+    void (*timeout)( int fd, void *private );
+};
+
+extern int add_select_user( int fd, int events, const struct select_ops *ops, void *private );
+extern void remove_select_user( int fd );
+extern void set_select_timeout( int fd, struct timeval *when );
+extern void set_select_events( int fd, int events );
+extern void *get_select_private_data( const struct select_ops *ops, int fd );
+extern void select_loop(void);
+
 /* socket functions */
 
+extern void server_init( int fd );
 extern int add_client( int client_fd, struct thread *self );
 extern void remove_client( int client_fd, int exit_code );
 extern int get_initial_client_fd(void);
diff --git a/include/server/thread.h b/include/server/thread.h
index c9c373a..9931301 100644
--- a/include/server/thread.h
+++ b/include/server/thread.h
@@ -52,6 +52,8 @@
                              struct get_thread_info_reply *reply );
 extern int send_reply( struct thread *thread, int pass_fd,
                        int n, ... /* arg_1, len_1, ..., arg_n, len_n */ );
+extern void add_queue( struct object *obj, struct wait_queue_entry *entry );
+extern void remove_queue( struct object *obj, struct wait_queue_entry *entry );
 extern void kill_thread( struct thread *thread, int exit_code );
 extern void thread_killed( struct thread *thread, int exit_code );
 extern void thread_timeout(void);