Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
77fde137
Commit
77fde137
authored
21 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
Properly handle the wait4 syscall failure on kernels that don't
support the __WALL flag.
parent
056e4197
No related branches found
Branches containing commit
Tags
wine-980118
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/ptrace.c
+19
-6
19 additions, 6 deletions
server/ptrace.c
with
19 additions
and
6 deletions
server/ptrace.c
+
19
−
6
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 */
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment