On Wed, Nov 08, 2023 at 11:32:51AM +0000, Matthieu Herrb wrote: > Hi, > > now that seatd 0.8.0 has been released with some level of > NetBSD/FreeBSD support, it becomes easier to switch to the upstream > distribution and ship patches for OpenBSD. > > There is no actual functionnal change between the previous package and > the new one. > > comments, oks? (still not linked).
ping (needs rebase with UNLINKED) > > Index: Makefile > =================================================================== > RCS file: /local/cvs/ports/sysutils/seatd/Makefile,v > diff -u -p -u -r1.3 Makefile > --- Makefile 27 Sep 2023 17:16:33 -0000 1.3 > +++ Makefile 8 Nov 2023 11:20:02 -0000 > @@ -1,12 +1,12 @@ > COMMENT = minimal seat management daemon and universal library > > -V = 20230813 > -PKGNAME = seatd-$V > -DISTNAME = seatd-openbsd-$V > +V = 0.8.0 > +EPOCH = 0 > +DISTNAME = seatd-$V > CATEGORIES = sysutils > -REVISION = 0 > > -SITES = > https://gitlab.tetaneutral.net/mherrb/seatd/-/archive/openbsd-${V}/ > +SITES = https://git.sr.ht/~kennylevinsen/seatd/archive/ > +DISTFILES = seatd-{}${V}${EXTRACT_SUFX} > > SHARED_LIBS+= seat 0.0 # 0.0 > > Index: distinfo > =================================================================== > RCS file: /local/cvs/ports/sysutils/seatd/distinfo,v > diff -u -p -u -r1.2 distinfo > --- distinfo 23 Aug 2023 14:03:31 -0000 1.2 > +++ distinfo 8 Nov 2023 11:20:02 -0000 > @@ -1,2 +1,2 @@ > -SHA256 (seatd-openbsd-20230813.tar.gz) = > mw/4GTTgnfi7E5yMIDxH6KqWeYsX+K3VsFxvftDW+9U= > -SIZE (seatd-openbsd-20230813.tar.gz) = 39459 > +SHA256 (seatd-0.8.0.tar.gz) = pWKkTuM8yyCVShweyakOyy23oHrWsY0KyQQyjvvPZaA= > +SIZE (seatd-0.8.0.tar.gz) = 39349 > Index: patches/patch-common_drm_c > =================================================================== > RCS file: patches/patch-common_drm_c > diff -N patches/patch-common_drm_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-common_drm_c 8 Nov 2023 11:20:02 -0000 > @@ -0,0 +1,14 @@ > +OpenBSD support > + > +Index: common/drm.c > +--- common/drm.c.orig > ++++ common/drm.c > +@@ -21,7 +21,7 @@ int drm_drop_master(int fd) { > + return ioctl(fd, DRM_IOCTL_DROP_MASTER, 0); > + } > + > +-#if defined(__linux__) || defined(__NetBSD__) > ++#if defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) > + int path_is_drm(const char *path) { > + if (STR_HAS_PREFIX("/dev/dri/", path)) > + return 1; > Index: patches/patch-common_evdev_c > =================================================================== > RCS file: patches/patch-common_evdev_c > diff -N patches/patch-common_evdev_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-common_evdev_c 8 Nov 2023 11:20:02 -0000 > @@ -0,0 +1,14 @@ > +OpenBSD support > + > +Index: common/evdev.c > +--- common/evdev.c.orig > ++++ common/evdev.c > +@@ -25,7 +25,7 @@ int path_is_evdev(const char *path) { > + int evdev_revoke(int fd) { > + return ioctl(fd, EVIOCREVOKE, NULL); > + } > +-#elif defined(__NetBSD__) > ++#elif defined(__NetBSD__) || defined(__OpenBSD__) > + int path_is_evdev(const char *path) { > + (void)path; > + return 0; > Index: patches/patch-common_terminal_c > =================================================================== > RCS file: patches/patch-common_terminal_c > diff -N patches/patch-common_terminal_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-common_terminal_c 8 Nov 2023 11:20:02 -0000 > @@ -0,0 +1,38 @@ > +OpenBSD console support > + > +Index: common/terminal.c > +--- common/terminal.c.orig > ++++ common/terminal.c > +@@ -21,7 +21,7 @@ > + #define K_ENABLE K_XLATE > + #define K_DISABLE K_RAW > + #define FRSIG SIGIO > +-#elif defined(__NetBSD__) > ++#elif defined(__NetBSD__) || defined(__OpenBSD__) > + #include <dev/wscons/wsdisplay_usl_io.h> > + #define K_ENABLE K_XLATE > + #define K_DISABLE K_RAW > +@@ -147,6 +147,14 @@ static int get_tty_path(int tty, char path[static TTYP > + } > + return 0; > + } > ++#elif defined(__OpenBSD__) > ++static int get_tty_path(int tty, char path[static TTYPATHLEN]) { > ++ assert(tty >= 0); > ++ if (snprintf(path, TTYPATHLEN, "/dev/ttyC%d", tty) == -1) { > ++ return -1; > ++ } > ++ return 0; > ++} > + #else > + #error Unsupported platform > + #endif > +@@ -175,7 +183,7 @@ int terminal_current_vt(int fd) { > + return -1; > + } > + return st.v_active; > +-#elif defined(__FreeBSD__) > ++#elif defined(__FreeBSD__) || defined(__OpenBSD__) > + int vt; > + int res = ioctl(fd, VT_GETACTIVE, &vt); > + close(fd); > Index: patches/patch-common_wscons_c > =================================================================== > RCS file: patches/patch-common_wscons_c > diff -N patches/patch-common_wscons_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-common_wscons_c 8 Nov 2023 11:20:02 -0000 > @@ -0,0 +1,14 @@ > +OpenBSD support > + > +Index: common/wscons.c > +--- common/wscons.c.orig > ++++ common/wscons.c > +@@ -10,7 +10,7 @@ > + > + #define STRLEN(s) ((sizeof(s) / sizeof(s[0])) - 1) > + > +-#if defined(__NetBSD__) > ++#if defined(__NetBSD__) || defined(__OpenBSD__) > + int path_is_wscons(const char *path) { > + static const char wskbd[] = "/dev/wskbd"; > + static const char wsmouse[] = "/dev/wsmouse"; > Index: patches/patch-meson_build > =================================================================== > RCS file: patches/patch-meson_build > diff -N patches/patch-meson_build > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-meson_build 8 Nov 2023 11:20:02 -0000 > @@ -0,0 +1,41 @@ > +build on OpenBSD : no -lrt, set _BSD_SOURCE > +Index: meson.build > +--- meson.build.orig > ++++ meson.build > +@@ -29,7 +29,7 @@ cc = meson.get_compiler('c') > + add_project_arguments( > + [ > + '-D_XOPEN_SOURCE=700', > +- '-D__BSD_VISIBLE', > ++ '-D_BSD_SOURCE', > + '-D_NETBSD_SOURCE', > + '-DSEATD_VERSION="@0@"'.format(meson.project_version()), > + '-DSEATD_DEFAULTPATH="@0@"'.format(defaultpath), > +@@ -158,8 +158,8 @@ if get_option('libseat-logind') != 'disabled' > + endif > + > + # needed for cross-compilation > +-realtime = meson.get_compiler('c').find_library('rt') > +-private_deps += realtime > ++# realtime = meson.get_compiler('c').find_library('rt') > ++# private_deps += realtime > + > + if with_builtin > + libseat_c_args += '-DBUILTIN_ENABLED=1' > +@@ -220,14 +220,14 @@ if with_server > + [ server_files, 'seatd/seatd.c' ], > + include_directories: [include_directories('.', 'include')], > + install: true, > +- dependencies: [realtime], > ++# dependencies: [realtime], > + ) > + executable( > + 'seatd-launch', > + [ 'seatd-launch/seatd-launch.c' ], > + include_directories: [include_directories('.', 'include')], > + install: true, > +- dependencies: [realtime], > ++# dependencies: [realtime], > + ) > + endif > + > Index: patches/patch-seatd_client_c > =================================================================== > RCS file: patches/patch-seatd_client_c > diff -N patches/patch-seatd_client_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-seatd_client_c 8 Nov 2023 11:20:02 -0000 > @@ -0,0 +1,29 @@ > +OpenBSD support for socket peer credentials > + > +Index: seatd/client.c > +--- seatd/client.c.orig > ++++ seatd/client.c > +@@ -55,6 +55,23 @@ static int get_peer(int fd, pid_t *pid, uid_t *uid, gi > + *uid = cred.unp_euid; > + *gid = cred.unp_egid; > + return 0; > ++#elif defined(__OpenBSD__) > ++ struct sockpeercred peercred; > ++ socklen_t len = sizeof(peercred); > ++ if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &len) == -1) { > ++ // assume builtin backend > ++ if (errno == EINVAL) { > ++ *pid = getpid(); > ++ *uid = getuid(); > ++ *gid = getgid(); > ++ return 0; > ++ } > ++ return -1; > ++ } > ++ *pid = peercred.pid; > ++ *uid = peercred.uid; > ++ *gid = peercred.gid; > ++ return 0; > + #elif defined(__FreeBSD__) > + struct xucred cred; > + socklen_t len = sizeof cred; > Index: patches/patch-tests_poller_c > =================================================================== > RCS file: patches/patch-tests_poller_c > diff -N patches/patch-tests_poller_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-tests_poller_c 8 Nov 2023 11:20:02 -0000 > @@ -0,0 +1,16 @@ > +OpenBSD support > + > +Index: tests/poller.c > +--- tests/poller.c.orig > ++++ tests/poller.c > +@@ -123,6 +123,10 @@ static int test_signal_event(int signal, void *data) { > + return 0; > + } > + > ++#ifdef __OpenBSD__ > ++#define SIGRTMIN SIGUSR1 > ++#endif > ++ > + static void test_poller_single_signal(void) { > + struct poller poller; > + test_assert(poller_init(&poller) == 0); > > > -- > Matthieu Herrb -- Matthieu Herrb