Skip to content

Commit 64c83b4

Browse files
committed
freebsd add uuidgen fn.
1 parent 1ac780a commit 64c83b4

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,7 @@ fn test_freebsd(target: &str) {
18181818
"sys/un.h",
18191819
"sys/user.h",
18201820
"sys/utsname.h",
1821+
"sys/uuid.h",
18211822
"sys/wait.h",
18221823
"libprocstat.h",
18231824
"syslog.h",

libc-test/semver/freebsd.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,7 @@ _SC_XOPEN_STREAMS
13651365
_SC_XOPEN_UNIX
13661366
_SC_XOPEN_VERSION
13671367
_SC_XOPEN_XCU_VERSION
1368+
_UUID_NODE_LEN
13681369
__c_anonymous_cr_pid
13691370
__error
13701371
__xuname
@@ -1751,6 +1752,7 @@ telldir
17511752
timex
17521753
truncate
17531754
ttyname_r
1755+
uuidgen
17541756
unmount
17551757
useconds_t
17561758
uselocale

src/unix/bsd/freebsdlike/freebsd/mod.rs

+15
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub type pthread_spinlock_t = *mut __c_anonymous_pthread_spinlock;
2424
pub type pthread_barrierattr_t = *mut __c_anonymous_pthread_barrierattr;
2525
pub type pthread_barrier_t = *mut __c_anonymous_pthread_barrier;
2626

27+
pub type uuid_t = ::uuid;
28+
2729
s! {
2830
pub struct aiocb {
2931
pub aio_fildes: ::c_int,
@@ -152,6 +154,15 @@ s! {
152154
c_spare: [u32; 1],
153155
}
154156

157+
pub struct uuid {
158+
pub time_low: u32,
159+
pub time_mid: u16,
160+
pub time_hi_and_version: u16,
161+
pub clock_seq_hi_and_reserved: u8,
162+
pub clock_seq_low: u8,
163+
pub node: [u8; _UUID_NODE_LEN],
164+
}
165+
155166
pub struct __c_anonymous_pthread_spinlock {
156167
s_clock: umutex,
157168
}
@@ -1383,6 +1394,8 @@ pub const _PC_ACL_NFS4: ::c_int = 64;
13831394

13841395
pub const _SC_CPUSET_SIZE: ::c_int = 122;
13851396

1397+
pub const _UUID_NODE_LEN: usize = 6;
1398+
13861399
// Flags which can be passed to pdfork(2)
13871400
pub const PD_DAEMON: ::c_int = 0x00000001;
13881401
pub const PD_CLOEXEC: ::c_int = 0x00000002;
@@ -1766,6 +1779,8 @@ extern "C" {
17661779
newfd: ::c_int,
17671780
) -> ::c_int;
17681781

1782+
pub fn uuidgen(store: *mut uuid, count: ::c_int) -> ::c_int;
1783+
17691784
pub fn pthread_getthreadid_np() -> ::c_int;
17701785
pub fn pthread_getaffinity_np(
17711786
td: ::pthread_t,

0 commit comments

Comments
 (0)