summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* - Add sx_descr description member to sx lock structurebmilekic2001-03-061-6/+26
| | | | | | | | | | | | | | | | | - Add sx_xholder member to sx struct which is used for INVARIANTS-enabled assertions. It indicates the thread that presently owns the xlock. - Add some assertions to the sx lock code that will detect the fatal API abuse: xlock --> xlock xlock --> slock which now works thanks to sx_xholder. Notice that the remaining two problematic cases: slock --> xlock slock --> slock (a little less problematic, but still recursion) will need to be handled by witness eventually, as they are more involved. Reviewed by: jhb, jake, jasone
* Implement shared/exclusive locks.jasone2001-03-051-0/+160
| | | | Reviewed by: bmilekic, jake, jhb
* Eliminate the aio_freejobs list. Its purpose was to store freealc2001-03-051-40/+30
| | | | | | | | | | | | | | | | | | | | | aiocb's allocated by zalloc(). In other words, zfree() was never called. Now, we call zfree(). Why eliminate this micro- optimization? At some later point, when we multithread the AIO system, we would need a mutex to synchronize access to aio_freejobs, making its use nearly indistinguishable in cost from zalloc() and zfree(). Remove unnecessary fhold() and fdrop() calls from aio_qphysio(), undo'ing a part of revision 1.86. The reference count on the file structure is already incremented by _aio_aqueue() before it calls aio_qphysio(). (Update the comments to document this fact.) Remove unnecessary casts from _aio_aqueue(), aio_read(), aio_write() and aio_waitcomplete(). Remove an unnecessary "return;" from aio_process(). Add "static" in various places.
* Do not set a default ELF syscall ABI fallback.obrien2001-03-042-6/+8
| | | | | If one runs an un-branded Linux static binary that calls Linux's fcntl the machine will reboot when interupted by the FreeBSD syscall ABI.
* implement OCRNL, ONOCR, and ONLRETassar2001-03-041-1/+11
| | | | Obtained from: NetBSD
* Remove the field privatemodes from struct __aiocb_private and thealc2001-03-041-137/+2
| | | | | | | related code from aio_read() and aio_write(). This field was intended, but never used, to allow a mythical user-level library to make an aio_read() or aio_write() behave like an ordinary read() or write(), i.e., a blocking I/O operation.
* Mismatched MFSNAMELEN and MNAMELEN with fstype / fspath.adrian2001-03-022-4/+4
| | | | Submitted by: Naoki Kobayashi <shibata@geo.titech.ac.jp>
* Ok, the kernel will panic in kmem_malloc() if the kernel map is full, sojhb2001-03-021-4/+0
| | | | | | | malloc with M_WAITOK can't actually return NULL. I wish I could get two people to give me the same answer about this when I ask... Submitted by: jake
* - Check to see if malloc() returned NULL even with M_WAITOK.jhb2001-03-021-1/+6
| | | | | | | - Add a KASSERT() to ensure an ithread has a backing kernel thread when we schedule it. - Don't attempt to preemptively switch to an ithread if p_stat of curproc is not SRUN.
* Reviewed by: jlemonadrian2001-03-014-56/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | An initial tidyup of the mount() syscall and VFS mount code. This code replaces the earlier work done by jlemon in an attempt to make linux_mount() work. * the guts of the mount work has been moved into vfs_mount(). * move `type', `path' and `flags' from being userland variables into being kernel variables in vfs_mount(). `data' remains a pointer into userspace. * Attempt to verify the `type' and `path' strings passed to vfs_mount() aren't too long. * rework mount() and linux_mount() to take the userland parameters (besides data, as mentioned) and pass kernel variables to vfs_mount(). (linux_mount() already did this, I've just tidied it up a little more.) * remove the copyin*() stuff for `path'. `data' still requires copyin*() since its a pointer into userland. * set `mount->mnt_statf_mntonname' in vfs_mount() rather than in each filesystem. This variable is generally initialised with `path', and each filesystem can override it if they want to. * NOTE: f_mntonname is intiailised with "/" in the case of a root mount.
* The kernel did not hold a vnode reference associated with theiedowse2001-02-283-22/+65
| | | | | | | | | | | | | | | | | | | | | | | `rootvnode' pointer, but vfs_syscalls.c's checkdirs() assumed that it did. This bug reliably caused a panic at reboot time if any filesystem had been mounted directly over /. The checkdirs() function is called at mount time to find any process fd_cdir or fd_rdir pointers referencing the covered mountpoint vnode. It transfers these to point at the root of the new filesystem. However, this process was not reversed at unmount time, so processes with a cwd/root at a mount point would unexpectedly lose their cwd/root following a mount-unmount cycle at that mountpoint. This change should fix both of the above issues. Start_init() now holds an extra vnode reference corresponding to `rootvnode', and dounmount() releases this reference when the root filesystem is unmounted just before reboot. Dounmount() now undoes the actions taken by checkdirs() at mount time; any process cdir/rdir pointers that reference the root vnode of the unmounted filesystem are transferred to the now-uncovered vnode. Reviewed by: bde, phk
* Shuffle netgraph mutexes a bit and hold a reference on a nodejulian2001-02-283-6/+6
| | | | from the function that is calling the destructor.
* Fix lockup for loopback NFS mounts. The pipelined I/O limitations could bedillon2001-02-282-9/+7
| | | | | | | | | hit on the client side and prevent the server side from retiring writes. Pipeline operations turned off for all READs (no big loss since reads are usually synchronous) and for NFS writes, and left on for the default bwrite(). (MFC expected prior to 4.3 freeze) Testing by: mjacob, dillon
* Sigh. Try to get priorities sorted out. Don't bother trying tojake2001-02-286-8/+2
| | | | | | | | | | | update native priority, it is diffcult to get right and likely to end up horribly wrong. Use an honestly wrong fixed value that seems to work; PUSER for user threads, and the interrupt priority for ithreads. Set it once when the process is created and forget about it. Suggested by: bde Pointy hat: me
* Correctly declare variables as u_int rather than doing typecasts.jlemon2001-02-271-7/+7
| | | | | | Kill some register declarations while I'm here. Submitted by: bde (1)
* In soshutdown(), use SHUT_{RD,WR,RDWR} instead of FREAD and FWRITE.ru2001-02-271-3/+5
| | | | Also, return EINVAL if `how' is invalid, as required by POSIX spec.
* Cast nfds to u_int before range checking it in order to catch negativejlemon2001-02-271-1/+2
| | | | | | values. PR: 25393
* Initialize native priority to PRI_MAX. It was usually 0 which made ajake2001-02-265-33/+8
| | | | | | | | process's priority go through the roof when it released a (contested) mutex. Only set the native priority in mtx_lock if hasn't already been set. Reviewed by: jhb
* Remove brackets around variables in a function that used to bejake2001-02-253-30/+30
| | | | a macro.
* Make this compile in a.out mode. link.h has extra dependencies for a.out.peter2001-02-252-0/+6
|
* Manually add an extra _ to _DYNAMIC since it is provided by ld, not gcc.peter2001-02-251-3/+3
| | | | Make the rest compile.
* Remove superfluous m_pkthdr.rcv_if = NULL assignment followingbmilekic2001-02-251-2/+0
| | | | m_gethdr() mbuf allocation, which already does this for us.
* Move netgraph spimlock order entries out ofjulian2001-02-253-6/+6
| | | | the #ifdef SMP section. They need to be there for UP too.
* - Rename the lcall system call handler from Xsyscall to Xlcall_syscalljake2001-02-251-3/+3
| | | | | | | | | to be more like Xint0x80_syscall and less like c function syscall(). - Reduce code duplication between the int0x80 and lcall handlers by shuffling the elfags into the right place, saving the sizeof the instruction in tf_err and jumping into the common int0x80 code. Reviewed by: peter
* MFS: bring the consistent `compat_3_brand' support into -CURRENTobrien2001-02-241-8/+12
| | | | | (the work was first done in the RELENG_4 branch near a release during a MFC to make the code cleaner and more consistent)
* Grrr, s/INVARIANTS_SUPPORT/INVARIANT_SUPPORT/.jhb2001-02-243-3/+3
|
* - Axe RETIP() as it was very i386 specific and unwieldy. Instead, use thejhb2001-02-243-39/+36
| | | | | | | | | | | | | | | | | | passed in filename and line number in the KTR tracepoint message. - Even though it is #if 0'd code, change the code to detect that a process is an interrupt thread to check p->p_ithd against NULL rather than checking non-existant process flags from BSD/OS. - Use '%p' to print pointers in KTR log messages instead of assuming sizeof(int) == sizeof(void *). - Don't set p_mtxname to NULL when releasing a mutex. It doesn't hurt to leave it set (we don't clear w_mesg for example) and at least at one time in the past, there used to be race conditions in the kernel that would result in setting this to NULL causing the kernel to dereference NULL. - Make the _mtx_assert() function be compiled in if INVARIANTS_SUPPORT is defined rather than if INVARIANTS is defined so that a KLD compiled with INVARIANTS that uses mtx_assert() can be used with a kernel that just has INVARIANT_SUPPORT compiled in.
* Introduce API for sequential reads/writes (build/dissect) of mbuf chains.bp2001-02-241-0/+549
| | | | | | | Reviewed by: Ian Dowse <iedowse@maths.tcd.ie>, Bosko Milekic <bmilekic@technokratis.com>, Julian Elischer <julian@elischer.org> and arch@/net@ Obtained from: smbfs
* Add knowledge of the netgraph spinlocks into the Witness code.julian2001-02-243-0/+6
| | | | Well, at least I think that's how it's done.
* - Assert that the proc to return is not NULL in runq_choose thejake2001-02-241-0/+2
| | | | | | same as runq_remove. - bzero the whole struct runq in runq_init just in case its not statically allocated.
* It turns out the kernel console works fine and thus doesn't need quite thisjhb2001-02-241-23/+0
| | | | much extra testing.
* Add an EV_SET() convenience macro for initializing struct kevent priorjlemon2001-02-241-1/+1
| | | | | | to the call to kevent(). Update the copyright notices as well.
* Introduce a NOTE_LOWAT flag for use with the read/write filters, whichjlemon2001-02-241-0/+4
| | | | | | | | | | allow the watermark to be passed in via the data field during the EV_ADD operation. Hook this up to the socket read/write filters; if specified, it overrides the so_{rcv|snd}.sb_lowat values in the filter. Inspired by: "Ronald F. Guilmette" <rfg@monkeys.com>
* When returning EV_EOF for the socket read/write filters, also returnjlemon2001-02-241-0/+2
| | | | | | | the current socket error in fflags. This may be useful for determining why a connect() request fails. Inspired by: "Jonathan Graehl" <jonathan@graehl.org>
* Stricter style(9) conformance - remove unnecessary blank lines in previouspeter2001-02-231-2/+0
| | | | commit.
* Fix typo in comment (knode -> knote).jlemon2001-02-231-1/+1
|
* Add a NOTE_REVOKE flag for vnodes, which is triggered from within vclean().jlemon2001-02-232-0/+10
| | | | | | | Use this to tell a filter attached to a vnode that the underlying vnode is no longer valid, by returning EV_EOF. PR: kern/25309, kern/25206
* Test out the kernel console just before launching the AP's.jhb2001-02-231-0/+24
|
* Activate USER_LDT by default. The new thread libraries are going topeter2001-02-231-3/+0
| | | | | | | | depend on this. The linux ABI emulator tries to use it for some linux binaries too. VM86 had a bigger cost than this and it was made default a while ago. Reviewed by: jhb, imp
* Streamline updating of switchtime (don't copy code from kern_sync.c).tegge2001-02-221-4/+2
| | | | Submitted by: jhb
* Backout previous commit. sched_lock is held, thus interrupts are preventedtegge2001-02-221-14/+6
| | | | | | here. Submitted by: jhb
* Protect update of the per processor switchtime variable againsttegge2001-02-222-7/+19
| | | | | | | | | interrupts. Protect usage of the per processor switchtime variable against interrupts in calcru(). This seem to eliminate the "microuptime() went backwards" warnings.
* The p_md.md_regs member of proc is used in signal handling to referencejhb2001-02-221-0/+1
| | | | | | | | | | | | | | | the the original trapframe of the syscall, trap, or interrupt that entered the kernel. Before SMPng, ast's were handled via a psuedo trap at the end of doerti. With the SMPng commit, ast's were broken out into a separate ast() function that was called from doreti to match the behavior of other architectures. Unfortunately, when this was done, the p_md.md_regs member of curproc was not updateda in ast(), thus when signals are handled by userret() after an interrupt that returns to userland, we end up using a stale trapframe that will result in the registers from the old trapframe overwriting the real trapframe and smashing all the registers right before we return to usermode. The saved %cs:%eip from where we were in usermode are saved in the trapframe for example.
* Since the PC is a pointer to a code address, change the second parameter ofjhb2001-02-221-2/+2
| | | | addupc_task() and addupc_intr() to be a uintptr_t instead of a u_long.
* - Change ast() to take a pointer to a trapframe like other architectures.jhb2001-02-221-7/+7
| | | | | | | | - Don't use an atomic operation to update cnt.v_soft in ast(). This is the only place the variable is written to, and sched_lock is always held when it is written, so it is already protected and the mutex release of sched_lock asserts a memory barrier that ensures the value will be updated in a timely fashion.
* - Use TRAPF_PC() on the alpha to acess the PC in the trap frame.jhb2001-02-221-3/+2
| | | | | | | - Don't hold sched_lock around addupc_task() as this apparently breaks profiling badly due to sched_lock being held across copyin(). Reported by: bde (2)
* Add a mtx_assert() in maybe_resched() just to be sure it's always calledjhb2001-02-221-0/+1
| | | | with sched_lock held.
* Lock need_resched with sched_lock.jhb2001-02-221-2/+7
| | | | Reported by: des
* Work around a race condition where an interrupt handler can be removed fromjhb2001-02-221-3/+34
| | | | | | | | | | | an interrupt thread while the interrupt thread is blocked on Giant waiting to execute the interrupt handler being removed. The result was that the intrhand structure would be free'd, and we would call 0xdeadc0de. The work around is to check to see if the interrupt thread is idle when removing a handler. If not, then we mark the interrupt handler as being dead using the new IH_DEAD flag and don't remove it from the interrupt threads' list of handlers. When the interrupt thread resumes, it will see a dead handler while traversing the list of handlers and will remove the handler then.
* Just use the ithread->it_proc directly in a KTR tracepoint instead ofjhb2001-02-221-2/+1
| | | | | | | assigning a local var to it and using it, as otherwise the local var wasn't used, and generated a warning in the !KTR case. Noticed by: bde
OpenPOWER on IntegriCloud