mqueues: Let the world know we support them.
authorStathis Kamperis <beket@dragonflybsd.org>
Fri, 6 Nov 2009 20:42:26 +0000 (22:42 +0200)
committerStathis Kamperis <beket@dragonflybsd.org>
Fri, 6 Nov 2009 20:47:52 +0000 (22:47 +0200)
There are two ways to determine whether we support the message
passing interface, as described in POSIX 1003.1B standard.

The standard way is to use sysconf(3) and the DragonFly-specific
way is to check the value of p1003_1b.message_passing sysctl.

We make sure that both return consistent results with respect to
each other.

lib/libc/gen/sysconf.c
sys/kern/kern_p1003_1b.c
sys/sys/unistd.h

index b2313c7..fad0717 100644 (file)
@@ -203,13 +203,7 @@ do_NAME_MAX:
        case _SC_MEMORY_PROTECTION:
                return (_POSIX_MEMORY_PROTECTION);
        case _SC_MESSAGE_PASSING:
-#if _POSIX_MESSAGE_PASSING == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_MESSAGE_PASSING;
-               goto yesno;
-#else
                return (_POSIX_MESSAGE_PASSING);
-#endif
        case _SC_PRIORITIZED_IO:
 #if _POSIX_PRIORITIZED_IO == 0
                mib[0] = CTL_P1003_1B;
index 2906e1d..d8b3a86 100644 (file)
@@ -46,6 +46,7 @@
 #include <sys/module.h>
 #include <sys/sysproto.h>
 #include <sys/sysctl.h>
+#include <sys/unistd.h>
 
 MALLOC_DEFINE(M_P31B, "p1003.1b", "Posix 1003.1B");
 
@@ -289,6 +290,7 @@ static void p31binit(void *notused)
 {
        (void) sched_attach();
        p31b_setcfg(CTL_P1003_1B_PAGESIZE, PAGE_SIZE);
+       p31b_setcfg(CTL_P1003_1B_MESSAGE_PASSING, _POSIX_MESSAGE_PASSING);
 }
 
 SYSINIT(p31b, SI_SUB_P1003_1B, SI_ORDER_FIRST, p31binit, NULL);
index 3619359..a2dd688 100644 (file)
@@ -64,7 +64,7 @@
 #define        _POSIX_MEMLOCK                  -1
 #define        _POSIX_MEMLOCK_RANGE            200112L
 #define        _POSIX_MEMORY_PROTECTION        200112L
-#define        _POSIX_MESSAGE_PASSING          -1
+#define        _POSIX_MESSAGE_PASSING          200112L
 #define        _POSIX_MONOTONIC_CLOCK          200112L
 #define        _POSIX_NO_TRUNC                 1
 #define        _POSIX_PRIORITIZED_IO           -1