Tuesday, December 06, 2022

alpn/sem_init: OpenBSD does not support pshared

Hi Stuart, greetings all.

As per https://man.openbsd.org/sem_init.3

sem_init(sem_t *sem, int pshared, unsigned int value)
A non-zero value for pshared specifies a shared semaphore that can be used by multiple processes, which this implementation is not capable of.

Please consider having this patch in file-attach (patch-ualpn_c) applied so the alpn daemon can at least be used with a single worker (default is to use 2 workers) on openbsd. Tested on 7.2 .

This fixes the EPERM error message on startup:
frontend# /tmp/ualpn -v -d -u nobody:nogroup -b 127.0.0.1@10443<mailto:127.0.0.1@10443> -c 127.0.0.1@8443<mailto:127.0.0.1@8443> -S 666
Dec 06 18:29:39 ualpn/53393: [NOTICE] version 1.7.1 starting
Dec 06 18:29:39 ualpn/53393: [NOTICE] control interface listening to unix:///var/run/ualpn.sock
Dec 06 18:29:39 ualpn/53393: [ERR] sem_init failed: Operation not permitted
Dec 06 18:29:39 ualpn/88515: [ERR] daemon failed to start

Once applied:
frontend# /tmp/ualpn -v -d -u nobody:nogroup -b 127.0.0.1@10443<mailto:127.0.0.1@10443> -c 127.0.0.1@8443<mailto:127.0.0.1@8443> -S 666 -n 1
Dec 06 18:29:42 ualpn/41102: [NOTICE] version 1.7.1 starting
Dec 06 18:29:42 ualpn/41102: [NOTICE] control interface listening to unix:///var/run/ualpn.sock
Dec 06 18:29:42 ualpn/41102: [NOTICE] frontend listening to 127.0.0.1:10443
Dec 06 18:29:42 ualpn/41102: [NOTICE] changing group (nogroup)
Dec 06 18:29:42 ualpn/41102: [NOTICE] changing user (nobody)
Dec 06 18:29:42 ualpn/33466: [NOTICE] daemon started (pid 41102)

Thank you

No comments:

Post a Comment