Author: kib
Date: Sun Oct  2 17:02:59 2016
New Revision: 306588
URL: https://svnweb.freebsd.org/changeset/base/306588

Log:
  Export the mq_getfd_np() symbol from librt.so, which allows to get
  file descriptor for the given posix mqueue.  Export the
  timer_oshandle_np() symbol to get ktimer id for the given posix timer.
  
  Requested by: Lewis Donzis <l...@perftech.com>
  Reviewed by:  jilles
  Discussed with:       kan
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/include/mqueue.h
  head/include/time.h
  head/lib/librt/Symbol.map
  head/lib/librt/mq.c
  head/lib/librt/timer.c
  head/tests/sys/mqueue/Makefile
  head/tests/sys/mqueue/mqtest3.c
  head/tests/sys/mqueue/mqtest4.c

Modified: head/include/mqueue.h
==============================================================================
--- head/include/mqueue.h       Sun Oct  2 16:14:03 2016        (r306587)
+++ head/include/mqueue.h       Sun Oct  2 17:02:59 2016        (r306588)
@@ -50,7 +50,9 @@ ssize_t       mq_timedreceive(mqd_t, char *__r
 int    mq_timedsend(mqd_t, const char *, size_t, unsigned,
                const struct timespec *);
 int    mq_unlink(const char *);
-int    __mq_oshandle(mqd_t mqd);
+#if __BSD_VISIBLE
+int    mq_getfd_np(mqd_t mqd);
+#endif /* __BSD_VISIBLE */
 
 __END_DECLS
 #endif

Modified: head/include/time.h
==============================================================================
--- head/include/time.h Sun Oct  2 16:14:03 2016        (r306587)
+++ head/include/time.h Sun Oct  2 17:02:59 2016        (r306588)
@@ -194,6 +194,7 @@ char *timezone(int, int);   /* XXX XSI con
 void tzsetwall(void);
 time_t timelocal(struct tm * const);
 time_t timegm(struct tm * const);
+int timer_oshandle_np(timer_t timerid);
 #endif /* __BSD_VISIBLE */
 
 #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)

Modified: head/lib/librt/Symbol.map
==============================================================================
--- head/lib/librt/Symbol.map   Sun Oct  2 16:14:03 2016        (r306587)
+++ head/lib/librt/Symbol.map   Sun Oct  2 17:02:59 2016        (r306588)
@@ -25,6 +25,11 @@ FBSD_1.0 {
        timer_getoverrun;
 };
 
+FBSD_1.5 {
+       mq_getfd_np;
+       timer_oshandle_np;
+};
+
 FBSDprivate_1.0 {
        _aio_read;
        _aio_write;

Modified: head/lib/librt/mq.c
==============================================================================
--- head/lib/librt/mq.c Sun Oct  2 16:14:03 2016        (r306587)
+++ head/lib/librt/mq.c Sun Oct  2 17:02:59 2016        (r306588)
@@ -272,8 +272,9 @@ __mq_unlink(const char *path)
        return __sys_kmq_unlink(path);
 }
 
+#pragma weak mq_getfd_np
 int
-__mq_oshandle(mqd_t mqd)
+mq_getfd_np(mqd_t mqd)
 {
 
        return (mqd->oshandle);

Modified: head/lib/librt/timer.c
==============================================================================
--- head/lib/librt/timer.c      Sun Oct  2 16:14:03 2016        (r306587)
+++ head/lib/librt/timer.c      Sun Oct  2 17:02:59 2016        (r306588)
@@ -175,8 +175,9 @@ __timer_settime(timer_t timerid, int fla
                flags, value, ovalue);
 }
 
+#pragma weak timer_oshandle_np
 int
-__timer_oshandle(timer_t timerid)
+timer_oshandle_np(timer_t timerid)
 {
 
        return (timerid->oshandle);

Modified: head/tests/sys/mqueue/Makefile
==============================================================================
--- head/tests/sys/mqueue/Makefile      Sun Oct  2 16:14:03 2016        
(r306587)
+++ head/tests/sys/mqueue/Makefile      Sun Oct  2 17:02:59 2016        
(r306588)
@@ -10,8 +10,8 @@ CFLAGS+=      -I${SRCTOP}/tests
 
 PROGS+=                mqtest1
 PROGS+=                mqtest2
-#PROGS+=               mqtest3
-#PROGS+=               mqtest4
+PROGS+=                mqtest3
+PROGS+=                mqtest4
 PROGS+=                mqtest5
 
 LIBADD+=       rt

Modified: head/tests/sys/mqueue/mqtest3.c
==============================================================================
--- head/tests/sys/mqueue/mqtest3.c     Sun Oct  2 16:14:03 2016        
(r306587)
+++ head/tests/sys/mqueue/mqtest3.c     Sun Oct  2 17:02:59 2016        
(r306588)
@@ -62,9 +62,10 @@ main(void)
                buf = malloc(attr.mq_msgsize);
                for (j = 0; j < LOOPS; ++j) {
                        FD_ZERO(&set);
-                       FD_SET(__mq_oshandle(mq), &set);
+                       FD_SET(mq_getfd_np(mq), &set);
                        alarm(3);
-                       status = select(__mq_oshandle(mq)+1, &set, NULL, NULL, 
NULL);
+                       status = select(mq_getfd_np(mq) + 1, &set, NULL,
+                           NULL, NULL);
                        if (status != 1)
                                err(1, "child process: select()");
                        status = mq_receive(mq, buf, attr.mq_msgsize, &prio);
@@ -94,8 +95,9 @@ main(void)
                        }
                        alarm(3);
                        FD_ZERO(&set);
-                       FD_SET(__mq_oshandle(mq), &set);
-                       status = select(__mq_oshandle(mq)+1, NULL, &set, NULL, 
NULL);
+                       FD_SET(mq_getfd_np(mq), &set);
+                       status = select(mq_getfd_np(mq) + 1, NULL, &set,
+                           NULL, NULL);
                        if (status != 1)
                                err(1, "select()");
                        status = mq_send(mq, buf, attr.mq_msgsize, PRIO);

Modified: head/tests/sys/mqueue/mqtest4.c
==============================================================================
--- head/tests/sys/mqueue/mqtest4.c     Sun Oct  2 16:14:03 2016        
(r306587)
+++ head/tests/sys/mqueue/mqtest4.c     Sun Oct  2 17:02:59 2016        
(r306588)
@@ -57,7 +57,7 @@ main(void)
                mq = mq_open(MQNAME, O_RDWR);
                if (mq == (mqd_t)-1)
                        err(1, "child: mq_open");
-               EV_SET(&kev, __mq_oshandle(mq), EVFILT_READ, EV_ADD, 0, 0, 0);
+               EV_SET(&kev, mq_getfd_np(mq), EVFILT_READ, EV_ADD, 0, 0, 0);
                status = kevent(kq, &kev, 1, NULL, 0, NULL);
                if (status == -1)
                        err(1, "child: kevent");
@@ -89,7 +89,7 @@ main(void)
 
                signal(SIGALRM, sighandler);
                kq = kqueue();
-               EV_SET(&kev, __mq_oshandle(mq), EVFILT_WRITE, EV_ADD, 0, 0, 0);
+               EV_SET(&kev, mq_getfd_np(mq), EVFILT_WRITE, EV_ADD, 0, 0, 0);
                status = kevent(kq, &kev, 1, NULL, 0, NULL);
                if (status == -1)
                        err(1, "kevent");
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to