Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Peter Limkilde Svendsen
relibc
Commits
b64b0ebe
Verified
Commit
b64b0ebe
authored
8 months ago
by
Jacob Lorentzon
Browse files
Options
Downloads
Patches
Plain Diff
Handle kill and killpg EINTR.
parent
78247c85
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
redox-rt/src/sys.rs
+22
-14
22 additions, 14 deletions
redox-rt/src/sys.rs
src/platform/redox/signal.rs
+2
-2
2 additions, 2 deletions
src/platform/redox/signal.rs
with
24 additions
and
16 deletions
redox-rt/src/sys.rs
+
22
−
14
View file @
b64b0ebe
...
@@ -3,11 +3,10 @@ use syscall::error::{Result, Error, EINTR};
...
@@ -3,11 +3,10 @@ use syscall::error::{Result, Error, EINTR};
use
crate
::
arch
::
manually_enter_trampoline
;
use
crate
::
arch
::
manually_enter_trampoline
;
use
crate
::
signal
::
tmp_disable_signals
;
use
crate
::
signal
::
tmp_disable_signals
;
// TODO: uninitialized memory?
#[inline]
#[inline]
pub
fn
posix_read
(
fd
:
usize
,
buf
:
&
mut
[
u8
]
)
->
Result
<
usize
>
{
fn
wrapper
(
mut
f
:
impl
FnMut
()
->
Result
<
usize
>
)
->
Result
<
usize
>
{
loop
{
loop
{
let
res
=
syscall
::
read
(
fd
,
bu
f
);
let
res
=
f
(
);
if
res
==
Err
(
Error
::
new
(
EINTR
))
{
if
res
==
Err
(
Error
::
new
(
EINTR
))
{
unsafe
{
unsafe
{
...
@@ -18,18 +17,27 @@ pub fn posix_read(fd: usize, buf: &mut [u8]) -> Result<usize> {
...
@@ -18,18 +17,27 @@ pub fn posix_read(fd: usize, buf: &mut [u8]) -> Result<usize> {
return
res
;
return
res
;
}
}
}
}
// TODO: uninitialized memory?
#[inline]
pub
fn
posix_read
(
fd
:
usize
,
buf
:
&
mut
[
u8
])
->
Result
<
usize
>
{
wrapper
(||
syscall
::
read
(
fd
,
buf
))
}
#[inline]
#[inline]
pub
fn
posix_write
(
fd
:
usize
,
buf
:
&
[
u8
])
->
Result
<
usize
>
{
pub
fn
posix_write
(
fd
:
usize
,
buf
:
&
[
u8
])
->
Result
<
usize
>
{
loop
{
wrapper
(||
syscall
::
write
(
fd
,
buf
))
let
res
=
syscall
::
write
(
fd
,
buf
);
}
#[inline]
if
res
==
Err
(
Error
::
new
(
EINTR
))
{
pub
fn
posix_kill
(
pid
:
usize
,
sig
:
usize
)
->
Result
<
()
>
{
unsafe
{
match
wrapper
(||
syscall
::
kill
(
pid
,
sig
))
{
manually_enter_trampoline
();
Ok
(
_
)
|
Err
(
Error
{
errno
:
EINTR
})
=>
Ok
(()),
}
Err
(
error
)
=>
Err
(
error
),
}
}
}
return
res
;
#[inline]
pub
fn
posix_killpg
(
pgrp
:
usize
,
sig
:
usize
)
->
Result
<
()
>
{
match
wrapper
(||
syscall
::
kill
(
usize
::
wrapping_neg
(
pgrp
),
sig
))
{
Ok
(
_
)
|
Err
(
Error
{
errno
:
EINTR
})
=>
Ok
(()),
Err
(
error
)
=>
Err
(
error
),
}
}
}
}
This diff is collapsed.
Click to expand it.
src/platform/redox/signal.rs
+
2
−
2
View file @
b64b0ebe
...
@@ -53,11 +53,11 @@ impl PalSignal for Sys {
...
@@ -53,11 +53,11 @@ impl PalSignal for Sys {
}
}
fn
kill
(
pid
:
pid_t
,
sig
:
c_int
)
->
c_int
{
fn
kill
(
pid
:
pid_t
,
sig
:
c_int
)
->
c_int
{
e
(
syscall
::
kill
(
pid
as
usize
,
sig
as
usize
))
as
c_int
e
(
redox_rt
::
sys
::
posix_
kill
(
pid
as
usize
,
sig
as
usize
)
.map
(|()|
0
)
)
as
c_int
}
}
fn
killpg
(
pgrp
:
pid_t
,
sig
:
c_int
)
->
c_int
{
fn
killpg
(
pgrp
:
pid_t
,
sig
:
c_int
)
->
c_int
{
e
(
syscall
::
kill
(
-
(
pgrp
as
isize
)
as
usize
,
sig
as
usize
))
as
c_int
e
(
redox_rt
::
sys
::
posix_
kill
pg
(
pgrp
as
usize
,
sig
as
usize
)
.map
(|()|
0
)
)
as
c_int
}
}
fn
raise
(
sig
:
c_int
)
->
c_int
{
fn
raise
(
sig
:
c_int
)
->
c_int
{
...
...
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