* Replaced release_sem() with release_sem_etc() for future addition of the
B_DO_NOT_RESCHEDULE flag.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22308 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Fixed vm_page_allocate_page_run(): it did not take the pageState into account,
and would therefore return uninitialized memory (ie. B_CONTIGUOUS areas would
contain garbage).
Now, it stores if a page is cleared in a new vm_page::is_cleared field.
* Some cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22306 a95241bf-73f2-0310-859d-f6bbb57e9c96
diagnostic purposes).
* hash_init() adjusts the table size to a prime number, which should
result in a better element distribution, particularly since usually a
power of two is passed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22210 a95241bf-73f2-0310-859d-f6bbb57e9c96
a reference to a by them not yet referenced cache was not correct.
They only incremented the reference count, but a vnode cache reference
includes also a vnode reference. In case of the page daemon this would
cause vnode references to be lost (causing bug #1465).
* The page daemon used an unsafe method to access a yet unreferenced
page cache. There was nothing that prevented the cache from being
deleted while the page daemon tried to get a reference. The
vm_page::cache field is now protected by the page cache table
spinlock, too, which the new function
vm_cache_acquire_page_cache_ref(), used by the page daemon, also
acquires while trying to get the reference.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22208 a95241bf-73f2-0310-859d-f6bbb57e9c96
group ID with the session and let the terminal update them.
* Added an "orphaned" flag to the process_group structure and code to
maintain it.
* Handle the death of a controlling process correctly: The
foreground process group gets a SIGHUP and all newly-orphaned process
groups containing at least one stopped processes are sent
SIGHUP+SIGCONT.
* The tty handles the O_NOCTTY flag correctly, now.
* The tty handles reads/writes from processes from other sessions
correctly, now.
* Handle tcsetpgrp() from background processes correctly.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22187 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Defined flag SIGNAL_FLAG_TEAMS_LOCKED for send_signal_etc(), so it can
be called with the team lock being held.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22186 a95241bf-73f2-0310-859d-f6bbb57e9c96
blocked and no other child status is available.
* Respect SA_NOCLDWAIT and ignored SIGCHLD in waitpid(): Unless a child
status is available immediately, the thread shall block until all
children are gone.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22161 a95241bf-73f2-0310-859d-f6bbb57e9c96
* The vm_translation_map is now correctly held in all of the vm_ mapping
functions.
* Removed the old vm_daemons.c file - there is now a new vm_daemons.cpp
which contains the beginnings of our new page daemon.
So far, it's pretty static and not much tested. What it currently does
is to rescan all pages in the system with a two-handed clock algorithm
and push pages into the modified and inactive lists.
* These inactive pages aren't really stolen yet, even though their mappings
are removed (ie. their next access will cause a page fault). This should
slow down Haiku a bit more, great, huh? :-)
* The page daemon currently only runs on low memory situations, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22156 a95241bf-73f2-0310-859d-f6bbb57e9c96
DEBUG_CACHE_LIST) that prints an unspectacular list of pointers to all
existing caches. Feel free to extend.
* Enhanced MultiAddressSpaceLocker:
- It supports choosing between read and write lock per address space,
now.
- Added AddAreaCacheAndLock(), which adds the address spaces of all
areas that are attached to a given area's cache, locks them, and
locks the cache. It makes sure that the area list didn't change in
the meantime and optionally also that all areas have their
no_cache_change flags cleared.
* Changed vm_copy_on_write_area() to take a cache instead of an area,
requiring it to be locked and all address spaces of affected areas to
be read-locked, plus all areas' no_cache_change flags to be cleared.
Callers simply use MultiAddressSpaceLocker:: AddAreaCacheAndLock() to
do that. This resolves an open TODO, that the areas' base, size, and
protection fields were accessed without their address spaces being
locked.
* vm_copy_area() does now always insert a cache for the target area. Not
doing that would cause source and target area being attached to
the same cache in case the target protection was read-only. This
would make them behave like cloned areas, which would lead to trouble
when one of the areas would be changed to writable later.
* Fixed the !writable -> writable case in vm_set_area_protection(). It
would simply change the protection of all mapped pages for this area,
including ones from lower caches, thus causing later writes to the
area to be seen by areas that shouldn't see them. This fixes a problem
with software breakpoints in gdb. They could cause other programs to
be dropped into the debugger.
* resize_area() uses MultiAddressSpaceLocker::AddAreaCacheAndLock() now,
too, and could be compacted quite a bit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22152 a95241bf-73f2-0310-859d-f6bbb57e9c96
Condition variables would never be interrupted.
* ConditionVariableEntry::Add() did not correctly insert the entry into
the per-thread list of entries (the next link of the previous entry
was not adjusted), which could leave the entry unnotified when the
previous entry was notified, thus leaving it in the respective
condition variable's list after the end of its life time. This should
fix a crashing bug I rarely encountered.
* Added debug checks in the PrivateConditionVariableEntry
constructor/destructor that should have helped me to find
forementioned bug hours earlier, had I been bright enough to realize
that I didn't include <debug.h> and those KDEBUG guarded checks were
never executed. :-/
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22151 a95241bf-73f2-0310-859d-f6bbb57e9c96
Can be enabled by defining KERNEL_BREAKPOINTS in arch/user_debugger.h
and will provide the arch_{set,clear}_kernel_{break,watch}point()
function. Hitting a break-/watchpoint will throw the thread into KDL.
* Finally added a comment, what's the point of
i386_reinit_user_debug_after_context_switch(), since I wonder every
time I see it. Should be optimized aways soon.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22150 a95241bf-73f2-0310-859d-f6bbb57e9c96
is used instead of death_entry for team::dead_children.
* Added team::{stopped,continued}_children, which, analoguously to
dead_children, are used to track the state of stopped/continued
children.
* A team does have a job_control_entry, which is allocated at team
creation time. It will be inserted into the parent's
{stopped,continued}_children lists as the team's main thread is
stopped/continued and removed when waitpid() retrieves the child
state. When the team dies the entry is detached from the team and goes
into the parent's dead_children list.
* Removed the wait_for_any field from team_dead_children. It was solely
used to avoid deletion of the contained entries in certain situations.
wait_for_child() (the waitpid() backend) always deletes an entry now,
regardless of whether other threads are waiting; that's in
accordance with the waidpid() specification. wait_for_thread() removes
the entry only, if the caller is the parent of the respective team.
* Introduced team_set_job_control_state() which performes the job
control entry transitions between the respective lists and wakes up
threads waiting in wait_for_child(). It is invoked on team death and
when the team's main thread receives job control signals.
* Reorganized wait_for_child(). It handles WCONTINUED and WUNTRACED now,
too. Removed a block that interpreted the supplied ID as thread ID.
* Added missing parts in waitpid().
Job control starts to work, though it seems to have some glitches.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22088 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Added class InterruptsSpinLocker, which disables interrupts and
acquires a spinlock all in one.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22086 a95241bf-73f2-0310-859d-f6bbb57e9c96
variable. Due to C code including the header I had to turn it from and
aggregated member to a pointer. I'm very close to starting to convert
all remaining .c to .cpp files. :-/
* Got rid of the "waiters" field. It was only written, never read.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22084 a95241bf-73f2-0310-859d-f6bbb57e9c96
exists and thread was notified), B_ENTRY_NOT_FOUND (condition variable
not found or Unpublish()ed while waiting), or B_INTERRUPTED
(interrupted by a signal).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22083 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Removed left-over commented C implementation.
* It is now possible for a thread to wait for more than one condition
variable at a time.
* Made waiting for condition variables optionally interruptable.
* Renamed Notify() method to NotifyAll() and added a NotifyOne(), so
that it is now possible to wake up only one of the waiting threads.
Pretty much untested at the moment.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22081 a95241bf-73f2-0310-859d-f6bbb57e9c96
content name are supported.
* Added file_system_module_info::flags (analogously to
partition_module_info::flags) which indicate which disk device
features the FS supports.
* Replaced the
file_system_module_info/partition_module_info::supports_*()
hooks by a get_supported_operations() hook and for partitioning
systems additionally a get_supported_child_operations() hook.
* Updated file and partitioning systems accordingly.
* Updated fs_shell accordingly.
* Updated the DDM accordingly. The syscall interface remains unchanged,
though.
* _user_supports_initializing_partition() also checks whether the parent
partitioning system is content now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22043 a95241bf-73f2-0310-859d-f6bbb57e9c96
* On exec() the new function thread_reset_for_exec() is called which clears the signals
and cancels an eventually set alarm. Both things weren't done before...
* Some minor cleanups.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21989 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Pulled the actual tree code into a non-templatized class AVLTree to
reduce the amount of code generated each time the template is
instantiated.
* Changed the iterator interface to Java-style.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21892 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Removed a few instances where the page state was set busy directly after
allocating it. This is a no-op, since a page is always busy after
allocation.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21875 a95241bf-73f2-0310-859d-f6bbb57e9c96
cheap means to block threads until notified explicitely.
threads
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21874 a95241bf-73f2-0310-859d-f6bbb57e9c96
interrupts) and SpinLocker (acquires/releases spinlocks).
* Adjusted Jamfiles of components that used <util/AutoLock.h> but didn't
add all header directories required now (<int.h> was added).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21873 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Removed the ref_count from vm_areas. You now always need to have the address
space locked (read or write, depending on what you do) when dealing with
areas.
* Added helper classes for locking the address space: AddressSpace{Read|Write}Locker,
and MultiAddressSpaceLocker which can lock several spaces at once and makes
sure no dead locks can happen.
* resize_area() is now using the MultiAddressSpaceLocker instead of no locking
at all; ie. it should now be safely to use.
* Disabled transfer_area() for now; it will be changed to work like an atomic
clone_area()/delete_area(), that is, it will hand out a new ID for the
transfered area.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21848 a95241bf-73f2-0310-859d-f6bbb57e9c96
additional parameters that are fed into a dprintf() before panic() is
invoked.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21838 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Simplified the notification framework: removed the updater stuff completely;
it was only there to account for some peculiarities of the node monitor which
we now solved differently.
* NotificationListener no longer includes a doubly linked list link for convenience;
it might want to listen to more than just one service.
* NotificationService cannot have an abstract destructor.
* Changed the _user_stop_watching() syscall to mirror the Be API; ie. it's no
longer possible to just remove some flags separately, just to stop listening
completely.
* Adapted the node monitor implementation to live in the NodeMonitorService class
that uses the new notification framework.
* Removed the public kernel node monitor API - it wasn't useful that way since you
couldn't do a lot with the KMessage in the kernel without using a private API.
Now you will have to use the (private) notification manager to use the node monitor
from inside the kernel. At a later point, we might introduce a public API for that,
too.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21780 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Added a Current() method to the same class that returns the current element again.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21779 a95241bf-73f2-0310-859d-f6bbb57e9c96
Will be used for node monitoring and other stuff, too (like the Registrar or the
VM low memory handler).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21768 a95241bf-73f2-0310-859d-f6bbb57e9c96
therefore, we could remove the ugly defines from KMessage again, and compile it
with KMESSAGE_CONTAINER_ONLY.
* Added KMessage::SetDeliveryInfo() to be able to send messages with a correct
header.
* Fixed a bug in KMessage::SendTo() that would not send the senderTeam when passing
a negative value for the parameter, but override it when passing in a valid
value.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21740 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Moved method documentation from headers to source files.
* Fixed small problems (memory leaks, unsafe string duplication,...).
* Added TODOs where I spotted problems.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21721 a95241bf-73f2-0310-859d-f6bbb57e9c96
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
compile with _LOADER_MODE defined.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96
* More conditional debug code (wrt page transitions between caches).
* Replaced debugger command cache_chain by a nicer cache_tree.
* While handling a soft fault: When we temporarily unlock a cache, it
can theoretically become busy. One such occurrence is now handled
properly, two more panic() ATM, though should be fixed.
* When merging caches, we do now always replace a dummy page in the
upper cache, not only when the concurrent page fault is a read fault.
This prevents a page from the lower (to be discarded) cache from still
remaining mapped (causing a panic).
* When merging caches and replacing a dummy page, we were trying to
remove the dummy page from the wrong cache (causing a panic).
The Haiku kernel seems now to run shockingly stable. ATM, we have more
than two hours uptime of a system booted and running over network. We
didn't manage to get it down by fully building Pe, downloading, unzipping,
and playing with various stuff. Someone should finally fix all those app
server drawing bugs, though (hint, hint! ;-)).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21672 a95241bf-73f2-0310-859d-f6bbb57e9c96
stack hungry and would previously hit the stack limit and thus cause a
double fault. Hopefully we'll be able to reduce the stack foot print at
some time.
PXE boot does now fully work.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21663 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Images preloaded by the boot loader had to be modules to be of any use
to the kernel. Extended the mechanism so that any images not accepted
by the module code would later be tried to be added as drivers by the
devfs. This is a little hacky ATM, since the devfs manages the drivers
using a hash map keyed by the drivers inode ID, which those drivers
obviously don't have.
* The devfs emulates read_pages() using read(), if the device driver
doesn't implement the former (all old-style drivers), thus making it
possible to BFS, which uses the file cache which in turn requires
read_pages(), on the device. write_pages() emulation is still missing.
* Replaced the kernel_args::boot_disk structure by a KMessage, which can
more flexibly be extended and deals more gracefully with
arbitrarily-size data. The disk_identifier structure still exists,
though. It is added as message field in cases where needed (non net
boot). Moved the boot_drive_number field of the bios_ia32 platform
specific args into the message.
* Made the stage 1 PXE boot loader superfluous. Moved the relevant
initialization code into the stage 2 loader, which can now be loaded
directly via PXE.
* The PXE boot loader does now download a boot tgz archive via TFTP. It
does no longer use the RemoteDisk protocol (it could actually be
removed from the boot loader). It also parses the DHCP options in the
DHCPACK packet provided by PXE and extracts the root path to be
mounted by the kernel.
* Reorganized the boot volume search in the kernel (vfs_boot.cpp) and
added support for network boot. In this case the net stack is
initialized and the network interface the boot loader used is brought
up and configured. Since NBD and RemoteDisk are our only options for
net boot (and those aren't really configurable dynamically) ATM, the
the boot device is found automatically by the disk device manager.
Booting via PXE does work to some degree now. The most grievous problem
is that loading certain drivers or kernel modules (or related activity)
causes a reboot (likely a triple fault, though one wonders where our
double fault handler is on vacation). Namely the keyboard and mouse input
server add-ons need to be deactivated as well as the media server.
A smaller problem is the net server, which apparently tries to
(re-)configure the network interface we're using to boot, which
obviously doesn't work out that well. So, if all this stuff is disabled
Haiku does fully boot, when using the RemoteDisk protocol (not being
able to use keyboard or mouse doesn't make this a particular fascinating
experience, though ;-)). I had no luck with NBD -- it seemed to have
protocol problems with the servers I tried.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21611 a95241bf-73f2-0310-859d-f6bbb57e9c96
with the same size as the class is defined.
* The SetTo() methods do now accept an unspecified (negative) bufferSize
in case of being told to initialize from the given buffer.
* Added handy Get*() methods returning a field element value or a
supplied default value, if the field element doesn't exist.
* Added also handy Set*() methods setting the value of first element of
a field, i.e. adding it, if it didn't exist before, otherwise
replacing the old value. Only for fixed size types.
* Moved _FindType() inline template method into the header.
* Made the source file fit for use in the boot loader. If the macro
KMESSAGE_CONTAINER_ONLY is defined, the message sending/receiving part
is omitted.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21605 a95241bf-73f2-0310-859d-f6bbb57e9c96