From ea0a00246815c9fe957c6564a28e0960a5d04433 Mon Sep 17 00:00:00 2001 From: tuftedocelot Date: Wed, 22 Dec 2021 18:28:00 -0600 Subject: [PATCH] LibCore: Add OpenBSD headers to System and LocalSocket Add the correct header to System.h and add OpenBSD-specific handling of signals and socket process id --- Userland/Libraries/LibCore/LocalSocket.cpp | 3 +++ Userland/Libraries/LibCore/System.cpp | 2 +- Userland/Libraries/LibCore/System.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibCore/LocalSocket.cpp b/Userland/Libraries/LibCore/LocalSocket.cpp index af496613025..4f1162f6086 100644 --- a/Userland/Libraries/LibCore/LocalSocket.cpp +++ b/Userland/Libraries/LibCore/LocalSocket.cpp @@ -65,6 +65,9 @@ pid_t LocalSocket::peer_pid() const #elif defined(__FreeBSD__) struct xucred creds = {}; socklen_t creds_size = sizeof(creds); +#elif defined(__OpenBSD__) + struct sockpeercred creds = {}; + socklen_t creds_size = sizeof(creds); #else struct ucred creds = {}; socklen_t creds_size = sizeof(creds); diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index ef46ff3d6e8..eec0e079713 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -131,7 +131,7 @@ ErrorOr sigaction(int signal, struct sigaction const* action, struct sigac return {}; } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__OpenBSD__) ErrorOr signal(int signal, sig_t handler) #else ErrorOr signal(int signal, sighandler_t handler) diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index b27df73ff55..5c5a277a90e 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -41,7 +41,7 @@ ErrorOr accept4(int sockfd, struct sockaddr*, socklen_t*, int flags); #endif ErrorOr sigaction(int signal, struct sigaction const* action, struct sigaction* old_action); -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__OpenBSD__) ErrorOr signal(int signal, sig_t handler); #else ErrorOr signal(int signal, sighandler_t handler);