summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* If AF_LOCAL is used, we need to use __msgread_withcred() instead ofmbr2003-05-281-1/+6
| | | | | | | | | just read() in non-blocking mode too. The reason is obvious. NetBSD uses a complete different way to get the credentials so this patch only applies to FreeBSD. Reviewed by: rwatson Approved by: re
* Fix amd(8) clients, if a FreeBSD mountd(8) server is used.mbr2003-05-281-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Remove the special treatment of non-blocking mode in the "look ahead function" xdrrec_eof(). It currently assumes that the last read() in a row of several reads does not have zero lenght. If this is the case, svc_vc_stat() does return XPRT_MOREREQS, and the RPC-request aborts because there is no data to read anymore. To fix this, go back to the original version of the code for non-blocking mode until NetBSD comes up with another possible fix like this one in xdrrec_eof() if (rstrm->last_frag && rstrm->in_finger == rstrm->in_boundry) { return TRUE; } Return always FALSE in set_input_fragment() for non-blocking mode. Since this was not used in FreeBSD, I omitted it at the first time. Now we use this function and we should always return FALSE for it. Reviewed by: rwatson Approved by: re
* Fix stripping last path component when only one path component left.fjoe2003-05-281-2/+2
| | | | | PR: 52686 MFC after: 1 day
* Minimize the potential for deadlocks between an exiting thread and it'smtm2003-05-271-2/+18
| | | | | | | | joiner by making sure all locks and unlocks occur in the same order. For the record the lock order is: DEAD_LIST, THREAD_LIST, exiting thread, joiner thread. Approved by: re/rwatson
* Revert part of the last commit. I don't know what I was smoking.mtm2003-05-271-2/+13
| | | | Approved by: re/rwatson
* Decouple the thread stack [de]allocating functions from the 'dead threads list'mtm2003-05-264-7/+16
| | | | | | | lock. It's not really necessary and we don't need the added complexity or potential for deadlocks. Approved by: re/blanket libthr
* Revise the unlock order in _pthread_join(). Also, if the joinedmtm2003-05-261-12/+6
| | | | | | | | thread is not dead, the join loop is guaranteed to execute at least once, so there is no need to pick up the thread list lock after we return from suspenstion only to release it after the loop. Approved by: re/blanket libthr
* Return gracefully, rather than aborting, when the maximum concurrentmtm2003-05-256-10/+27
| | | | | | threads per process has been reached. Return EAGAIN, as per spec. Approved by: re/blanket libthr
* _pthread_cancel() breaks the normal lock order of first locking themtm2003-05-253-4/+28
| | | | | | | | | | | | | joined and then the joiner thread. There isn't an easy (sane?) way to make it use the correct order without introducing races involving the target thread and finding which (active or dead) list it is on. So, after locking the canceled thread it will try to lock the joined thread and if it fails release the first lock and try again from the top. Introduce a new function, _spintrylock, which is simply a wrapper arround umtx_trylock(), to help accomplish this. Approved by: re/blanket libthr
* Part of the last patch.mtm2003-05-252-9/+9
| | | | | | | Modify the thread creation and thread searching routine to lock the thread lists with the new locks instead of GIANT_LOCK. Approved by: re/blanket libthr
* Start locking up the active and dead threads lists. The active threadsmtm2003-05-257-127/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | list is protected by a spinlock_t, but the dead list uses a pthread_mutex because it is necessary to synchronize other threads with the garbage collector thread. Lock/Unlock macros are used so it's easier to make changes to the locks in the future. The 'dead thread list' lock is intended to replace the gc mutex. This doesn't have any practical ramifications. It simply makes it clearer what the purpose of the lock is. The gc will use this lock, instead of the gc mutex, to synchronize access to the dead list with other threads. Modify _pthread_exit() to use these two new locks instead of GIANT_LOCK, and also to properly lock and protect thread state changes, especially with respect to a joining thread. The gc thread was also re-arranged to be more organized and less nested. _pthread_join() was also modified to use the thread list locks. However, locking and unlocking here needs special care because a thread could find itself in a position where it's joining an exiting thread that is waiting on the dead list lock, which this thread (joiner) holds. If the joiner doesn't take care to lock *and* unlock in the same order they (the joiner and the joinee) could deadlock against each other. Approved by: re/blanket libthr
* The libthr code makes use of higher-level primitives (pthread_mutex_t andmtm2003-05-252-0/+14
| | | | | | | | | | | | | pthread_cond_t) internaly in addition to the low-level spinlock_t. The garbage collector mutex and condition variable are two such examples. This might lead to critical sections nested within critical sections. Implement a reference counting mechanism so that signals are masked only on the first entry and unmasked on the last exit. I'm not sure I like the idea of nested critical sections, but if the library is going to use the pthread primitives it might be necessary. Approved by: re/blanket libthr
* The struct mcontext has changed. It's using the register sets. Bringmarcel2003-05-251-1/+1
| | | | this in line.
* mdoc(7) fixes.ru2003-05-244-30/+38
| | | | Approved by: re (blanket)
* Repair PIC mode. It seems I was a bit too excited about thepeter2003-05-247-15/+89
| | | | implications of native PC relative addressing.
* Change low-level locking a bit so that we can tell ifdeischen2003-05-2424-314/+594
| | | | | | | | | | | | | | | | | | | | | | | | | | a lock is being waitied on. Fix a races in join and cancellation. When trying to wait on a CV and the library is not yet threaded, make it threaded so that waiting actually works. When trying to nanosleep() and we're not threaded, just call the system call nanosleep instead of adding the thread to the wait queue. Clean up adding/removing new threads to the "all threads queue", assigning them unique ids, and tracking how many active threads there are. Do it all when the thread is added to the scheduling queue instead of making pthread_create() know how to do it. Fix a race where a thread could be marked for signal delivery but it could be exited before we actually add the signal to it. Other minor cleanups and bug fixes. Submitted by: davidxu Approved by: re@ (blanket for libpthread)
* Lock the cond queue (condition variables):mtm2003-05-241-70/+43
| | | | | | | | | | | | | | | | Access to the thread's flags and state is protected by _thread_critical_enter/exit(). When a thread is signaled with a condition its state must be protected by locking it and disabling signals before it is taken of the waiters' queue. Move the implementation of pthread_cond_signal() and pthread_cond_broadcast() into one function, cond_signal(). Its behaviour is determined by the last argument, int broadcast. If this is set to 1 it will remove all waiters, otherwise it will wake up only the first waiter thread. Remove an extraneous call to pthread_testcancel(). Approved by: re/blanket libthr
* Add two functions: _spinlock_pthread() and _spinunlock_pthread()mtm2003-05-233-4/+20
| | | | | | | | | | that take the address of a struct pthread as their first argument. _spin[un]lock() just become wrappers arround these two functions. These new functions are for use in situations where curthread can't be used. One example is _thread_retire(), where we invalidate the array index curthread uses to get its pointer.. Approved by: re/blanket libthr
* EDOOFUSmtm2003-05-232-10/+3
| | | | | | | | Prevent one thread from messing up another thread's saved signal mask by saving it in struct pthread instead of leaving it as a global variable. D'oh! Approved by: re/blanket libthr
* Make WARNS2 clean. The fixes mostly included:mtm2003-05-2316-10/+41
| | | | | | | | o removed unused variables o explicit inclusion of header files o prototypes for externally defined functions Approved by: re/blanket libthr
* note to self: do not confuse void* with int.mtm2003-05-231-1/+1
| | | | Approved by: re/blanket libthr
* Fix two misuses of __BSD_VISIBLE.mike2003-05-221-2/+2
| | | | | Submitted by: bde Approved by: re
* Assorted mdoc(7) fixes.ru2003-05-2216-89/+98
| | | | Approved by: re (blanket)
* o Make the defenition of _set_curthread() match its declarationmtm2003-05-211-5/+27
| | | | | | | | | | | | in thr_private.h o Lock down the ldt_entries array and ldt_free, which points to the next free slot. As noted in the comments, it's necessary to special case the initial_thread because %gs is not setup for it yet. This is ok because that early in the program there won't be any reentrancy issues anyways. Approved by: re/blanket libthr
* Insert a debugging aid:mtm2003-05-212-2/+18
| | | | | | | | When in either the mutex or cond queue we notice that the thread is already on one of the queues, don't just simply abort(). Print out the thread's identifiers and what queue it was on. Approved by: markm/mentor, re/blanket libthr
* Re-enable the garbage collector thread in anticipation of furthermtm2003-05-211-2/+0
| | | | | | | locking work. I can't see anything obviously wrong with it (other than the need to update the locking). Approved by: markm/mentor, re/blanket libthr
* When a thread exits it does not return from the kernel unless itmtm2003-05-211-0/+4
| | | | | | | is the *only* remaining thread in the application, in which case we should not core dump, and instead exit gracefully. Approved by: markm/mentor, re/blanket libthr
* The thread id was being set *before* zeroing out the thread. Reversemtm2003-05-211-2/+3
| | | | | | the order. Approved by: markm/mentor, re/blanket libthr
* Move a misplaced comment.mtm2003-05-201-1/+1
| | | | Approved by: markm/mentor (implicit), re/blanket libthr
* Eek, staticize a couple of functions that shouldn'tdeischen2003-05-197-47/+45
| | | | | | | | | | | | be external (initialize()!). Remove cancellation points from _pthread_cond_wait and _pthread_cond_timedwait (single underscore versions are libc private functions). Point the weak reference(!) for these functions to the versions with cancellation points. Approved by: re@(blanket till 5/19) Pointed out by: kan (cancellation point bug)
* Retire the useless NOSECURE knob.des2003-05-194-8/+5
| | | | Approved by: re (scottl)
* Fixed troff(1) and mdoc(7) warnings.ru2003-05-184-5/+6
| | | | Approved by: re (blanket)
* Fix a simple bug that prevents svc_tli_create to bind to the addressmbr2003-05-181-1/+1
| | | | | | | | | | specified by caller. NetBSD rev. 1.6 Reviewed by: rwatson Approved by: rwatson (re) Obtained from: NetBSD
* Moved libgeom.so dependencies to where they belong.ru2003-05-171-0/+3
| | | | | Reviewed by: phk Approved by: re (scottl)
* Revamp of the syscall path, exception and context handling. Themarcel2003-05-164-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | prime objectives are: o Implement a syscall path based on the epc inststruction (see sys/ia64/ia64/syscall.s). o Revisit the places were we need to save and restore registers and define those contexts in terms of the register sets (see sys/ia64/include/_regset.h). Secundairy objectives: o Remove the requirement to use contigmalloc for kernel stacks. o Better handling of the high FP registers for SMP systems. o Switch to the new cpu_switch() and cpu_throw() semantics. o Add a good unwinder to reconstruct contexts for the rare cases we need to (see sys/contrib/ia64/libuwx) Many files are affected by this change. Functionally it boils down to: o The EPC syscall doesn't preserve registers it does not need to preserve and places the arguments differently on the stack. This affects libc and truss. o The address of the kernel page directory (kptdir) had to be unstaticized for use by the nested TLB fault handler. The name has been changed to ia64_kptdir to avoid conflicts. The renaming affects libkvm. o The trapframe only contains the special registers and the scratch registers. For syscalls using the EPC syscall path no scratch registers are saved. This affects all places where the trapframe is accessed. Most notably the unaligned access handler, the signal delivery code and the debugger. o Context switching only partly saves the special registers and the preserved registers. This affects cpu_switch() and triggered the move to the new semantics, which additionally affects cpu_throw(). o The high FP registers are either in the PCB or on some CPU. context switching for them is done lazily. This affects trap(). o The mcontext has room for all registers, but not all of them have to be defined in all cases. This mostly affects signal delivery code now. The *context syscalls are as of yet still unimplemented. Many details went into the removal of the requirement to use contigmalloc for kernel stacks. The details are mostly CPU specific and limited to exception_save() and exception_restore(). The few places where we create, destroy or switch stacks were mostly simplified by not having to construct physical addresses and additionally saving the virtual addresses for later use. Besides more efficient context saving and restoring, which of course yields a noticable speedup, this also fixes the dreaded SMP bootup problem as a side-effect. The details of which are still not fully understood. This change includes all the necessary backward compatibility code to have it handle older userland binaries that use the break instruction for syscalls. Support for break-based syscalls has been pessimized in favor of a clean implementation. Due to the overall better performance of the kernel, this will still be notived as an improvement if it's noticed at all. Approved by: re@ (jhb)
* Add a method of yielding the current thread with the schedulerdeischen2003-05-1628-628/+686
| | | | | | | | | | | | | | | | | | | | | | | lock held (_thr_sched_switch_unlocked()) and use this to avoid dropping the scheduler lock and having the scheduler retake the same lock again. Add a better way of detecting if a low-level lock is in use. When switching out a thread due to blocking in the UTS, don't switch to the KSE's scheduler stack only to switch back to another thread. If possible switch to the new thread directly from the old thread and avoid the overhead of the extra context switch. Check for pending signals on a thread when entering the scheduler and add them to the threads signal frame. This includes some other minor signal fixes. Most of this was a joint effor between davidxu and myself. Reviewed by: davidxu Approved by: re@ (blanket for libpthread)
* Catch up with the renaming of the "union" filesystem to "unionfs".tjr2003-05-161-1/+1
| | | | | | | Fixes a problem where directory entries could show up twice: once on the top layer of the union stack, and once on the bottom layer. Approved by: re (rwatson)
* Do some cleanup with respect to condition variables. The implementationmtm2003-05-151-15/+14
| | | | | | | | | | | | of pthread_cond_timedwait() is moved into cond_wait_common(). Pthread_cond_wait() and pthread_cond_timedwait() are now wrappers around this function. Previously, the former called the latter with the abstime pointing to 0 time. This violated Posix semantics should an application have reason to call it with that argument because instead or returning immediately it would have waited indefinitely for the cv to be signaled. Approved by: markm/mentor, re/blanket libthr Reviewed by: jeff
* o Make the setting/checking of cancel state atomic withmtm2003-05-151-87/+111
| | | | | | | | | | | | | | respect to other threads and signal handlers by moving to the _thread_critical_enter/exit functions. o Introduce an static function, testcancel(), that is used by the other functions in this module. This allows it to make locking assumptions that the top-level functions can't. o Rework the code flow a bit to reduce indentation levels. Approved by: markm/mentor, re/blanket libthr Reviewed by: jeff
* s/procsig/sigacts/ to catch up to procsig and sigacts changes in the kernel.jhb2003-05-141-10/+6
| | | | Approved by: re (scottl)
* Bandaid for world. jhb gets the pointy hat here and he needs to look atpeter2003-05-141-0/+4
| | | | | | this. Approved by: re (scottl)
* * The copy of the stat struct in the man page has rotted, so remove it.dougb2003-05-131-29/+2
| | | | | | | | Those who really need this information can find it in the include file. * Include a succinct description of the st_birthtime field. Approved by: re (bmah)
* Following MLINKS added, which point to host_access(3):hmp2003-05-121-0/+2
| | | | | | | | | - hosts_ctl(3), hosts_access(3), request_init(3), request_set(3). PR: docs/52000 Submitted by: Simon L. Nielsen <simon@nitro.dk> Approved and Reviewed by: des (mentor), re (scottl)
* msg2mtm2003-05-121-7/+7
|
* msg1mtm2003-05-123-263/+181
|
* Update ldexp.c for amd64.peter2003-05-102-7/+1
|
* Add a comment describing why it's important for the values in thisdas2003-05-086-0/+42
| | | | | | file to be correct, and how to generate them automatically. Caused much pain and suffering for: peter
* SIG_SETMASK is 3, not 1. Sigh.peter2003-05-081-1/+1
|
* Fix an embarresing transcription error from i386 to amd64. Put the argumentspeter2003-05-082-13/+12
| | | | | to sigprocmask(2) int the correct order. *blush*. For sigsetjmp(), match up the pushq/popq in the non-savemask case.
* Tidy up modf.S and make it actually work. It wasn't extractingpeter2003-05-081-16/+13
| | | | | the value out of ST(0) before copying it to %xmm0. Also remove bogus stack frame and work in the red zone.
OpenPOWER on IntegriCloud