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
redox-os
relibc
Commits
3fa22023
Commit
3fa22023
authored
6 years ago
by
stratact
Browse files
Options
Downloads
Patches
Plain Diff
Add `sys_wait` functions (Fixes
#81
)
parent
1f9f7ce6
No related branches found
No related tags found
1 merge request
!131
Add `sys_wait` functions (Fixes #81)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sys_wait/src/lib.rs
+53
-0
53 additions, 0 deletions
src/sys_wait/src/lib.rs
with
53 additions
and
0 deletions
src/sys_wait/src/lib.rs
+
53
−
0
View file @
3fa22023
...
@@ -9,6 +9,59 @@ extern crate sys_resource;
...
@@ -9,6 +9,59 @@ extern crate sys_resource;
use
platform
::
types
::
*
;
use
platform
::
types
::
*
;
use
sys_resource
::
rusage
;
use
sys_resource
::
rusage
;
pub
const
WNOHANG
:
c_int
=
1
;
pub
const
WUNTRACED
:
c_int
=
2
;
pub
const
WSTOPPED
:
c_int
=
2
;
pub
const
WEXITED
:
c_int
=
4
pub
const
WCONTINUED
:
c_int
=
8
pub
const
WNOWAIT
:
c_int
=
0x1000000
pub
const
__WNOTHREAD
:
c_int
=
0x20000000
pub
const
__WALL
:
c_int
=
0x40000000
pub
const
__WCLONE
:
c_int
=
0x80000000
#[inline]
pub
fn
WEXITSTATUS
(
status
:
c_int
)
->
c_int
{
(
status
&
0xff00
)
>>
8
}
#[inline]
pub
fn
WTERMSIG
(
status
:
c_int
)
->
c_int
{
status
&
0x7f
}
#[inline]
pub
fn
WSTOPSIG
(
status
:
c_int
)
->
c_int
{
WEXITSTATUS
(
status
)
}
#[inline]
pub
fn
WCOREDUMP
(
status
:
c_int
)
->
c_int
{
status
&
0x80
}
#[inline]
pub
fn
WIFEXITED
(
status
:
c_int
)
->
c_int
{
// This is simulate the Not operator when used for regular integers in C
(
WTERMSIG
(
status
)
==
0
)
as
c_int
}
#[inline]
pub
fn
WIFSTOPPED
(
status
:
c_int
)
->
c_int
{
(((((
status
&
0xffff
)
*
0x10001
)
>>
8
)
as
c_short
)
>
0x7f00
)
as
c_int
}
#[inline]
pub
fn
WIFSIGNALED
(
status
:
c_int
)
->
c_int
{
((
status
&
0xffff
)
-
(
1
as
c_uint
)
<
0xffu
)
as
c_int
}
#[inline]
pub
fn
WIFSIGNALED
(
status
:
c_int
)
->
c_int
{
(
status
==
0xffff
)
as
c_int
}
#[no_mangle]
#[no_mangle]
pub
unsafe
extern
"C"
fn
wait
(
stat_loc
:
*
mut
c_int
)
->
pid_t
{
pub
unsafe
extern
"C"
fn
wait
(
stat_loc
:
*
mut
c_int
)
->
pid_t
{
waitpid
(
!
0
,
stat_loc
,
0
)
waitpid
(
!
0
,
stat_loc
,
0
)
...
...
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