Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
7ad5be96
Commit
7ad5be96
authored
Mar 14, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added -f option to make wineserver remain in the foreground for
debugging. Close stdin/stdout when not in the foreground (based on a patch by Francois Gouget).
parent
a67d999d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
23 deletions
+44
-23
main.c
server/main.c
+5
-0
object.h
server/object.h
+1
-0
request.c
server/request.c
+38
-23
No files found.
server/main.c
View file @
7ad5be96
...
...
@@ -35,6 +35,7 @@
/* command-line options */
int
debug_level
=
0
;
int
master_socket_timeout
=
3
;
/* master socket timeout in seconds, default is 3 s */
int
foreground
=
0
;
const
char
*
server_argv0
;
/* name space for synchronization objects */
...
...
@@ -49,6 +50,7 @@ static void usage(void)
fprintf
(
stderr
,
"options:
\n
"
);
fprintf
(
stderr
,
" -d<n> set debug level to <n>
\n
"
);
fprintf
(
stderr
,
" -p[n] make server persistent, optionally for n seconds
\n
"
);
fprintf
(
stderr
,
" -f remain in the foreground for debugging
\n
"
);
fprintf
(
stderr
,
" -w wait until the current wineserver terminates
\n
"
);
fprintf
(
stderr
,
" -k[n] kill the current wineserver, optionally with signal n
\n
"
);
fprintf
(
stderr
,
" -h display this help message
\n
"
);
...
...
@@ -70,6 +72,9 @@ static void parse_args( int argc, char *argv[] )
if
(
isdigit
(
argv
[
i
][
2
]))
debug_level
=
atoi
(
argv
[
i
]
+
2
);
else
debug_level
++
;
break
;
case
'f'
:
foreground
=
1
;
break
;
case
'h'
:
usage
();
exit
(
0
);
...
...
server/object.h
View file @
7ad5be96
...
...
@@ -156,6 +156,7 @@ extern void release_global_atom( atom_t atom );
/* command-line options */
extern
int
debug_level
;
extern
int
master_socket_timeout
;
extern
int
foreground
;
extern
const
char
*
server_argv0
;
/* server start time used for GetTickCount() */
...
...
server/request.c
View file @
7ad5be96
...
...
@@ -705,7 +705,7 @@ static void acquire_lock(void)
/* open the master server socket and start waiting for new clients */
void
open_master_socket
(
void
)
{
int
pid
,
status
,
sync_pipe
[
2
];
int
fd
,
pid
,
status
,
sync_pipe
[
2
];
char
dummy
;
/* make sure no request is larger than the maximum size */
...
...
@@ -713,36 +713,51 @@ void open_master_socket(void)
assert
(
sizeof
(
union
generic_reply
)
==
sizeof
(
struct
request_max_size
)
);
create_server_dir
();
if
(
pipe
(
sync_pipe
)
==
-
1
)
fatal_perror
(
"pipe"
);
pid
=
fork
();
switch
(
pid
)
if
(
!
foreground
)
{
case
0
:
/* child */
setsid
();
close
(
sync_pipe
[
0
]
);
if
(
pipe
(
sync_pipe
)
==
-
1
)
fatal_perror
(
"pipe"
);
pid
=
fork
();
switch
(
pid
)
{
case
0
:
/* child */
setsid
();
close
(
sync_pipe
[
0
]
);
acquire_lock
();
acquire_lock
();
/* signal parent */
write
(
sync_pipe
[
1
],
&
dummy
,
1
);
close
(
sync_pipe
[
1
]
);
break
;
/* close stdin and stdout */
if
((
fd
=
open
(
"/dev/null"
,
O_RDWR
))
!=
-
1
)
{
dup2
(
fd
,
0
);
dup2
(
fd
,
1
);
close
(
fd
);
}
case
-
1
:
fatal_perror
(
"fork"
);
break
;
/* signal parent */
write
(
sync_pipe
[
1
],
&
dummy
,
1
);
close
(
sync_pipe
[
1
]
);
break
;
default:
/* parent */
close
(
sync_pipe
[
1
]
);
case
-
1
:
fatal_perror
(
"fork"
);
break
;
/* wait for child to signal us and then exi
t */
if
(
read
(
sync_pipe
[
0
],
&
dummy
,
1
)
==
1
)
_exit
(
0
);
default:
/* paren
t */
close
(
sync_pipe
[
1
]
);
/* child terminated, propagate exit status */
wait4
(
pid
,
&
status
,
0
,
NULL
);
if
(
WIFEXITED
(
status
))
_exit
(
WEXITSTATUS
(
status
)
);
_exit
(
1
);
/* wait for child to signal us and then exit */
if
(
read
(
sync_pipe
[
0
],
&
dummy
,
1
)
==
1
)
_exit
(
0
);
/* child terminated, propagate exit status */
wait4
(
pid
,
&
status
,
0
,
NULL
);
if
(
WIFEXITED
(
status
))
_exit
(
WEXITSTATUS
(
status
)
);
_exit
(
1
);
}
}
else
/* remain in the foreground */
{
acquire_lock
();
}
/* setup msghdr structure constant fields */
...
...
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