Date: Mon, 16 Nov 2015 05:28:14 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290913 - head/contrib/netbsd-tests/kernel Message-ID: <201511160528.tAG5SEKq052505@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Mon Nov 16 05:28:14 2015 New Revision: 290913 URL: https://svnweb.freebsd.org/changeset/base/290913 Log: 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 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/kernel/t_mqueue.c Modified: head/contrib/netbsd-tests/kernel/t_mqueue.c ============================================================================== --- head/contrib/netbsd-tests/kernel/t_mqueue.c Mon Nov 16 04:56:14 2015 (r290912) +++ head/contrib/netbsd-tests/kernel/t_mqueue.c Mon Nov 16 05:28:14 2015 (r290913) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511160528.tAG5SEKq052505>