2 * Server-side request handling
4 * Copyright (C) 1998 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/port.h"
37 #include <sys/types.h>
38 #ifdef HAVE_SYS_SOCKET_H
39 # include <sys/socket.h>
41 #ifdef HAVE_SYS_WAIT_H
42 # include <sys/wait.h>
55 # include <mach/mach_time.h>
59 #define WIN32_NO_STATUS
64 #include "wine/library.h"
68 #define WANT_REQUEST_HANDLERS
71 /* Some versions of glibc don't define this */
76 /* path names for server master Unix socket */
77 static const char * const server_socket_name
= "socket"; /* name of the socket file */
78 static const char * const server_lock_name
= "lock"; /* name of the server lock file */
82 struct object obj
; /* object header */
83 struct fd
*fd
; /* file descriptor of the master socket */
86 static void master_socket_dump( struct object
*obj
, int verbose
);
87 static void master_socket_destroy( struct object
*obj
);
88 static void master_socket_poll_event( struct fd
*fd
, int event
);
90 static const struct object_ops master_socket_ops
=
92 sizeof(struct master_socket
), /* size */
93 master_socket_dump
, /* dump */
94 no_get_type
, /* get_type */
95 no_add_queue
, /* add_queue */
96 NULL
, /* remove_queue */
99 no_signal
, /* signal */
100 no_get_fd
, /* get_fd */
101 no_map_access
, /* map_access */
102 default_get_sd
, /* get_sd */
103 default_set_sd
, /* set_sd */
104 no_lookup_name
, /* lookup_name */
105 no_open_file
, /* open_file */
106 no_close_handle
, /* close_handle */
107 master_socket_destroy
/* destroy */
110 static const struct fd_ops master_socket_fd_ops
=
112 NULL
, /* get_poll_events */
113 master_socket_poll_event
, /* poll_event */
115 NULL
, /* get_fd_type */
117 NULL
, /* queue_async */
118 NULL
, /* reselect_async */
119 NULL
/* cancel_async */
123 struct thread
*current
= NULL
; /* thread handling the current request */
124 unsigned int global_error
= 0; /* global error code for when no thread is current */
125 timeout_t server_start_time
= 0; /* server startup time */
126 int server_dir_fd
= -1; /* file descriptor for the server dir */
127 int config_dir_fd
= -1; /* file descriptor for the config dir */
129 static struct master_socket
*master_socket
; /* the master socket object */
130 static struct timeout_user
*master_timeout
;
132 /* complain about a protocol error and terminate the client connection */
133 void fatal_protocol_error( struct thread
*thread
, const char *err
, ... )
137 va_start( args
, err
);
138 fprintf( stderr
, "Protocol error:%04x: ", thread
->id
);
139 vfprintf( stderr
, err
, args
);
141 thread
->exit_code
= 1;
142 kill_thread( thread
, 1 );
145 /* complain about a protocol error and terminate the client connection */
146 void fatal_protocol_perror( struct thread
*thread
, const char *err
, ... )
150 va_start( args
, err
);
151 fprintf( stderr
, "Protocol error:%04x: ", thread
->id
);
152 vfprintf( stderr
, err
, args
);
155 thread
->exit_code
= 1;
156 kill_thread( thread
, 1 );
159 /* die on a fatal error */
160 void fatal_error( const char *err
, ... )
164 va_start( args
, err
);
165 fprintf( stderr
, "wineserver: " );
166 vfprintf( stderr
, err
, args
);
171 /* die on a fatal error */
172 void fatal_perror( const char *err
, ... )
176 va_start( args
, err
);
177 fprintf( stderr
, "wineserver: " );
178 vfprintf( stderr
, err
, args
);
184 /* allocate the reply data */
185 void *set_reply_data_size( data_size_t size
)
187 assert( size
<= get_reply_max_size() );
188 if (size
&& !(current
->reply_data
= mem_alloc( size
))) size
= 0;
189 current
->reply_size
= size
;
190 return current
->reply_data
;
193 /* write the remaining part of the reply */
194 void write_reply( struct thread
*thread
)
198 if ((ret
= write( get_unix_fd( thread
->reply_fd
),
199 (char *)thread
->reply_data
+ thread
->reply_size
- thread
->reply_towrite
,
200 thread
->reply_towrite
)) >= 0)
202 if (!(thread
->reply_towrite
-= ret
))
204 free( thread
->reply_data
);
205 thread
->reply_data
= NULL
;
206 /* sent everything, can go back to waiting for requests */
207 set_fd_events( thread
->request_fd
, POLLIN
);
208 set_fd_events( thread
->reply_fd
, 0 );
213 kill_thread( thread
, 0 ); /* normal death */
214 else if (errno
!= EWOULDBLOCK
&& errno
!= EAGAIN
)
215 fatal_protocol_perror( thread
, "reply write" );
218 /* send a reply to the current thread */
219 static void send_reply( union generic_reply
*reply
)
223 if (!current
->reply_size
)
225 if ((ret
= write( get_unix_fd( current
->reply_fd
),
226 reply
, sizeof(*reply
) )) != sizeof(*reply
)) goto error
;
232 vec
[0].iov_base
= (void *)reply
;
233 vec
[0].iov_len
= sizeof(*reply
);
234 vec
[1].iov_base
= current
->reply_data
;
235 vec
[1].iov_len
= current
->reply_size
;
237 if ((ret
= writev( get_unix_fd( current
->reply_fd
), vec
, 2 )) < sizeof(*reply
)) goto error
;
239 if ((current
->reply_towrite
= current
->reply_size
- (ret
- sizeof(*reply
))))
241 /* couldn't write it all, wait for POLLOUT */
242 set_fd_events( current
->reply_fd
, POLLOUT
);
243 set_fd_events( current
->request_fd
, 0 );
247 free( current
->reply_data
);
248 current
->reply_data
= NULL
;
253 fatal_protocol_error( current
, "partial write %d\n", ret
);
254 else if (errno
== EPIPE
)
255 kill_thread( current
, 0 ); /* normal death */
257 fatal_protocol_perror( current
, "reply write" );
260 /* call a request handler */
261 static void call_req_handler( struct thread
*thread
)
263 union generic_reply reply
;
264 enum request req
= thread
->req
.request_header
.req
;
267 current
->reply_size
= 0;
269 memset( &reply
, 0, sizeof(reply
) );
271 if (debug_level
) trace_request();
273 if (req
< REQ_NB_REQUESTS
)
274 req_handlers
[req
]( ¤t
->req
, &reply
);
276 set_error( STATUS_NOT_IMPLEMENTED
);
280 if (current
->reply_fd
)
282 reply
.reply_header
.error
= current
->error
;
283 reply
.reply_header
.reply_size
= current
->reply_size
;
284 if (debug_level
) trace_reply( req
, &reply
);
285 send_reply( &reply
);
289 current
->exit_code
= 1;
290 kill_thread( current
, 1 ); /* no way to continue without reply fd */
296 /* read a request from a thread */
297 void read_request( struct thread
*thread
)
301 if (!thread
->req_toread
) /* no pending request */
303 if ((ret
= read( get_unix_fd( thread
->request_fd
), &thread
->req
,
304 sizeof(thread
->req
) )) != sizeof(thread
->req
)) goto error
;
305 if (!(thread
->req_toread
= thread
->req
.request_header
.request_size
))
307 /* no data, handle request at once */
308 call_req_handler( thread
);
311 if (!(thread
->req_data
= malloc( thread
->req_toread
)))
313 fatal_protocol_error( thread
, "no memory for %u bytes request %d\n",
314 thread
->req_toread
, thread
->req
.request_header
.req
);
319 /* read the variable sized data */
322 ret
= read( get_unix_fd( thread
->request_fd
),
323 (char *)thread
->req_data
+ thread
->req
.request_header
.request_size
324 - thread
->req_toread
,
325 thread
->req_toread
);
327 if (!(thread
->req_toread
-= ret
))
329 call_req_handler( thread
);
330 free( thread
->req_data
);
331 thread
->req_data
= NULL
;
337 if (!ret
) /* closed pipe */
338 kill_thread( thread
, 0 );
340 fatal_protocol_error( thread
, "partial read %d\n", ret
);
341 else if (errno
!= EWOULDBLOCK
&& errno
!= EAGAIN
)
342 fatal_protocol_perror( thread
, "read" );
345 /* receive a file descriptor on the process socket */
346 int receive_fd( struct process
*process
)
350 struct msghdr msghdr
;
353 #ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
354 msghdr
.msg_accrightslen
= sizeof(int);
355 msghdr
.msg_accrights
= (void *)&fd
;
356 #else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
357 char cmsg_buffer
[256];
358 msghdr
.msg_control
= cmsg_buffer
;
359 msghdr
.msg_controllen
= sizeof(cmsg_buffer
);
360 msghdr
.msg_flags
= 0;
361 #endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
363 msghdr
.msg_name
= NULL
;
364 msghdr
.msg_namelen
= 0;
365 msghdr
.msg_iov
= &vec
;
366 msghdr
.msg_iovlen
= 1;
367 vec
.iov_base
= (void *)&data
;
368 vec
.iov_len
= sizeof(data
);
370 ret
= recvmsg( get_unix_fd( process
->msg_fd
), &msghdr
, 0 );
372 #ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
375 struct cmsghdr
*cmsg
;
376 for (cmsg
= CMSG_FIRSTHDR( &msghdr
); cmsg
; cmsg
= CMSG_NXTHDR( &msghdr
, cmsg
))
378 if (cmsg
->cmsg_level
!= SOL_SOCKET
) continue;
379 if (cmsg
->cmsg_type
== SCM_RIGHTS
) fd
= *(int *)CMSG_DATA(cmsg
);
382 #endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
384 if (ret
== sizeof(data
))
386 struct thread
*thread
;
388 if (data
.tid
) thread
= get_thread_from_id( data
.tid
);
389 else thread
= (struct thread
*)grab_object( get_process_first_thread( process
));
391 if (!thread
|| thread
->process
!= process
|| thread
->state
== TERMINATED
)
394 fprintf( stderr
, "%04x: *fd* %d <- %d bad thread id\n",
395 data
.tid
, data
.fd
, fd
);
401 fprintf( stderr
, "%04x: *fd* %d <- %d\n",
402 thread
->id
, data
.fd
, fd
);
403 thread_add_inflight_fd( thread
, data
.fd
, fd
);
405 if (thread
) release_object( thread
);
411 kill_process( process
, 0 );
415 fprintf( stderr
, "Protocol error: process %04x: partial recvmsg %d for fd\n",
417 if (fd
!= -1) close( fd
);
418 kill_process( process
, 1 );
422 if (errno
!= EWOULDBLOCK
&& errno
!= EAGAIN
)
424 fprintf( stderr
, "Protocol error: process %04x: ", process
->id
);
426 kill_process( process
, 1 );
432 /* send an fd to a client */
433 int send_client_fd( struct process
*process
, int fd
, obj_handle_t handle
)
436 struct msghdr msghdr
;
439 #ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
440 msghdr
.msg_accrightslen
= sizeof(fd
);
441 msghdr
.msg_accrights
= (void *)&fd
;
442 #else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
443 char cmsg_buffer
[256];
444 struct cmsghdr
*cmsg
;
445 msghdr
.msg_control
= cmsg_buffer
;
446 msghdr
.msg_controllen
= sizeof(cmsg_buffer
);
447 msghdr
.msg_flags
= 0;
448 cmsg
= CMSG_FIRSTHDR( &msghdr
);
449 cmsg
->cmsg_len
= CMSG_LEN( sizeof(fd
) );
450 cmsg
->cmsg_level
= SOL_SOCKET
;
451 cmsg
->cmsg_type
= SCM_RIGHTS
;
452 *(int *)CMSG_DATA(cmsg
) = fd
;
453 msghdr
.msg_controllen
= cmsg
->cmsg_len
;
454 #endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
456 msghdr
.msg_name
= NULL
;
457 msghdr
.msg_namelen
= 0;
458 msghdr
.msg_iov
= &vec
;
459 msghdr
.msg_iovlen
= 1;
461 vec
.iov_base
= (void *)&handle
;
462 vec
.iov_len
= sizeof(handle
);
465 fprintf( stderr
, "%04x: *fd* %04x -> %d\n", current
? current
->id
: process
->id
, handle
, fd
);
467 ret
= sendmsg( get_unix_fd( process
->msg_fd
), &msghdr
, 0 );
469 if (ret
== sizeof(handle
)) return 0;
473 fprintf( stderr
, "Protocol error: process %04x: partial sendmsg %d\n", process
->id
, ret
);
474 kill_process( process
, 1 );
476 else if (errno
== EPIPE
)
478 kill_process( process
, 0 );
482 fprintf( stderr
, "Protocol error: process %04x: ", process
->id
);
484 kill_process( process
, 1 );
489 /* get current tick count to return to client */
490 unsigned int get_tick_count(void)
492 #ifdef HAVE_CLOCK_GETTIME
494 #ifdef CLOCK_MONOTONIC_RAW
495 if (!clock_gettime( CLOCK_MONOTONIC_RAW
, &ts
))
496 return ts
.tv_sec
* 1000 + ts
.tv_nsec
/ 1000000;
498 if (!clock_gettime( CLOCK_MONOTONIC
, &ts
))
499 return ts
.tv_sec
* 1000 + ts
.tv_nsec
/ 1000000;
500 #elif defined(__APPLE__)
501 static mach_timebase_info_data_t timebase
;
503 if (!timebase
.denom
) mach_timebase_info( &timebase
);
504 return mach_absolute_time() * timebase
.numer
/ timebase
.denom
/ 1000000;
506 return (current_time
- server_start_time
) / 10000;
509 static void master_socket_dump( struct object
*obj
, int verbose
)
511 struct master_socket
*sock
= (struct master_socket
*)obj
;
512 assert( obj
->ops
== &master_socket_ops
);
513 fprintf( stderr
, "Master socket fd=%p\n", sock
->fd
);
516 static void master_socket_destroy( struct object
*obj
)
518 struct master_socket
*sock
= (struct master_socket
*)obj
;
519 assert( obj
->ops
== &master_socket_ops
);
520 release_object( sock
->fd
);
523 /* handle a socket event */
524 static void master_socket_poll_event( struct fd
*fd
, int event
)
526 struct master_socket
*sock
= get_fd_user( fd
);
527 assert( master_socket
->obj
.ops
== &master_socket_ops
);
529 assert( sock
== master_socket
); /* there is only one master socket */
531 if (event
& (POLLERR
| POLLHUP
))
533 /* this is not supposed to happen */
534 fprintf( stderr
, "wineserver: Error on master socket\n" );
535 set_fd_events( sock
->fd
, -1 );
537 else if (event
& POLLIN
)
539 struct sockaddr_un dummy
;
540 unsigned int len
= sizeof(dummy
);
541 int client
= accept( get_unix_fd( master_socket
->fd
), (struct sockaddr
*) &dummy
, &len
);
542 if (client
== -1) return;
543 fcntl( client
, F_SETFL
, O_NONBLOCK
);
544 create_process( client
, NULL
, 0 );
548 /* remove the socket upon exit */
549 static void socket_cleanup(void)
551 static int do_it_once
;
552 if (!do_it_once
++) unlink( server_socket_name
);
555 /* create a directory and check its permissions */
556 static void create_dir( const char *name
, struct stat
*st
)
558 if (lstat( name
, st
) == -1)
560 if (errno
!= ENOENT
) fatal_perror( "lstat %s", name
);
561 if (mkdir( name
, 0700 ) == -1 && errno
!= EEXIST
) fatal_perror( "mkdir %s", name
);
562 if (lstat( name
, st
) == -1) fatal_perror( "lstat %s", name
);
564 if (!S_ISDIR(st
->st_mode
)) fatal_error( "%s is not a directory\n", name
);
565 if (st
->st_uid
!= getuid()) fatal_error( "%s is not owned by you\n", name
);
566 if (st
->st_mode
& 077) fatal_error( "%s must not be accessible by other users\n", name
);
569 /* create the server directory and chdir to it */
570 static void create_server_dir( const char *dir
)
572 char *p
, *server_dir
;
575 if (!(server_dir
= strdup( dir
))) fatal_error( "out of memory\n" );
577 /* first create the base directory if needed */
579 p
= strrchr( server_dir
, '/' );
581 create_dir( server_dir
, &st
);
583 /* now create the server directory */
586 create_dir( server_dir
, &st
);
588 if (chdir( server_dir
) == -1) fatal_perror( "chdir %s", server_dir
);
589 if ((server_dir_fd
= open( ".", O_RDONLY
)) == -1) fatal_perror( "open %s", server_dir
);
590 if (fstat( server_dir_fd
, &st2
) == -1) fatal_perror( "stat %s", server_dir
);
591 if (st
.st_dev
!= st2
.st_dev
|| st
.st_ino
!= st2
.st_ino
)
592 fatal_error( "chdir did not end up in %s\n", server_dir
);
597 /* create the lock file and return its file descriptor */
598 static int create_server_lock(void)
603 if (lstat( server_lock_name
, &st
) == -1)
606 fatal_perror( "lstat %s/%s", wine_get_server_dir(), server_lock_name
);
610 if (!S_ISREG(st
.st_mode
))
611 fatal_error( "%s/%s is not a regular file\n", wine_get_server_dir(), server_lock_name
);
614 if ((fd
= open( server_lock_name
, O_CREAT
|O_TRUNC
|O_WRONLY
, 0600 )) == -1)
615 fatal_perror( "error creating %s/%s", wine_get_server_dir(), server_lock_name
);
619 /* wait for the server lock */
620 int wait_for_lock(void)
622 const char *server_dir
= wine_get_server_dir();
626 if (!server_dir
) return 0; /* no server dir, so no lock to wait on */
628 create_server_dir( server_dir
);
629 fd
= create_server_lock();
632 fl
.l_whence
= SEEK_SET
;
635 r
= fcntl( fd
, F_SETLKW
, &fl
);
641 /* kill the wine server holding the lock */
642 int kill_lock_owner( int sig
)
644 const char *server_dir
= wine_get_server_dir();
649 if (!server_dir
) return 0; /* no server dir, nothing to do */
651 create_server_dir( server_dir
);
652 fd
= create_server_lock();
654 for (i
= 1; i
<= 20; i
++)
657 fl
.l_whence
= SEEK_SET
;
660 if (fcntl( fd
, F_GETLK
, &fl
) == -1) goto done
;
661 if (fl
.l_type
!= F_WRLCK
) goto done
; /* the file is not locked */
662 if (!pid
) /* first time around */
664 if (!(pid
= fl
.l_pid
)) goto done
; /* shouldn't happen */
667 if (kill( pid
, SIGINT
) == -1) goto done
;
668 kill( pid
, SIGCONT
);
671 else /* just send the specified signal and return */
673 ret
= (kill( pid
, sig
) != -1);
677 else if (fl
.l_pid
!= pid
) goto done
; /* no longer the same process */
680 /* waited long enough, now kill it */
681 kill( pid
, SIGKILL
);
688 /* acquire the main server lock */
689 static void acquire_lock(void)
691 struct sockaddr_un addr
;
694 int fd
, slen
, got_lock
= 0;
696 fd
= create_server_lock();
699 fl
.l_whence
= SEEK_SET
;
702 if (fcntl( fd
, F_SETLK
, &fl
) != -1)
704 /* check for crashed server */
705 if (stat( server_socket_name
, &st
) != -1 && /* there is a leftover socket */
706 stat( "core", &st
) != -1 && st
.st_size
) /* and there is a non-empty core file */
709 "Warning: a previous instance of the wine server seems to have crashed.\n"
710 "Please run 'gdb %s %s/core',\n"
711 "type 'backtrace' at the gdb prompt and report the results. Thanks.\n\n",
712 server_argv0
, wine_get_server_dir() );
714 unlink( server_socket_name
); /* we got the lock, we can safely remove the socket */
716 /* in that case we reuse fd without closing it, this ensures
717 * that we hold the lock until the process exits */
726 /* check whether locks work at all on this file system */
727 if (fcntl( fd
, F_GETLK
, &fl
) == -1) break;
730 exit(2); /* we didn't get the lock, exit with special status */
732 fatal_perror( "fcntl %s/%s", wine_get_server_dir(), server_lock_name
);
734 /* it seems we can't use locks on this fs, so we will use the socket existence as lock */
738 if ((fd
= socket( AF_UNIX
, SOCK_STREAM
, 0 )) == -1) fatal_perror( "socket" );
739 addr
.sun_family
= AF_UNIX
;
740 strcpy( addr
.sun_path
, server_socket_name
);
741 slen
= sizeof(addr
) - sizeof(addr
.sun_path
) + strlen(addr
.sun_path
) + 1;
742 #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
745 if (bind( fd
, (struct sockaddr
*)&addr
, slen
) == -1)
747 if ((errno
== EEXIST
) || (errno
== EADDRINUSE
))
750 fatal_error( "couldn't bind to the socket even though we hold the lock\n" );
751 exit(2); /* we didn't get the lock, exit with special status */
753 fatal_perror( "bind" );
755 atexit( socket_cleanup
);
756 chmod( server_socket_name
, 0600 ); /* make sure no other user can connect */
757 if (listen( fd
, 5 ) == -1) fatal_perror( "listen" );
759 if (!(master_socket
= alloc_object( &master_socket_ops
)) ||
760 !(master_socket
->fd
= create_anonymous_fd( &master_socket_fd_ops
, fd
, &master_socket
->obj
, 0 )))
761 fatal_error( "out of memory\n" );
762 set_fd_events( master_socket
->fd
, POLLIN
);
763 make_object_static( &master_socket
->obj
);
766 /* open the master server socket and start waiting for new clients */
767 void open_master_socket(void)
769 const char *server_dir
= wine_get_server_dir();
770 const char *config_dir
= wine_get_config_dir();
771 int fd
, pid
, status
, sync_pipe
[2];
774 /* make sure no request is larger than the maximum size */
775 assert( sizeof(union generic_request
) == sizeof(struct request_max_size
) );
776 assert( sizeof(union generic_reply
) == sizeof(struct request_max_size
) );
778 /* make sure the stdio fds are open */
779 fd
= open( "/dev/null", O_RDWR
);
780 while (fd
>= 0 && fd
<= 2) fd
= dup( fd
);
782 if (!server_dir
) fatal_error( "directory %s cannot be accessed\n", config_dir
);
783 if (chdir( config_dir
) == -1) fatal_perror( "chdir to %s", config_dir
);
784 if ((config_dir_fd
= open( ".", O_RDONLY
)) == -1) fatal_perror( "open %s", config_dir
);
786 create_server_dir( server_dir
);
790 if (pipe( sync_pipe
) == -1) fatal_perror( "pipe" );
796 close( sync_pipe
[0] );
800 /* close stdin and stdout */
806 write( sync_pipe
[1], &dummy
, 1 );
807 close( sync_pipe
[1] );
811 fatal_perror( "fork" );
814 default: /* parent */
815 close( sync_pipe
[1] );
817 /* wait for child to signal us and then exit */
818 if (read( sync_pipe
[0], &dummy
, 1 ) == 1) _exit(0);
820 /* child terminated, propagate exit status */
821 waitpid( pid
, &status
, 0 );
822 if (WIFEXITED(status
)) _exit( WEXITSTATUS(status
) );
826 else /* remain in the foreground */
831 /* init the process tracing mechanism */
832 init_tracing_mechanism();
836 /* master socket timer expiration handler */
837 static void close_socket_timeout( void *arg
)
839 master_timeout
= NULL
;
841 if (debug_level
) fprintf( stderr
, "wineserver: exiting (pid=%ld)\n", (long) getpid() );
844 close_objects(); /* shut down everything properly */
849 /* close the master socket and stop waiting for new clients */
850 void close_master_socket( timeout_t timeout
)
854 release_object( master_socket
);
855 master_socket
= NULL
;
857 if (master_timeout
) /* cancel previous timeout */
858 remove_timeout_user( master_timeout
);
860 master_timeout
= add_timeout_user( timeout
, close_socket_timeout
, NULL
);