aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-08-24 18:45:52 -0700
committerGarrett D'Amore <garrett@damore.org>2025-08-24 19:00:22 -0700
commit78cf3f47739721573f466be645e19a664b167483 (patch)
tree26aec3e76cbac3f8a2da4e81524363c1780dcfa4
parentf22eb5f0be9439fd3c161fff7333039d3203f6e4 (diff)
downloadnng-78cf3f47739721573f466be645e19a664b167483.tar.gz
nng-78cf3f47739721573f466be645e19a664b167483.tar.bz2
nng-78cf3f47739721573f466be645e19a664b167483.zip
OmniOS fixes.
It is a bit of a mystery how we were passing CI/CD with all these problems. Probably we were falling back to select/poll instead of using ports.
-rw-r--r--src/platform/posix/posix_pollq_port.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/platform/posix/posix_pollq_port.c b/src/platform/posix/posix_pollq_port.c
index 2abb9491..a541665e 100644
--- a/src/platform/posix/posix_pollq_port.c
+++ b/src/platform/posix/posix_pollq_port.c
@@ -53,8 +53,7 @@ nni_posix_pfd_init(nni_posix_pfd *pfd, int fd, nni_posix_pfd_cb cb, void *arg)
pfd->fd = fd;
pfd->pq = pq;
pfd->cb = cb;
- pfd->arg = arg;
- pfd->data = NULL;
+ pfd->data = arg;
}
int
@@ -127,7 +126,7 @@ nni_posix_pfd_arm(nni_posix_pfd *pfd, unsigned events)
int rv;
int ev = (int) events;
- ev |= ni_atomic_or(&pfd->events, ev);
+ ev |= nni_atomic_or(&pfd->events, ev);
rv = port_associate(pq->port, PORT_SOURCE_FD, pfd->fd, ev, pfd);
if (rv != 0) {
nni_plat_errno(errno);
@@ -175,7 +174,7 @@ nni_port_thr(void *arg)
arg = pfd->data;
nni_atomic_and(&pfd->events, ~events);
- cb(pfd, (unsigned) events, arg);
+ cb(arg, (unsigned) events);
}
}
if (user_wake) {
@@ -196,7 +195,7 @@ nni_posix_pollq_destroy(nni_posix_pollq *pq)
{
if (pq->init) {
(void) close(pq->port);
- nni_cv_destroy(&pq->cv);
+ nni_cv_fini(&pq->cv);
nni_mtx_fini(&pq->mtx);
nni_thr_fini(&pq->thr);
}
@@ -208,7 +207,7 @@ nni_posix_pollq_create(nni_posix_pollq *pq)
int rv;
nni_mtx_init(&pq->mtx);
- nni_cv_init(&pq->cv, pq->mtx);
+ nni_cv_init(&pq->cv, &pq->mtx);
pq->init = true;
pq->port = -1;
@@ -226,6 +225,19 @@ nni_posix_pollq_create(nni_posix_pollq *pq)
return (0);
}
+void
+nni_posix_pollq_sysfini(void)
+{
+ if (nni_port_npq > 0) {
+ for (int i = 0; i < nni_port_npq; i++) {
+ nni_posix_pollq_destroy(&nni_port_pqs[i]);
+ }
+ NNI_FREE_STRUCTS(nni_port_pqs, nni_port_npq);
+ nni_port_pqs = NULL;
+ nni_port_npq = 0;
+ }
+}
+
int
nni_posix_pollq_sysinit(nng_init_params *params)
{
@@ -250,7 +262,7 @@ nni_posix_pollq_sysinit(nng_init_params *params)
nni_port_npq = num_thr;
for (int i = 0; i < num_thr; i++) {
int rv;
- if ((rv = nni_port_pq_create(&nni_port_pqs[i])) != 0) {
+ if ((rv = nni_posix_pollq_create(&nni_port_pqs[i])) != 0) {
nni_posix_pollq_sysfini();
return (rv);
}
@@ -258,17 +270,4 @@ nni_posix_pollq_sysinit(nng_init_params *params)
return (0);
}
-void
-nni_posix_pollq_sysfini(void)
-{
- if (nni_port_npq > 0) {
- for (int i = 0; i < nni_port_npq; i++) {
- nni_port_pq_destroy(&nni_port_pqs[i]);
- }
- NNI_FREE_STRUCTS(nni_port_pqs, nni_port_npq);
- nni_port_pqs = NULL;
- nni_port_npq = 0;
- }
-}
-
#endif // NNG_HAVE_PORT_CREATE