Post by Alexander KabaevNo objection, but possible suggestion: if the primary use of this
symbol is for tests and nothing else, maybe it does belong in
FBSDprivate_1.0 FBSDprivate_1.0 section instead?
Good question. The symbols are useful for real-world code, not only for
the tests. But I think that we should mark symbol as non-portable. Usual
approach of adding _np suffix seems to be the right thing to do there.
What about the following ?
diff --git a/include/mqueue.h b/include/mqueue.h
index 788d0a1..297e8d0 100644
--- a/include/mqueue.h
+++ b/include/mqueue.h
@@ -50,7 +50,9 @@ ssize_t mq_timedreceive(mqd_t, char *__restrict, size_t,
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_oshandle_np(mqd_t mqd);
+#endif /* __BSD_VISIBLE */
__END_DECLS
#endif
diff --git a/include/time.h b/include/time.h
index 14d6044..c172538 100644
--- a/include/time.h
+++ b/include/time.h
@@ -194,6 +194,7 @@ char *timezone(int, int); /* XXX XSI conflict */
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_)
diff --git a/lib/librt/Symbol.map b/lib/librt/Symbol.map
index 161bb76..8fbca9c 100644
--- a/lib/librt/Symbol.map
+++ b/lib/librt/Symbol.map
@@ -25,6 +25,11 @@ FBSD_1.0 {
timer_getoverrun;
};
+FBSD_1.5 {
+ mq_oshandle_np;
+ timer_oshandle_np;
+};
+
FBSDprivate_1.0 {
_aio_read;
_aio_write;
@@ -56,6 +61,7 @@ FBSDprivate_1.0 {
__mq_unlink;
__mq_send;
__mq_receive;
+ __mq_oshandle_np;
_timer_create;
_timer_delete;
_timer_gettime;
@@ -66,4 +72,5 @@ FBSDprivate_1.0 {
__timer_gettime;
__timer_settime;
__timer_getoverrun;
+ __timer_oshandle_np;
};
diff --git a/lib/librt/mq.c b/lib/librt/mq.c
index 750e969..60704a4 100644
--- a/lib/librt/mq.c
+++ b/lib/librt/mq.c
@@ -78,6 +78,7 @@ __weak_reference(__mq_send_cancel, mq_send);
__weak_reference(__mq_send, _mq_send);
__weak_reference(__mq_receive_cancel, mq_receive);
__weak_reference(__mq_receive, _mq_receive);
+__weak_reference(__mq_oshandle_np, mq_oshandle_np);
mqd_t
__mq_open(const char *name, int oflag, mode_t mode,
@@ -273,7 +274,7 @@ __mq_unlink(const char *path)
}
int
-__mq_oshandle(mqd_t mqd)
+__mq_oshandle_np(mqd_t mqd)
{
return (mqd->oshandle);
diff --git a/lib/librt/timer.c b/lib/librt/timer.c
index 90269c2..fc1379a 100644
--- a/lib/librt/timer.c
+++ b/lib/librt/timer.c
@@ -63,6 +63,7 @@ __weak_reference(__timer_settime, timer_settime);
__weak_reference(__timer_settime, _timer_settime);
__weak_reference(__timer_getoverrun, timer_getoverrun);
__weak_reference(__timer_getoverrun, _timer_getoverrun);
+__weak_reference(__timer_oshandle_np, timer_oshandle_np);
typedef void (*timer_func)(union sigval val, int overrun);
@@ -176,7 +177,7 @@ __timer_settime(timer_t timerid, int flags,
}
int
-__timer_oshandle(timer_t timerid)
+__timer_oshandle_np(timer_t timerid)
{
return (timerid->oshandle);
diff --git a/tests/sys/mqueue/Makefile b/tests/sys/mqueue/Makefile
index ce5033c..251c497 100644
--- a/tests/sys/mqueue/Makefile
+++ b/tests/sys/mqueue/Makefile
@@ -10,8 +10,8 @@ CFLAGS+= -I${SRCTOP}/tests
PROGS+= mqtest1
PROGS+= mqtest2
-#PROGS+= mqtest3
-#PROGS+= mqtest4
+PROGS+= mqtest3
+PROGS+= mqtest4
PROGS+= mqtest5
LIBADD+= rt
diff --git a/tests/sys/mqueue/mqtest3.c b/tests/sys/mqueue/mqtest3.c
index c4b849e..7325572 100644
--- a/tests/sys/mqueue/mqtest3.c
+++ b/tests/sys/mqueue/mqtest3.c
@@ -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_oshandle_np(mq), &set);
alarm(3);
- status = select(__mq_oshandle(mq)+1, &set, NULL, NULL, NULL);
+ status = select(mq_oshandle_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_oshandle_np(mq), &set);
+ status = select(mq_oshandle_np(mq) + 1, NULL, &set,
+ NULL, NULL);
if (status != 1)
err(1, "select()");
status = mq_send(mq, buf, attr.mq_msgsize, PRIO);
diff --git a/tests/sys/mqueue/mqtest4.c b/tests/sys/mqueue/mqtest4.c
index 474d212..fff04c0c 100644
--- a/tests/sys/mqueue/mqtest4.c
+++ b/tests/sys/mqueue/mqtest4.c
@@ -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_oshandle_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_oshandle_np(mq), EVFILT_WRITE, EV_ADD, 0, 0, 0);
status = kevent(kq, &kev, 1, NULL, 0, NULL);
if (status == -1)
err(1, "kevent");