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
77fde137
Commit
77fde137
authored
Apr 26, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly handle the wait4 syscall failure on kernels that don't
support the __WALL flag.
parent
056e4197
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
ptrace.c
server/ptrace.c
+19
-6
No files found.
server/ptrace.c
View file @
77fde137
...
...
@@ -66,10 +66,6 @@
inline
static
int
ptrace
(
int
req
,
...)
{
errno
=
EPERM
;
return
-
1
;
/*FAIL*/
}
#endif
/* HAVE_SYS_PTRACE_H */
#ifndef __WALL
#define __WALL 0
#endif
static
const
int
use_ptrace
=
1
;
/* set to 0 to disable ptrace */
/* handle a status returned by wait4 */
...
...
@@ -108,6 +104,23 @@ static int handle_child_status( struct thread *thread, int pid, int status, int
return
0
;
}
/* wait4 wrapper to handle missing __WALL flag in older kernels */
static
inline
pid_t
wait4_wrapper
(
pid_t
pid
,
int
*
status
,
int
options
,
struct
rusage
*
usage
)
{
#ifdef __WALL
static
int
wall_flag
=
__WALL
;
for
(;;)
{
pid_t
ret
=
wait4
(
pid
,
status
,
options
|
wall_flag
,
usage
);
if
(
ret
!=
-
1
||
!
wall_flag
||
errno
!=
EINVAL
)
return
ret
;
wall_flag
=
0
;
}
#else
return
wait4
(
pid
,
status
,
options
,
usage
);
#endif
}
/* handle a SIGCHLD signal */
void
sigchld_callback
(
void
)
{
...
...
@@ -115,7 +128,7 @@ void sigchld_callback(void)
for
(;;)
{
if
(
!
(
pid
=
wait4
(
-
1
,
&
status
,
WUNTRACED
|
WNOHANG
|
__WALL
,
NULL
)))
break
;
if
(
!
(
pid
=
wait4
_wrapper
(
-
1
,
&
status
,
WUNTRACED
|
WNOHANG
,
NULL
)))
break
;
if
(
pid
!=
-
1
)
handle_child_status
(
get_thread_from_pid
(
pid
),
pid
,
status
,
-
1
);
else
break
;
}
...
...
@@ -128,7 +141,7 @@ static void wait4_thread( struct thread *thread, int signal )
do
{
if
((
res
=
wait4
(
get_ptrace_pid
(
thread
),
&
status
,
WUNTRACED
|
__WALL
,
NULL
))
==
-
1
)
if
((
res
=
wait4
_wrapper
(
get_ptrace_pid
(
thread
),
&
status
,
WUNTRACED
,
NULL
))
==
-
1
)
{
if
(
errno
==
ECHILD
)
/* must have died */
{
...
...
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