summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Make sure to wake up any select waiters when closing a kqueue (also, notgreen2004-02-201-0/+4
| | | | | | | crash). I am fairly sure that only people with SMP and multi-threaded apps using kqueue will be affected by this, so I have a stress-testing program on my web site: <URL:http://green.homeunix.org/~green/getaddrinfo-pthreads-stresstest.c>
* Tidy up the thread taskqueue implementation and close a lost wakeup race.jhb2004-02-191-14/+9
| | | | | | | Instead of creating a mutex that we msleep on but don't actually lock when doing the corresponding wakeup(), in the kthread, lock the mutex associated with our taskqueue and msleep while the queue is empty. Assert that the queue is locked when the callback function is called to wake the kthread.
* Rework jail_attach(2) so that an already jailed process cannot hopnectar2004-02-191-12/+12
| | | | | | to another jail. Submitted by: rwatson
* Added sysctl security.jail.jailed.pjd2004-02-191-0/+13
| | | | | | | | | | | | It returns 1 is process is inside of jail and 0 if it is not. Information if we are in jail or not is not a secret, there is plenty of ways to discover it. Many people are using own hack to check this and this will be a legal way from now on. It will be great if our starting scripts will take advantage of this sysctl to allow clean "boot" inside jail. Approved by: rwatson, scottl (mentor)
* Simplify check. We are only able to check exclusive lock and ifpjd2004-02-191-1/+5
| | | | | | 2nd condition is true, first one is true for sure. Approved by: jhb, scottl (mentor)
* When reparenting a process in the PT_DETACH code, only set p_sigparenttruckman2004-02-191-1/+2
| | | | | | to SIGCHLD if the new parent process is initproc. MFC after: 2 weeks
* A Linux thread created using clone() should not send SIGCHLD to itstruckman2004-02-191-3/+3
| | | | | | | parent if no signal is specified in the clone() flags argument. PR: 42457 MFC after: 2 weeks
* Add support for 'h' and 'hh' modifiers for printf(9).njl2004-02-191-2/+21
| | | | | Submitted by: Bruno Ducrot <ducrot AT poupinou.org> Reviewed by: bde
* Don't ignore errors from vfs_allocate_syncvnode.cperciva2004-02-181-1/+1
| | | | | | PR: kern/18503 Submitted by: Anatoly Vorobey <mellon@pobox.com> Approved by: rwatson (mentor)
* Checkpoint a hack to enable running i386 libc_r binaries on a 64 bitpeter2004-02-181-4/+22
| | | | | | kernel. I'm not happy with it yet - refinements are to come. This hack allows the kern.ps_strings and kern.usrstack sysctls to respond to a 32 bit request, such as those coming from emulated i386 binaries.
* Correct a comment.dwmalone2004-02-172-2/+2
| | | | Reviewed by: alfred, tanimura
* Mechanical whistespace cleanup.des2004-02-171-19/+19
|
* Don't bother storing a result when all you need are the side effects.des2004-02-161-5/+5
|
* In fdcheckstd the descriptor table should never be shared, so justdwmalone2004-02-151-9/+7
| | | | | KASSERT this rather than trying to deal with what happens when file descriptors change out from under us.
* Fixed style bugs near previous commit (mainly formatting errors andbde2004-02-151-16/+13
| | | | | | missing parentheses). Use default handling (trap to debugger) for udev2dev(x, 1) since it is an error and doesn't happen anywhere in the sys tree except in bogusly commented out code in coda.
* Remove opv_desc_vector from vfs_add_vnodeops, since it is definedcperciva2004-02-151-2/+0
| | | | | | | | and given a value, but never used. This has no effect on the resulting binaries, since gcc optimizes the variable away anyway. PR: kern/62684 Approved by: rwatson (mentor)
* Split the initialization of the cdevsw into a separate function.phk2004-02-151-7/+14
|
* Remove excess brackets.rwatson2004-02-151-3/+2
|
* Use standard style for cdevsw initialization.phk2004-02-141-5/+5
|
* By default, don't allow processes in a jail to list the set ofrwatson2004-02-141-0/+7
| | | | | jails in the system. Previous behavior (allowed) may be restored by setting security.jail.list_allowed=1.
* Fix mismerge in last commit: check that cred->cr_prison is NULLrwatson2004-02-141-1/+1
| | | | before dereferencing the prison pointer.
* By default, when a process in jail calls getfsstat(), only return therwatson2004-02-143-0/+36
| | | | | | | | data for the file system on which the jail's root vnode is located. Previous behavior (show data for all mountpoints) can be restored by setting security.jail.getfsstatroot_only to 0. Note: this also has the effect of hiding other mounts inside a jail, such as /dev, /tmp, and /proc, but errs on the side of leaking less information.
* Remove the check which used to protect us against make_dev() beingphk2004-02-141-19/+0
| | | | | | called until DEVFS had a chance to initialize. Since DEVFS is mandatory and things over in that department coincidentally works from without any initialization now, this is safe.
* T -CURRENT DO NOT CRASH UPON ^T K PLZ THX.green2004-02-141-1/+2
| | | | Also, use sched_pctcpu() instead of assuming td->td_kse is non-NULL.
* Always socantsendmore() before deallocating a socket. This, in turn,green2004-02-121-0/+7
| | | | | | | calls selwakeup() if necessary (which it is, if you don't want freed memory hanging around on your td->td_selq). Props to: alfred
* When reparenting a process to init, make sure that p_sigparent istruckman2004-02-112-0/+2
| | | | | | | | | set to SIGCHLD. This avoids the creation of orphaned Linux-threaded zombies that init is unable to reap. This can occur when the parent process sets its SIGCHLD to SIG_IGN. Fix a similar situation in the PT_DETACH code. Tested by: "Steven Hartland" <killing AT multiplay.co.uk>
* Argh! Fix a bogon. lim_cur() was returning the hard (max) limit ratherjhb2004-02-111-1/+1
| | | | | | than the soft (cur) limit. Submitted by: bde
* Add the SF_NODISKIO flag to sendfile. This flag causes sendfile to besilby2004-02-081-19/+22
| | | | | | | | | | | | | | | mindful of blocking on disk I/O and instead return EBUSY when such blocking would occur. Results from the DeBox project indicate that blocking on disk I/O can slow the performance of a kqueue/poll based webserver. Using a flag such as SF_NODISKIO and throwing connections that would block to helper processes/threads helped increase performance. Currently, only the Flash webserver uses this flag, although it could probably be applied to thttpd with relative ease. Idea by: Yaoping Ruan & Vivek Pai
* swp_pager_async_iodone() no longer requires Giant. Modify bufdone()alc2004-02-071-1/+0
| | | | | | and swapgeom_done() to perform swp_pager_async_iodone() without Giant. Reviewed by: tegge
* - Convert the plimit lock to a pool mutex lock.jhb2004-02-061-3/+3
| | | | | | - Hide struct plimit from userland. Submitted by: bde (2)
* - Correct the translation of old rlimit values to properly handle the oldjhb2004-02-061-21/+28
| | | | | | | | | | | | | RLIM_INFINITY case for ogetrlimit(). - Use %jd and intmax_t to output negative time in usec in calcru(). - Rework getrusage() to make a copy of the rusage struct into a local variable while holding Giant and then do the copyout from the local variable to avoid having to have the original process rusage struct locked while doing the copyout (which would not be safe). This also includes a few style fixes from Bruce to getrusage(). Submitted by: bde (1, parts of 3) Suggested by: bde (2)
* A few more style fixes from Bruce including a few I missed last time.jhb2004-02-061-18/+12
| | | | Submitted by: bde
* Always set a process' state to normal when it is fully constructed injhb2004-02-052-6/+9
| | | | | fork1() rather than only doing it for the RFSTOPPED case and then having to fix it up in other places later on.
* - A lot of style and whitespace fixes.jhb2004-02-051-60/+53
| | | | | | - Update a few comments regarding locking notes. Submitted by: bde (1, mostly)
* Correct a reference counting bug in shmat(2). If vm_map_find(9)nectar2004-02-051-0/+1
| | | | | | | | failed, the reference count for the virtual memory object referenced by the specified shared memory segment would have been erroneously incremented. Reported by: Joost Pol <joost@pine.nl>
* Rename cn_unavailable to cnunavailable for little more consistency.kan2004-02-051-14/+2
| | | | | | Garbage collect unused cndebug() function. Suggested by: bde
* Style fixes: don't indent variable names.silby2004-02-051-6/+6
| | | | Submitted by: bde
* Eliminate global cons_unavailable flag and replace it by the statuskan2004-02-051-3/+42
| | | | | bit maintained on a per-device basis. Single variable is inadequate on machines running with multiple consoles enabled.
* Locking for the per-process resource limits structure.jhb2004-02-0414-123/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - struct plimit includes a mutex to protect a reference count. The plimit structure is treated similarly to struct ucred in that is is always copy on write, so having a reference to a structure is sufficient to read from it without needing a further lock. - The proc lock protects the p_limit pointer and must be held while reading limits from a process to keep the limit structure from changing out from under you while reading from it. - Various global limits that are ints are not protected by a lock since int writes are atomic on all the archs we support and thus a lock wouldn't buy us anything. - All accesses to individual resource limits from a process are abstracted behind a simple lim_rlimit(), lim_max(), and lim_cur() API that return either an rlimit, or the current or max individual limit of the specified resource from a process. - dosetrlimit() was renamed to kern_setrlimit() to match existing style of other similar syscall helper functions. - The alpha OSF/1 compat layer no longer calls getrlimit() and setrlimit() (it didn't used the stackgap when it should have) but uses lim_rlimit() and kern_setrlimit() instead. - The svr4 compat no longer uses the stackgap for resource limits calls, but uses lim_rlimit() and kern_setrlimit() instead. - The ibcs2 compat no longer uses the stackgap for resource limits. It also no longer uses the stackgap for accessing sysctl's for the ibcs2_sysconf() syscall but uses kernel_sysctl() instead. As a result, ibcs2_sysconf() no longer needs Giant. - The p_rlimit macro no longer exists. Submitted by: mtm (mostly, I only did a few cleanups and catchups) Tested on: i386 Compiled on: alpha, amd64
* Rename iov_to_uio to uiofromiov to be more consistent with othersilby2004-02-042-2/+2
| | | | | | uio* functions. Suggested by: bde
* Allow assert that the current thread does not hold the sx(9) lock.pjd2004-02-041-0/+11
| | | | | | Reviewed by: jhb In cooperation with: juli, jhb Approved by: jhb, scottl (mentor)
* Style fixessilby2004-02-042-35/+29
| | | | Submitted by: bde
* A variety of further cleanups to ttyinfo():rwatson2004-02-041-77/+84
| | | | | | | | | | | | | | | | | | | | | | | | | - Rename temporary variable names ("tmp", "tmp2") to more informative names ("load", "pctcpu", "rss", ...) - Unclutter indentation and return paths: rather than lots of nested ifs, simply return earlier if it's not going to work out. Simplify general structure and avoid "deep" code. - Comment on the thread/process selection and locking. - Correct handling of "running"/"runnable" states, avoid "unknown" that people were seeing for running processes. This was due to a misunderstanding of the more complex state machine / inhibitors behavior of KSE. - Do perform ttyinfo() printing on KSE (P_SA) processes, it seems generally to work. While I initially attempted to formulate this as two commits (one layout, the other content), I concluded that the layout changes were really structural changes. Many elements submitted by: bde
* Remove a bogus assertion.jhb2004-02-031-1/+0
| | | | | Noticed by: bde Pointy hat to: jhb
* Regen after adding ksem_timedwait().deischen2004-02-032-2/+4
|
* Add ksem_timedwait() to complement ksem_wait().deischen2004-02-032-6/+62
| | | | Glanced at by: alfred
* Don't dec/inc the amountpipes counter every time we resize a pipe --rwatson2004-02-031-2/+3
| | | | | | | | | | instead, just dec/inc in the ctor/dtor. For now, increment/decrement in two's, since we're now performing the operation once per pair, not once per pipe. Not really any measurable performance change in my micro-benchmarks, but doing less work is good, especially when it comes to atomic operations. Suggested by: alc
* Catch instances of (pipe == NULL) that were obsoleted with recentrwatson2004-02-031-6/+6
| | | | | | | | changes to jointly allocated pipe pairs. Replace these checks with pipe_present checks. This avoids a NULL pointer dereference when a pipe is half-closed. Submitted by: Peter Edwards <peter.edwards@openet-telecom.com>
* - Assert that witness_cold is not true in enroll().jhb2004-02-021-1/+2
| | | | | | - Only check witness_watch once in enroll(). Reported by: ru (2)
* Fix many issues related to mount/unmount:pjd2004-02-021-8/+33
| | | | | | | | | | | | | | | | | | | | | 1. Root from inside a jail was able to unmount any file system (except /). 2. Unprivileged root was able to unmount file systems mounted by privileged root (execpt /). 3. User from inside a jail was able to mount file system when sysctl vfs.usermount was set to 1. 4. User was able to mount file system when vfs.usermount was set to 1 (that's ok) and unmount it even if vfs.usermount was equal to 0 (that's not correct). Possibility from point 1 was reported by: Dariusz Kowalski <darek@76.pl> Only a part of this fix will be MFC'ed (if approved). PR: kern/60149 Reviewed by: rwatson Approved by: scottl (mentor) MFC after: 3 days
OpenPOWER on IntegriCloud