Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mtl1979/0ec0dc611409b9aaa1fcf1fdd6cb30de to your computer and use it in GitHub Desktop.

Select an option

Save mtl1979/0ec0dc611409b9aaa1fcf1fdd6cb30de to your computer and use it in GitHub Desktop.
Fix kernel ABI breakage with beta 5.
From d79709696d47576eae9df018329aad412411acce Mon Sep 17 00:00:00 2001
From: "Mika T. Lindqvist" <[email protected]>
Date: Sun, 22 Dec 2024 15:18:02 +0200
Subject: [PATCH] Fix kernel ABI breakage with beta 5.
---
headers/private/system/syscalls.h | 3 ++-
src/system/kernel/UserTimer.cpp | 2 +-
src/system/kernel/fs/fd.cpp | 2 +-
src/system/kernel/fs/vfs.cpp | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/headers/private/system/syscalls.h b/headers/private/system/syscalls.h
index 6501316cc8..b5baa940b0 100644
--- a/headers/private/system/syscalls.h
+++ b/headers/private/system/syscalls.h
@@ -412,7 +412,6 @@ extern status_t _kern_get_real_time_clock_is_gmt(bool *_isGMT);
extern status_t _kern_get_clock(clockid_t clockID, bigtime_t* _time);
extern status_t _kern_set_clock(clockid_t clockID, bigtime_t time);
-extern status_t _kern_get_cpuclockid(thread_id id, int32 which, clockid_t* _clockID);
extern bigtime_t _kern_system_time();
extern status_t _kern_snooze_etc(bigtime_t time, int timebase, int32 flags,
@@ -654,6 +653,8 @@ extern status_t _kern_start_watching_disks(uint32 eventMask, port_id port,
int32 token);
extern status_t _kern_stop_watching_disks(port_id port, int32 token);
+// Syscalls added after beta 5
+extern status_t _kern_get_cpuclockid(thread_id id, int32 which, clockid_t* _clockID);
// The end mark for gensyscallinfos.
#ifdef GEN_SYSCALL_INFOS_PROCESSING
diff --git a/src/system/kernel/UserTimer.cpp b/src/system/kernel/UserTimer.cpp
index 50b458ee2a..8a66a154f9 100644
--- a/src/system/kernel/UserTimer.cpp
+++ b/src/system/kernel/UserTimer.cpp
@@ -1526,7 +1526,7 @@ user_timer_get_clock(clockid_t clockID, bigtime_t& _time)
_time = thread->CPUTime(false);
return B_OK;
- } else if ((clockID & CPUCLOCK_TEAM) == CPUCLOCK_TEAM) {
+ } else {
teamID = clockID & CPUCLOCK_ID_MASK;
if (teamID == team_get_kernel_team_id())
return B_NOT_ALLOWED;
diff --git a/src/system/kernel/fs/fd.cpp b/src/system/kernel/fs/fd.cpp
index bbc8fa1bc9..2cd4ca0e94 100644
--- a/src/system/kernel/fs/fd.cpp
+++ b/src/system/kernel/fs/fd.cpp
@@ -375,7 +375,7 @@ dup2_fd(int oldfd, int newfd, int flags, bool kernel)
if (oldfd < 0 || newfd < 0)
return B_FILE_ERROR;
if ((flags & ~O_CLOEXEC) != 0)
- return B_BAD_VALUE;
+ flags = 0;
// Get current I/O context and lock it
context = get_current_io_context(kernel);
diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp
index 381dd11549..917e3f3ed9 100644
--- a/src/system/kernel/fs/vfs.cpp
+++ b/src/system/kernel/fs/vfs.cpp
@@ -9570,7 +9570,7 @@ _user_create_pipe(int* userFDs, int flags)
{
// check acceptable flags
if ((flags & ~(O_NONBLOCK | O_CLOEXEC)) != 0)
- return B_BAD_VALUE;
+ flags = 0;
// rootfs should support creating FIFOs, but let's be sure
if (!HAS_FS_CALL(sRoot, create_special_node))
--
2.43.0
@mtl1979
Copy link
Author

mtl1979 commented Dec 25, 2024

The same for Haiku and it do not require to have compatible syscall numbers. Compatibility is maintained on system library symbol names level, not syscall level.

This isn't about Haiku kernel, this is about what limitations or restrictions using packagefs and package_daemon impose on Haiku's runtime. This isn't even about why people NEED TO use nightly builds to compile something for Beta 5 +113, +122 or +125 revisions.

I've used and contributed to Haiku since it was still called OpenBeOS and for the first weeks I worked on kernel and the drivers. There was zero issues before packagefs was introduced. Requiring consistent state is another limitation imposed by package_daemon not Haiku kernel, but in normal world, the state is unlikely consistent due to used packages not being rebuilt for every single Haiku revision and requiring several versions of for example OpenSSL library. Even more likely when actually rebuilding affected packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment