diff options
author | ngie <ngie@FreeBSD.org> | 2015-12-04 09:32:03 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-12-04 09:32:03 +0000 |
commit | fc230dcf447eb45f054aa940c35313f825b926df (patch) | |
tree | 2f0756687aab81532c99e28b7e08dabc32b8ced5 /contrib | |
parent | 634df7f08c142512043084b495106ce19badc5a8 (diff) | |
download | FreeBSD-src-fc230dcf447eb45f054aa940c35313f825b926df.zip FreeBSD-src-fc230dcf447eb45f054aa940c35313f825b926df.tar.gz |
MFC r290913,r291181:
r290913:
Port contrib/netbsd-tests/kernel/t_mqueue.c to FreeBSD
- Add missing headers
- Ensure mqueuefs is loaded
- Make sure the mqueuefs path is absolute and relative to /
- Cast the result of mq_open returning -1 to (mqd_t) to mute a compiler
warning
Sponsored by: EMC / Isilon Storage Division
r291181:
Integrate contrib/netbsd-tests/kernel/t_mqueue into the FreeBSD test
suite as tests/sys/kern/mqueue_test
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/netbsd-tests/kernel/t_mqueue.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/kernel/t_mqueue.c b/contrib/netbsd-tests/kernel/t_mqueue.c index 2a03101..aa98d91 100644 --- a/contrib/netbsd-tests/kernel/t_mqueue.c +++ b/contrib/netbsd-tests/kernel/t_mqueue.c @@ -6,6 +6,13 @@ * This file is in the Public Domain. */ +#ifdef __FreeBSD__ +#include <sys/stat.h> +#include <fcntl.h> + +#include "freebsd_test_suite/macros.h" +#endif + #include <atf-c.h> #include <stdio.h> @@ -111,16 +118,28 @@ ATF_TC_BODY(mqueue, tc) char template[32]; char mq_name[64]; +#ifdef __FreeBSD__ + ATF_REQUIRE_KERNEL_MODULE("mqueuefs"); +#endif + strlcpy(template, "./t_mqueue.XXXXXX", sizeof(template)); tmpdir = mkdtemp(template); ATF_REQUIRE_MSG(tmpdir != NULL, "mkdtemp failed: %d", errno); +#ifdef __FreeBSD__ + snprintf(mq_name, sizeof(mq_name), "/t_mqueue"); +#else snprintf(mq_name, sizeof(mq_name), "%s/mq", tmpdir); +#endif mqd_t mqfd; mqfd = mq_open(mq_name, O_RDWR | O_CREAT, S_IRUSR | S_IRWXG | S_IROTH, NULL); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(mqfd != (mqd_t)-1, "mq_open failed: %d", errno); +#else ATF_REQUIRE_MSG(mqfd != -1, "mq_open failed: %d", errno); +#endif send_msgs(mqfd); receive_msgs(mqfd); |