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
6acace46
Commit
6acace46
authored
4 months ago
by
Peter Limkilde Svendsen
Browse files
Options
Downloads
Patches
Plain Diff
Document safety requirements
parent
cc08c0b2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#16734
passed
4 months ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/header/sys_timeb/mod.rs
+8
-0
8 additions, 0 deletions
src/header/sys_timeb/mod.rs
with
8 additions
and
0 deletions
src/header/sys_timeb/mod.rs
+
8
−
0
View file @
6acace46
...
...
@@ -28,12 +28,20 @@ pub struct timeb {
}
/// See <https://pubs.opengroup.org/onlinepubs/009695399/functions/ftime.html>.
///
/// # Safety
/// The caller must ensure that `tp` is convertible to a `&mut
/// MaybeUninit<timeb>`.
#[no_mangle]
pub
unsafe
extern
"C"
fn
ftime
(
tp
:
*
mut
timeb
)
->
c_int
{
// SAFETY: the caller is required to ensure that the pointer is valid.
let
tp_maybe_uninit
=
unsafe
{
NonNull
::
new_unchecked
(
tp
)
.as_uninit_mut
()
};
let
mut
tv
=
timeval
::
default
();
let
mut
tz
=
timezone
::
default
();
// SAFETY: tv and tz are created above, and thus will coerce to valid
// pointers.
if
unsafe
{
gettimeofday
(
&
mut
tv
,
&
mut
tz
)
}
<
0
{
return
-
1
;
}
...
...
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