Commit Graph
100 Commits
Author SHA1 Message Date
Augustin Cavalier 767d7cf9fa libroot & kernel: Replace strchr, strcpy with musl's versions.
They call out to other library functions, which are better optimized
than the old naive implementations.

Add -fno-builtin to the musl strings Jamfile, otherwise GCC
generates infinite recursion in strcpy, apparently.
2026-03-05 17:31:30 -05:00
Augustin Cavalier fb0556ae2b BFS: Remove the inode from the Removed list with the transaction lock held.
Fixes #19953.
2026-03-05 15:58:28 -05:00
Augustin Cavalier 26f8f18b1c BFS: Assert in RemovedInodes(), don't just have a comment.
This would've caught the cause of #19953.
2026-03-05 15:56:48 -05:00
Augustin Cavalier 11280e1b51 kernel/device_manager: Remove unnecessary includes of Locker.h. 2026-03-05 13:35:14 -05:00
Augustin Cavalier a3fe30c940 kernel/fs: Rename create_vnode to file_create_vnode.
Matches dir_create_vnode. As discussed on the review
for the previous commit.
2026-03-05 13:00:18 -05:00
Augustin Cavalier 585ac6895e kernel/user_mutex: Let single-threaded applications sleep on mutexes.
It seems some single-threaded applications do use them, which doesn't
result in a deadlock because they use timeouts (or maybe wait on
signals, too.)
2026-03-05 12:46:31 -05:00
Augustin Cavalier 7ef695df5c kernel: Allocate user_mutex_contexts when adding the second thread to a team.
This allows us to gracefully fail if memory allocation fails,
rather than panic()ing. If a single-threaded application tries
to wait on a non-shared user_mutex in single-threaded mode, it
will now be dropped into the debugger.
2026-03-04 21:42:03 -05:00
Augustin Cavalier e6569ec320 kernel: Add an AssertLocked() to Team.
The mutex member is private, so this is necessary for other methods
to assert the team mutex is locked.
2026-03-04 21:38:43 -05:00
Augustin Cavalier f1425c9e61 freebsd_network: Include <thread.h> first, to avoid ASSERT incompatibilities. 2026-03-04 21:35:11 -05:00
Augustin Cavalier ff0cd4274c SoftwareUpdater: Move "complete" logic to ProgressApplyingChangesDone.
This is more like how pkgman does it. Behaviorally, users should
not notice a difference.
2026-03-03 17:45:42 -05:00
Augustin Cavalier 61c7d7e4ee Package Kit: Move a number of headers into the source directory.
These classe aren't used, and probably shouldn't be used, outside
Package Kit itself.

Also drop some files from libpackage_build that are not needed.
2026-03-03 17:45:28 -05:00
Augustin Cavalier 5f0f0b02b4 Package Kit, pkgman, SoftwareUpdater: Offer to delete old state directories.
This adds a new job to the Package Kit, and an invocation
in pkgman after changes are applied. The job takes a time_t before,
and an int32 minToKeep, and (after confirmation) deletes all state
directories which were last modified before that time, but also
keeps at least the minimum specified.

pkgman defaults to calling it with (now - 30 days, minimum 10).
SoftwareUpdater does the same, but without bothering the user
and just defaults to doing the cleanup.

Change-Id: I15f5232b11daba5955e7fa07f696ad7785507931
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10404
Reviewed-by: waddlesplash <[email protected]>
2026-03-03 22:14:57 +00:00
Augustin Cavalier 79ab5081b2 Package Kit: Rename InstallationLocationInfo::OldState to ActiveState.
It doesn't refer to some random old state, but the currently active
one. (If the currently active state is the default one, then it will
return nothing.) So, this should make things clearer.

Change-Id: Ib3fe842f5fb51eaf2ef2f31bad8b292b47a3fb36
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10403
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-03 22:14:57 +00:00
Augustin Cavalier 418769d64b BResources: Mark deprecated methods _DEPRECATED. 2026-03-02 21:11:39 -05:00
Augustin Cavalier dc4a606f5e Clock: Use BResources::LoadResource instead of FindResource.
The latter is deprecated.
2026-03-02 21:11:23 -05:00
Augustin Cavalier f071ee419d BMimeType: Use the new _DEPRECATED to mark SetType deprecated.
This is the first use of this new macro.
2026-03-02 21:03:25 -05:00
Augustin Cavalier a3be73a455 BTokenSpace: Add cast to appease GCC2. 2026-03-02 20:35:01 -05:00
Augustin Cavalier 9e3e304057 BLocale: Name the BLocker. 2026-03-02 20:22:14 -05:00
Augustin Cavalier b6441edfac BLooperList: Use rw_lock.
Improves efficiency, as some functions can use a read lock
instead of a write lock.

Eliminates another statically-created BLocker.
2026-03-02 20:17:51 -05:00
Augustin Cavalier 5eef2f1d00 BTokenSpace: Use pthread_mutex instead of BLocker.
This header gets included in the build platform, so we can't use
the private recursive_lock.

Eliminates another statically created BLocker, due to gDefaultTokens.
2026-03-02 20:16:32 -05:00
Augustin Cavalier f9850b561c kernel/user_mutex: Panic instead of failing due to OOM.
This is not an expected failure condition for most applications,
so try to avoid propagating it to userspace.

(If necessary, it should be possible to avoid even the possibility
of this by just allocating necessary datastructures upfront
instead of "lazily". But that seems unnecessary at the moment.)
2026-03-02 19:38:26 -05:00
Augustin Cavalier ae70142168 BBlockCache: Use a pthread_mutex instead of BLocker.
The lighter "struct mutex" is in a private header, so we can't
inline it in a public one, so just use pthread_mutex here.

By adjusting padding, the class size stays the same (72 bytes
on 32-bit, 96 bytes on 64-bit; confirmed via static_assert.)

A quick benchmark running "new/delete BMessage" in a loop on 4
threads at once goes from 30-36 seconds before this commit
to around 13-17 seconds, sometimes as low as 3 seconds, afterwards,
so clearly this is a significant improvement.

This also eliminates another BLocker allocated on application startup.
2026-03-02 19:37:13 -05:00
Augustin Cavalier 184b57aa71 BBlockCache: Rewrite header for style. 2026-03-02 18:01:56 -05:00
Augustin Cavalier 8cc48bf580 QueryParser: Don't divide by zero on empty attributes.
Fixes a KDL.
2026-02-28 22:16:43 -05:00
Augustin Cavalier f3fd885731 Game & Media Kits: Avoid some usages of static BLockers.
Saves some semaphores.
2026-02-28 22:16:15 -05:00
Augustin Cavalier 4d055d982a BGameSoundDevice: Cleanup.
* Use new-style header comments.

 * Put globals inside class or make static, instead of exporting
   unnecessarily.
2026-02-28 21:52:05 -05:00
Augustin Cavalier 6a4a02907a EHCI: Disable the physical buffers logic, at least for now.
It seems it may have caused serious regressions on some hardware,
see #19949 and #19945.
2026-02-28 20:34:12 -05:00
Augustin Cavalier 4d9bb0a399 LaunchBox: Style cleanup after previous change. 2026-02-28 20:31:30 -05:00
Augustin Cavalier aa939503b6 AppServerLink: Use the correct static initializer for recursive_lock.
Interestingly, the modern GCC accepted the "wrong" one, only GCC 2 didn't.
2026-02-27 10:26:25 -05:00
Augustin Cavalier 66d85d702b Terminal & Expander: Replace exit() with _exit() in fork+exec failure path.
This is necessary to avoid destructors being called in the child,
potentially messing up parent state.
2026-02-27 10:17:40 -05:00
Augustin Cavalier 1380d03a42 time_stats: Replace fork+exec with posix_spawn. 2026-02-27 10:16:51 -05:00
Augustin Cavalier 8cf5bd97a2 launch_daemon: Replace fork+exec with posix_spawn. 2026-02-27 10:16:35 -05:00
Augustin Cavalier 23ef8b89c6 net_server: Replace fork+exec with posix_spawn.
Uses POSIX_SPAWN_SETSID, so needs the previous commit to work.
2026-02-27 10:16:21 -05:00
Augustin Cavalier 27e95c346a posix_spawn: Fix implementation of POSIX_SPAWN_SETSID.
setsid() returns -1 in case of error, and a pid_t in case of success.
2026-02-27 10:13:46 -05:00
Augustin Cavalier 9b5a7d7612 AppServerLink: Switch to a recursive lock.
It seems in some applications (though not most of the ones I
initially tested) this can get used recursively, so we need
a recursive_lock in order to not deadlock.

Also commit a missed change from the previous commit.
2026-02-27 09:22:21 -05:00
Augustin Cavalier fb543b61ba AppServerLink: Use a mutex.
X512 pointed out that ServerLink is inherited by PortLink which is
used by all windows, so the original change had the unintended effect
of allocating another semaphore for every window, which isn't wanted.
So, just use a static mutex here also.
2026-02-27 09:15:48 -05:00
Augustin Cavalier 91eb43cfc0 libbe.so: Prevent (re)using BApplication after fork.
The case where no BApplication has been created at the time of fork
is not blocked by this change (as it might be useful in fork-to-background
before creating a BApplication.)

Reinitializing or recreating a BApplication where one already exists,
though, is not supported by the kits, and just leads to problems.
And when the global destructors are invoked after a fork, such as by
exit(), then the parent team's state may be corrupted due to the
deletion of BLocker semaphores or other global state.

So, we thus set be_app to an invalid pointer, and if terminate_after()
is called with this pointer, we invoke debugger().

(We should really just prevent semaphores from being used across
processes unless explicitly specified, but that would be an
API compatibility break from BeOS, so we'll need to do it carefully,
or not until after R1.)

Would have clearly caught the problem in #18576 and the linked thread.
2026-02-26 17:26:08 -05:00
Augustin Cavalier 9cada02ee0 libbe.so: Avoid static BLockers.
They don't work properly after a fork, and if exit() is called
from the forked child, the parent won't be able to use them
anymore.

In BBitmap and BPicture, replace them with mutexes. For AppServerLink,
make the private ServerLink inherit from BLocker, and then use
that one directly.

This also is a slight efficiency gain, as we don't need to create
multiple semaphores from the static initializers now, which is
just a waste of time in the case of applications that don't
even need these locks but link to libbe.so (e.g. CLI tools.)

Part of #18576.
2026-02-26 17:15:53 -05:00
Augustin Cavalier b43289d544 ramfs: Rework NodeMTimeUpdater into NodeStatChangeNotifier.
This now does what notify_if_stat_changed used to, fixing a
race: if some thread was modifying a file, and some other thread
(or the same thread, in some other mtime-updating operation)
updated that file and this called MarkUnmodified() before the
first thread close()d it, then when the first thread called close(),
no node monitor notification would've been sent, as fModified
would've already been unset.

So, now every time we are to mark a file "unmodified", we also
send the node monitor notification at the same time.

Fixes the remainder of #19910.
2026-02-26 16:11:50 -05:00
Augustin Cavalier 0c5895120d ramfs: Send separate node monitor events for each Entry of a Node.
This way, the node monitor system can send events to applications
with B_WATCH_ALL set on parent directories, like Tracker.

Part of #19910.
2026-02-26 16:11:50 -05:00
Augustin Cavalier c271a5e7f9 ramfs: Consolidate attribute notifications logic. 2026-02-26 16:11:49 -05:00
Augustin Cavalier de2ec4a8c3 ramfs: Rehabilitate AllocationInfo support.
At least we won't double-count files now.
2026-02-26 16:11:49 -05:00
waddlesplash 8f3276e838 Revert "netresolv: Add support for AI_V4MAPPED in ai_flags in getaddrinfo"
This reverts commit 902921a554.

This broke resolution of CNAMEs, including the Haiku package repos.
Since pkgman uses our own HTTP implementation, which doesn't set
AI_V4MAPPED at all, this shouldn't have been a behavioral change for
it at all, much less having broken it.

Change-Id: If38b6a81c1144101ddea7d1f8d401326675479e3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10388
Reviewed-by: waddlesplash <[email protected]>
2026-02-26 20:54:16 +00:00
Augustin Cavalier 3214eedc80 kernel/x86: Avoid unnecessary TLB invalidations.
If a context switch happened between the messsage being
sent and received, we don't need to invalidate.

Brief testing on a 4-core VM shows this happens relatively
rarely during compile jobs (expected, most processes are
single-threaded), but very often while running multiprocess
web browsers. Some INVALIDATE_PAGES are skipped, but mostly
INVALIDATE_PAGE_LIST is (by the thousands.)

Change-Id: If32ed95139e0db3770054f6ef3f72c9aecb9394d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10350
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2026-02-26 17:17:06 +00:00
Augustin Cavalier 3e1ccaf329 kernel: Refactor arch_cpu_invalidate* methods to take a context parameter.
This will be useful on architectures that support ASIDs, and on
ones that don't, it can be used to avoid a race between invalidation
messages being sent and context switches occurring on other CPUs.

In this commit, no behavioral change intended on any architecture.

Change-Id: I6d2ee4b69150f9ff8503329761266ddbdb550eab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10349
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2026-02-26 17:17:06 +00:00
Augustin Cavalier 763cfd171b pthread_barrier: Utilize B_USER_MUTEX_DISABLED for efficiency.
This way we don't need to call barrier_unlock() in every thread
after exiting the wait loop, some syscalls. We can also avoid
spinning on the barrier mutex in "ensure_idle" (which is renamed
"ensure_none_exiting" for clarity), and instead lock it once and wait
for some thread to unblock all.

Overall, this strategy appears to be as much as 25% faster
than the previous, testing with pthread_barrier_test.

It seems the old design had at least one possible but very narrow
race in the "last one out" logic: if that thread was suspended
between the atomic_add() and the assignment of barrier->lock, and
all three other threads then ran past the add() in the next run,
then when the last-one-out woke up, it would clear the WAITING
flag spuriously.

This may help with #19876.
2026-02-25 14:47:29 -05:00
Augustin Cavalier a2443366d9 BFS: Propagate errors from CachedNode::InternalSetTo properly.
Otherwise, SetTo() might return B_OK when fNode is really NULL,
leading to crashes later when something tries to use the block.

Fixes #14762.
2026-02-24 21:05:21 -05:00
Augustin Cavalier 6084727f52 openbsd_wlan: Synchronize net80211, idualwifi7260, iaxwifi200 with upstream. 2026-02-24 20:21:36 -05:00
Augustin Cavalier 07dd1db8ff openbsd_network: Additions needed by newer WiFi drivers and stack. 2026-02-24 20:15:16 -05:00
Augustin Cavalier 2dc2df952c build: Disable virtio_block for now.
It just causes system instability, crashes, and disk corruptions;
see #18717.
2026-02-13 12:07:01 -05:00
Augustin Cavalier f19676f1c0 kernel/vm: Add a fast way out in VMAnonymousCache::StoreHasPage.
If we have no allocated swap space, then we don't need to even
bother doing a lookup in the hash table (which requires a read-lock,
anyway.)

This function is now called often even if swap isn't actively
being used, so any gains here are helpful.
2026-02-04 17:54:10 -05:00
Augustin Cavalier 64a26f88bf Jamfile: Drop expat, make gzip architecture-dependent. 2026-02-04 17:42:41 -05:00
Augustin Cavalier 310f75e043 docs: Move fs_query documentation to the Haiku Book.
Also add a missing include in QueryPoseView.
2026-02-04 17:41:53 -05:00
Augustin Cavalier 379c8aebab fs_shell: Add the new B_QUERY_WATCH_ALL. 2026-02-04 17:21:25 -05:00
Augustin Cavalier fe444bc3cb libroot/glibc: Reinstate long-double printf_fphex code.
Fixes #19925.
2026-02-04 17:09:50 -05:00
Augustin Cavalier 53ee2648fb fs_query: Make B_QUERY_WATCH_ALL part of the public API.
It seems to work well enough at this point, and is used in Tracker,
so why not?

Also update live_query to demonstrate the functionality.
2026-02-04 17:09:50 -05:00
Augustin Cavalier c32328567c NTFS: Move some initialization to the struct volume constructor.
May fix #19926.
2026-02-04 16:41:37 -05:00
Augustin Cavalier 543aa2c72f kernel/vm: Refactor and reinstate swap-space freeing in the page daemon.
This has been disabled since a refactor in 2010.

Seems to work OK in some basic testing.
2026-02-04 15:34:27 -05:00
Augustin Cavalier dce3a4366d packagefs: Add a fallback buffer for reading heaps in low-memory conditions.
Otherwise we might fail with B_NO_MEMORY, or wait for long periods of
time, which we don't want to do in such a critical routine.

Should improve system responsiveness (or even prevent application
crashes) under high memory pressure.
2026-02-04 14:59:27 -05:00
Augustin Cavalier 2c4d5ab101 libnetapi: Disable -Werror for GCC2.
Fixes the build after the package repo sync.
2026-01-30 21:37:00 -05:00
Augustin Cavalier cbb5c2c9f0 generate_build_packages_repo: Fix mode. 2026-01-30 21:36:42 -05:00
Augustin Cavalier eb3a8bce86 tools: Update hardlink_packages.py into generate_build_packages_repo.py.
It doesn't hardlink packages anymore, as we use S3, so it copies instead.
This is a better name anyway.
2026-01-30 21:32:37 -05:00
Augustin Cavalier 5c254dff8c HaikuPorts: Synchronize x86_64 and x86_gcc2.
One change to app_server to build with the new FreeType.
2026-01-29 22:51:52 -05:00
Augustin Cavalier f78defbd46 Jamfile: Reformat and adjust AddHaikuImageSystemPackages.
* Put each package on its own line. This mirrors the earlier
   refactor of image rules.

 * Drop a few packages with library-only provides. The build
   system will pull them in automatically as needed (libicns, etc.)
2026-01-29 22:49:29 -05:00
Augustin Cavalier 0af3006721 QueryParser: Don't send notifications if the node's been deleted.
Gets rid of redundant messages under B_QUERY_WATCH_ALL.
2026-01-29 18:10:12 -05:00
Augustin Cavalier 377f154bf0 BFS: Implement the trivial case of Volume::CheckForLiveQuery.
Saves a bit of work when there are no live queries running
(as will often be the case on an idle system.)
2026-01-29 18:01:37 -05:00
Augustin Cavalier 18dd362efa kernel/fs: Return B_BAD_VALUE for O_RDONLY|O_TRUNC on open().
According to Sortix os-test, this better matches the behavior
of OpenBSD and other OSes that reject this combination of flags.
2026-01-29 15:24:03 -05:00
Augustin Cavalier 6fc8d99e21 libroot: Expose exect() only if building with BeOS ABI compatibility.
It's non-standard and redundant, but was in the public R5 headers,
so we need to keep it around at least for compatibility.
2026-01-29 15:04:23 -05:00
Augustin Cavalier 4310e8e1c8 posix_spawn: Expose file_actions_add[f]chdir.
The non-"_np" versions were exported, but not declared in the header.
Do that, and also make the "_np" versions the alias, as these are
specified in POSIX-2024.
2026-01-29 15:00:12 -05:00
Augustin Cavalier 83da6699df Tracker: BPoseView handles "size" and "last_modified" with B_STAT_UPDATE.
Fixes #19916.
2026-01-28 22:30:32 -05:00
Augustin Cavalier d1cbd0b1e3 rtl8125: Synchronize with upstream OpenBSD.
Adds support for RTL8126 and RTL8127.
2026-01-28 21:38:01 -05:00
Augustin Cavalier 4ed2896398 Package Kit: Refactor BRepositoryCache to have GetPackageInfos(callback)...
... instead of GetIterator(). This allows us to avoid loading the
cache entirely in SetTo(), and allows consumers to read the cache
much more efficiently than loading it all into memory and then
freeing it again afterwards.

This technically breaks API/ABI, however the Package Kit APIs
are not considered stable (I don't think.)

All consumers adjusted. As we build the host tools with modern GCC
only, I made update_package_requires use a C++11 lambda function.
All others use out-of-line static methods.

"time pkgman list-repos -v" (which has to read the whole cache)
is ~0.5s before this change, and ~0.25s after this change,
on my test VM.

Change-Id: I6976b4cf5eb846fc925ed199dc00eb227fc81344
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10247
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Andrew Lindesay <[email protected]>
2026-01-21 20:27:13 +00:00
Augustin Cavalier 7fe5a67108 HaikuDepot: Another fix for the GCC2 build. 2026-01-20 15:33:07 -05:00
Augustin Cavalier 999bb2e88a sys/param.h: Add DEV_BSIZE and make use of it.
POSIX-2024 says:

> There is no correlation between values of the st_blocks and
> st_blksize, and the f_bsize (from <sys/statvfs.h>) structure members.

Some code in Haiku has mixed that up in the past (e.g. the write_overlay).
This will allow a constant to be used instead, clarifying what's happening.

POSIX-2024 does not actually require this constant, but it does say:

> Traditionally, some implementations defined the multiplier for
> st_blocks in <sys/param.h> as the symbol DEV_BSIZE.

And indeed, glibc, musl, and FreeBSD (at least) all define it.
So it seems to make sense for us to do the same.

Related to #19251.
2026-01-20 14:43:37 -05:00
Augustin Cavalier c30e5cf106 libroot/locale: Allow global locales to be applied to the current thread.
I added this assertion thinking it would incorrectly override
thread locales, and that invocationns this way would be a bug.
Instead it appears that this is the expected behavior in select
circumstances.

Fixes #19896 and other recent regressions.
2026-01-16 12:33:14 -05:00
Augustin Cavalier c329ad53b1 libroot/musl: Check gmtoff before returning timezone names.
And add a fallback for GMT.

Improves the situation in #18471.
2026-01-15 19:18:05 -05:00
Augustin Cavalier 7b94842122 ICUCtypeData: Fix MB_CUR_MAX under most encodings.
See inline comment.

Fixes #19881.
2026-01-15 18:48:10 -05:00
Augustin Cavalier f1ca09f6a2 ICUCtypeData: Use U16_APPEND rather than implementing our own version. 2026-01-15 18:48:10 -05:00
Augustin Cavalier 9be2b373d3 locale: Refactor ctype storage and consolidate some files.
* Drop the global definitions from ctype.h, and move them to
   the internal LocaleData.h: the functions should be used always
   when building new applications (as they're thread-safe.)

 * Make __ctype_get_mb_cur_max thread-safe and move it to live
   alongside the other __ctype...() methods.

 * Put the __ctype...() methods in two files, clearly indicating
   versions: ctype_loc_global for the global (non-thread-safe) versions,
   used for the kernel, and ctype_loc_thread for the libroot versions.

 * Consolidate more internal functions into LocaleInternal.cpp.
2026-01-15 18:48:10 -05:00
Augustin Cavalier 2d20dfef26 libroot/locale: Consolidate some headers.
No behavioral change intended.
2026-01-15 18:48:09 -05:00
Augustin Cavalier 256ab7351b libroot/posix: fchdir() should not accept AT_FDCWD.
It doesn't make sense to change directories to the current one.

Should fix #19059.
2026-01-08 18:21:06 -05:00
Augustin Cavalier 988d9d80b1 kernel/fs: Check O_DIRECTORY in the VFS, not filesystems.
Just like O_NOFOLLOW. Also drop the now-redundant checks from
all filesystems.

At least some filesystem hooks (FIFOs in particular, see #19879) did not
check this, so this fixes them.
2026-01-08 16:34:51 -05:00
Augustin Cavalier f1f209415b kernel/fs: Relocate and consolidate open mode checks.
* get_new_fd is actually too late for the O_TRUNC one: we will
   have already called the vnode open() hook by then. So, we
   need to do that in open_vnode.

 * Move checks to a new static helper method, and invoke it
   in all relevant places.

 * Delete now-redundant O_NOFOLLOW checks.
2026-01-08 16:31:21 -05:00
Augustin Cavalier 7d234f26de strtok_r: Include features.h and reinstate "restrict". 2026-01-08 15:48:50 -05:00
Augustin Cavalier 04ebf3d669 libroot: Appease GCC2 for strtok_r. 2026-01-07 18:23:43 -05:00
Augustin Cavalier da0529e546 kernel/team: Add set_foreground_process_group failure case with EPERM.
As specified in POSIX.

Fixes Sortix os-test/tcsetpgrp-wrong-session, part of #19877.
2026-01-07 18:18:36 -05:00
Augustin Cavalier 35061cc3cb limits.h: Add missing _POSIX2_CHARCLASS_NAME_MAX. 2026-01-07 17:08:43 -05:00
Augustin Cavalier 713e7b2c54 locale: Implement getlocalename_l.
Specified in POSIX-2024.

GNUlib currently has a nasty Haiku-specific hack to implement
equivalent functionality; after this it should be able to use
this function instead.
2026-01-07 16:27:46 -05:00
Augustin Cavalier 571ec77bf1 kernel: Add new strtok_r.c to the Jamfile. 2026-01-07 16:05:27 -05:00
Augustin Cavalier 95b41d5986 libroot/posix: Replace strtok_r with musl's.
And rewrite/cleanup strtok.c also.
2026-01-07 16:04:18 -05:00
Augustin Cavalier ac46a180d8 kernel/fs: Check if the existing node is a directory in create_vnode.
Otherwise, calling open(O_CREAT) on a path that exists but is
a directory will succeed.

Fixes Sortix os-test open-tmpdir-rdonly-creat. (Interestingly
many other OSes also fail this test; only Linux, FreeBSD, Solaris,
and Sortix, and now also Haiku, properly return EISDIR.)

While at it, fix the doc comment, which appears to have been
copied from open_vnode.
2026-01-07 14:02:46 -05:00
Augustin Cavalier a76a638355 uname: C89 fix to appease GCC2. 2026-01-06 19:57:18 -05:00
Augustin Cavalier b0570368f3 limits.h: Clean up and fix _POSIX_* values.
These aren't actual limits, but rather the minimum limit
as specified in POSIX (e.g. _POSIX_NAME_MAX is the minimum
allowed value for NAME_MAX).

Add missing values as defined in POSIX-2024, at least for
features we support, and change wrong values to be the ones
specified in POSIX.

No behavioral intended change (nothing should be using these directly.)
2026-01-06 19:57:07 -05:00
Augustin Cavalier d763a3829a semaphore.h: Add SEM_VALUE_MAX.
It's specified in POSIX, and FreeBSD puts it in this file.

Distinguish it from _POSIX_SEM_VALUE_MAX (which is really a
"minimum value this can have" as specified in POSIX.)
2026-01-06 19:40:23 -05:00
Augustin Cavalier ca5c5d531e unistd: Add _POSIX_DEVICE_CONTROL.
We have posix_devctl, so we should declare this now.
2026-01-06 19:38:49 -05:00
Augustin Cavalier 1e4c529aeb search.h: Declare posix_tnode as specified in POSIX-2024.
FreeBSD does the same.
2026-01-06 19:37:53 -05:00
Augustin Cavalier f869860377 kernel: Return B_HAIKU_VERSION for kernel_version & handle it in uname().
We have returned "1" here since this code was originally written
in 2004 (hrev7290). BeOS R5 apparently returns "1000009" for this
value, while the Be Book gives no details about what this value means.

So, return an actually useful value of the Haiku version, and then
in uname() process this to return a string indicating the Haiku
version. This makes "uname" print the actual system version,
not just the hrev.

It appears Linux and other systems give non-integer values in
info->release, so this should be fine.

Fixes #17030.
2026-01-06 19:30:44 -05:00
Augustin Cavalier 6a1ad86129 Debugger: Fix jobs trying to re-add dependencies.
Linked lists are used to manage these, so if we re-add
jobs we'll corrupt the linked lists and cause crashes.

Fixes #19864 and possibly others.
2026-01-06 18:01:24 -05:00
Augustin Cavalier 708d8e42c3 ps2: Disable v2.
It isn't working properly; see #19874.

Leave the others enable for testing for now. We can disable them
in the beta6 branch if necessary (if nobody reports that they are
indeed working.)
2026-01-06 16:24:03 -05:00
Augustin Cavalier 33bc049b2d freebsd_wlan: Don't include stdbool.h under C++.
Should appease GCC 2.
2025-12-30 22:04:33 -05:00