Skip to content

Commit

Permalink
Add missing definitions on NetBSD (rust-lang#3927)
Browse files Browse the repository at this point in the history
This PR adds support for:
  CLOCK_PROCESS_CPUTIME_ID
  CLOCK_THREAD_CPUTIME_ID
  sysctlnametomib

It replaces the following closed PRs:
rust-lang#3926
rust-lang#3923

Sorry for the back and forward actions.

(backport <rust-lang#3927>)
(cherry picked from commit 8ff67c1)
  • Loading branch information
0323pin authored and tgross35 committed Oct 16, 2024
1 parent c49fe92 commit 9285f0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libc-test/semver/netbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ CLD_EXITED
CLD_KILLED
CLD_STOPPED
CLD_TRAPPED
CLOCK_PROCESS_CPUTIME_ID
CLOCK_THREAD_CPUTIME_ID
CMSG_DATA
CMSG_FIRSTHDR
CMSG_LEN
Expand Down Expand Up @@ -1567,6 +1569,7 @@ sync
syscall
sysctl
sysctlbyname
sysctlnametomib
sysctldesc
tcp_info
telldir
Expand Down
7 changes: 7 additions & 0 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,8 @@ pub const MNT_NOWAIT: ::c_int = 2;
pub const MNT_LAZY: ::c_int = 3;

//<sys/timex.h>
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 4;
pub const NTP_API: ::c_int = 4;
pub const MAXPHASE: ::c_long = 500000000;
pub const MAXFREQ: ::c_long = 500000;
Expand Down Expand Up @@ -2668,6 +2670,11 @@ extern "C" {
newp: *const ::c_void,
newlen: ::size_t,
) -> ::c_int;
pub fn sysctlnametomib(
sname: *const ::c_char,
name: *mut ::c_int,
namelenp: *mut ::size_t,
) -> ::c_int;
#[link_name = "__kevent50"]
pub fn kevent(
kq: ::c_int,
Expand Down

0 comments on commit 9285f0e

Please sign in to comment.