Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hermit-rs
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACS
Public
HermitOS
hermit-rs
Commits
89a075d3
Unverified
Commit
89a075d3
authored
2 years ago
by
bors[bot]
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Plain Diff
Try #395:
parents
78682314
85fba621
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#902977
passed
2 years ago
Stage: prepare
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hermit-abi/src/lib.rs
+8
-32
8 additions, 32 deletions
hermit-abi/src/lib.rs
with
8 additions
and
32 deletions
hermit-abi/src/lib.rs
+
8
−
32
View file @
89a075d3
...
...
@@ -453,16 +453,6 @@ extern "C" {
#[link_name
=
"sys_network_init"
]
pub
fn
network_init
()
->
i32
;
/// The function computes a sequence of pseudo-random integers
/// in the range of 0 to RAND_MAX
#[link_name
=
"sys_rand"
]
pub
fn
rand
()
->
u32
;
/// The function sets its argument as the seed for a new sequence
/// of pseudo-random numbers to be returned by `rand`
#[link_name
=
"sys_srand"
]
pub
fn
srand
(
seed
:
u32
);
/// Add current task to the queue of blocked tasks. After calling `block_current_task`,
/// call `yield_now` to switch to another task.
#[link_name
=
"sys_block_current_task"
]
...
...
@@ -497,6 +487,14 @@ extern "C" {
#[link_name
=
"sys_read"
]
pub
fn
read
(
fd
:
i32
,
buf
:
*
mut
u8
,
len
:
usize
)
->
isize
;
/// Fill `len` bytes in `buf` with cryptographically secure random data.
///
/// Returns either the number of bytes written to buf (a positive value) or
/// * `-EINVAL` if `flags` contains unknown flags.
/// * `-ENOSYS` if the system does not support random data generation.
#[link_name
=
"sys_read_entropy"
]
pub
fn
read_entropy
(
buf
:
*
mut
u8
,
len
:
usize
,
flags
:
u32
)
->
isize
;
/// receive() a message from a socket
#[link_name
=
"sys_recv"
]
pub
fn
recv
(
socket
:
i32
,
buf
:
*
mut
u8
,
len
:
usize
,
flags
:
i32
)
->
isize
;
...
...
@@ -599,32 +597,10 @@ extern "C" {
res
:
*
mut
*
mut
addrinfo
,
)
->
i32
;
fn
sys_secure_rand32
(
value
:
*
mut
u32
)
->
i32
;
fn
sys_secure_rand64
(
value
:
*
mut
u64
)
->
i32
;
fn
sys_get_priority
()
->
u8
;
fn
sys_set_priority
(
tid
:
Tid
,
prio
:
u8
);
}
/// Create a cryptographicly secure 32bit random number with the support of
/// the underlying hardware. If the required hardware isn't available,
/// the function returns `None`.
#[inline(always)]
pub
unsafe
fn
secure_rand32
()
->
Option
<
u32
>
{
let
mut
rand
=
MaybeUninit
::
uninit
();
let
res
=
sys_secure_rand32
(
rand
.as_mut_ptr
());
(
res
==
0
)
.then
(||
rand
.assume_init
())
}
/// Create a cryptographicly secure 64bit random number with the support of
/// the underlying hardware. If the required hardware isn't available,
/// the function returns `None`.
#[inline(always)]
pub
unsafe
fn
secure_rand64
()
->
Option
<
u64
>
{
let
mut
rand
=
MaybeUninit
::
uninit
();
let
res
=
sys_secure_rand64
(
rand
.as_mut_ptr
());
(
res
==
0
)
.then
(||
rand
.assume_init
())
}
/// Determine the priority of the current thread
#[inline(always)]
pub
unsafe
fn
get_priority
()
->
Priority
{
...
...
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