Skip to content

Commit f682ca6

Browse files
committed
Auto merge of #1308 - tormol:master, r=gnzlbg
Add mq_getfd_np() on FreeBSD and fix mqd_t on DragonFlyBSD [`mq_getfd_np()` was added in FreeBSD 11](https://svnweb.freebsd.org/base/stable/11/include/mqueue.h?revision=306905&view=markup). I'm already using it in my [posixmq crate](https://github.com/tormol/posixmq) for mio/kqueue integration, and I've tested it both in virtualbox and on Cirrus-CI. [`mqd_t` in an `int` on DragonFlyBSD](https://github.com/DragonFlyBSD/DragonFlyBSD/blob/e7ab884bd49753f8884eb597d10d6569a08fa0df/sys/sys/types.h#L139) even though it's a pointer on FreeBSD, because [DragonflyBSD's implementation is based on NetBSD](DragonFlyBSD/DragonFlyBSD@f2df0f7). The definitions for `mq_attr` are already separate and correct. Does fixing this count as a breaking change? I think the current definition will work in most cases, because IIRC the calling convention means that `mqd_t` is always passed via registers, the upper 32 bits might just contain garbage. I've *not* tested this change on DragonFlyBSD. I want to add mq symbols for solarish, but is the CDDL license compatible with Apache-2.0 and MIT?
2 parents 1b346b8 + 652b832 commit f682ca6

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub type uuid_t = ::uuid;
1616
pub type fsblkcnt_t = u64;
1717
pub type fsfilcnt_t = u64;
1818

19+
pub type mqd_t = ::c_int;
1920
pub type sem_t = *mut sem;
2021

2122
#[cfg_attr(feature = "extra_traits", derive(Debug))]

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub type key_t = ::c_long;
1515
pub type msglen_t = ::c_ulong;
1616
pub type msgqnum_t = ::c_ulong;
1717

18+
pub type mqd_t = *mut ::c_void;
1819
pub type posix_spawnattr_t = *mut ::c_void;
1920
pub type posix_spawn_file_actions_t = *mut ::c_void;
2021

@@ -1332,6 +1333,7 @@ extern {
13321333

13331334
pub fn aio_waitcomplete(iocbp: *mut *mut aiocb,
13341335
timeout: *mut ::timespec) -> ::ssize_t;
1336+
pub fn mq_getfd_np(mqd: ::mqd_t) -> ::c_int;
13351337

13361338
pub fn freelocale(loc: ::locale_t) -> ::c_int;
13371339
pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t,

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ pub type dev_t = u32;
22
pub type mode_t = u16;
33
pub type pthread_attr_t = *mut ::c_void;
44
pub type rlim_t = i64;
5-
pub type mqd_t = *mut ::c_void;
65
pub type pthread_mutex_t = *mut ::c_void;
76
pub type pthread_mutexattr_t = *mut ::c_void;
87
pub type pthread_cond_t = *mut ::c_void;

0 commit comments

Comments
 (0)