Skip to content

Commit

Permalink
Auto merge of #2526 - devnexen:sem_fbsd, r=Amanieu
Browse files Browse the repository at this point in the history
freebsd sem api addition
  • Loading branch information
bors committed Nov 11, 2021
2 parents d4ac6fd + 96fa9a6 commit 67bf22c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libc-test/build.rs
Expand Up @@ -1845,6 +1845,7 @@ fn test_freebsd(target: &str) {
"sys/random.h",
"sys/resource.h",
"sys/rtprio.h",
"sys/sem.h",
"sys/shm.h",
"sys/socket.h",
"sys/stat.h",
Expand Down Expand Up @@ -2176,6 +2177,9 @@ fn test_freebsd(target: &str) {
// We ignore this field because we needed to use a hack in order to make rust 1.19
// happy...
("kinfo_proc", "ki_sparestrings") => true,

// `__sem_base` is a private struct field
("semid_ds", "__sem_base") => true,
_ => false,
}
});
Expand Down
5 changes: 5 additions & 0 deletions libc-test/semver/freebsd.txt
Expand Up @@ -1735,6 +1735,11 @@ sem_init
sem_open
sem_timedwait
sem_unlink
sembuf
semctl
semget
semid_ds
semop
sendfile
sendmmsg
sendmsg
Expand Down
20 changes: 20 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Expand Up @@ -87,6 +87,11 @@ s! {
pub struct _sem {
data: [u32; 4],
}
pub struct sembuf {
pub sem_num: ::c_ushort,
pub sem_op: ::c_short,
pub sem_flg: ::c_short,
}

pub struct msqid_ds {
pub msg_perm: ::ipc_perm,
Expand Down Expand Up @@ -445,6 +450,18 @@ s! {
pub n_type: ::c_uchar,
pub n_value: ::kvaddr_t,
}

pub struct __c_anonymous_sem {
_priv: ::uintptr_t,
}

pub struct semid_ds {
pub sem_perm: ::ipc_perm,
pub __sem_base: *mut __c_anonymous_sem,
pub sem_nsems: ::c_ushort,
pub sem_otime: ::time_t,
pub sem_ctime: ::time_t,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -2196,6 +2213,9 @@ extern "C" {
pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
pub fn semget(key: ::key_t, nsems: ::c_int, semflg: ::c_int) -> ::c_int;
pub fn semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int;
pub fn semop(semid: ::c_int, sops: *mut sembuf, nsops: ::size_t) -> ::c_int;
pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut ::msqid_ds) -> ::c_int;
pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
pub fn msgsnd(
Expand Down

0 comments on commit 67bf22c

Please sign in to comment.