summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* - When a mutex is destroyed while locked we need to inform lock profilingjeff2009-03-141-0/+1
| | | | that it has been released.
* - Call lock_profile_release when we're transitioning a lock to be owned byjeff2009-03-141-1/+3
| | | | | | LK_KERNPROC. Discussed with: attilio
* - Fix an error that occurs when mp_ncpu is an odd number. steal_threshjeff2009-03-141-4/+9
| | | | | | | | | | | | | | is calculated as 0 which causes errors elsewhere. Submitted by: KOIE Hidetaka <koie@suri.co.jp> - When sched_affinity() is called with a thread that is not curthread we need to handle the ON_RUNQ() case by adding the thread to the correct run queue. Submitted by: Justin Teller <justin.teller@gmail.com> MFC after: 1 Week
* Implement new way of branding ELF binaries by looking to adchagin2009-03-131-51/+101
| | | | | | | | | | | | ".note.ABI-tag" section. The search order of a brand is changed, now first of all the ".note.ABI-tag" is looked through. Move code which fetch osreldate for ELF binary to check_note() handler. PR: 118473 Approved by: kib (mentor)
* 1) Check NULL pointer before calling umtx_pi_adjust_locked(), this avoidsdavidxu2009-03-131-24/+26
| | | | | | a PANIC. 2) Rework locking for POSIX priority-mutex, this fixes a race where a thread may wait there forever even if the mutex is unlocked.
* Change the sysctls for maxbcache and maxswzone from int to long. I missedjhb2009-03-121-2/+2
| | | | this earlier since these sysctls don't exist in 7.x yet.
* Export the current values of nbuf, ncallout, and nswbuf via read-onlyjhb2009-03-121-0/+6
| | | | | | sysctls that match the tunable names. MFC after: 3 days
* Ensure that the semaphore value is re-checked after sem_lockbms2009-03-121-1/+1
| | | | | | | | is re-acquired, after the condition variable is signalled. PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545 MFC after: 5 days Reviewed by: attilio
* Make semaphore debugging output more useful.bms2009-03-121-2/+8
| | | | | | PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545 MFC after: 5 days Submitted by: Philip Semanchuk
* When writing out updated pollfd records when returning fromrwatson2009-03-111-1/+22
| | | | | | | | | | | | | | | | | poll(), only copy out the revents field, not the whole pollfd structure. Otherwise, if the events field is updated concurrently by another thread, that update may be lost. This issue apparently causes problems for the JDK on FreeBSD, which expects the Linux behavior of not updating all fields (somewhat oddly, Solaris does not implement the required behavior, but presumably our adaptation of the JDK is based on the Linux port?). MFC after: 2 weeks PR: kern/130924 Submitted by: Kurt Miller <kurt @ intricatesoftware.com> Discussed with: kib
* Add a new type of KTRACE record for sysctl(3) invocations. It uses thejhb2009-03-112-2/+49
| | | | | | | | internal sysctl_sysctl_name() handler to map the MIB array to a string name and logs this name in the trace log. This can be useful to see exactly which sysctls a thread is invoking. MFC after: 1 month
* Gah, fix the code to match the comment. For non-open lookups use ajhb2009-03-111-1/+1
| | | | | | shared vnode lock for the leaf vnode if LOCKSHARED is set. Submitted by: rdivacky
* Add a new internal mount flag (MNTK_EXTENDED_SHARED) to indicate that ajhb2009-03-113-8/+50
| | | | | | | | | | | | | | | | | | | | | | | | filesystem supports additional operations using shared vnode locks. Currently this is used to enable shared locks for open() and close() of read-only file descriptors. - When an ISOPEN namei() request is performed with LOCKSHARED, use a shared vnode lock for the leaf vnode only if the mount point has the extended shared flag set. - Set LOCKSHARED in vn_open_cred() for requests that specify O_RDONLY but not O_CREAT. - Use a shared vnode lock around VOP_CLOSE() if the file was opened with O_RDONLY and the mountpoint has the extended shared flag set. - Adjust md(4) to upgrade the vnode lock on the vnode it gets back from vn_open() since it now may only have a shared vnode lock. - Don't enable shared vnode locks on FIFO vnodes in ZFS and UFS since FIFO's require exclusive vnode locks for their open() and close() routines. (My recent MPSAFE patches for UDF and cd9660 already included this change.) - Enable extended shared operations on UFS, cd9660, and UDF. Submitted by: ups Reviewed by: pjd (ZFS bits) MFC after: 1 month
* Minor nits notice by jhb@imp2009-03-111-3/+2
|
* - Make maxpipekva a signed long rather than an unsigned long as overflowjhb2009-03-102-7/+7
| | | | | | | is more likely to be noticed with signed types. - Make amountpipekva a long as well to match maxpipekva. Discussed with: bde
* In the ABI shim for vfs.bufspace, rather than truncating values larger thanjhb2009-03-101-1/+4
| | | | | | | INT_MAX to INT_MAX, just go ahead and write out the full long to give an error of ENOMEM to the user process. Requested by: bde
* - Remove a recently added comment from kernel_sysctlbyname() that isn'tjhb2009-03-101-9/+1
| | | | | | | | | needed. - Move the release of the sysctl sx lock after the vsunlock() in userland_sysctl() to restore the original memlock behavior of minimizing the amount of memory wired to handle sysctl requests. MFC after: 1 week
* Add an ABI compat shim for the vfs.bufspace sysctl for sysctl requests thatjhb2009-03-101-0/+27
| | | | | try to fetch it as an int rather than a long. If the current value is greater than INT_MAX it reports a value of INT_MAX.
* Adjust some variables (mostly related to the buffer cache) that holdjhb2009-03-093-40/+47
| | | | | | | | | | | | | | | | | | | address space sizes to be longs instead of ints. Specifically, the follow values are now longs: runningbufspace, bufspace, maxbufspace, bufmallocspace, maxbufmallocspace, lobufspace, hibufspace, lorunningspace, hirunningspace, maxswzone, maxbcache, and maxpipekva. Previously, a relatively small number (~ 44000) of buffers set in kern.nbuf would result in integer overflows resulting either in hangs or bogus values of hidirtybuffers and lodirtybuffers. Now one has to overflow a long to see such problems. There was a check for a nbuf setting that would cause overflows in the auto-tuning of nbuf. I've changed it to always check and cap nbuf but warn if a user-supplied tunable would cause overflow. Note that this changes the ABI of several sysctls that are used by things like top(1), etc., so any MFC would probably require a some gross shims to allow for that. MFC after: 1 month
* Move the debug.hashstat sysctl tree under DIAGNOSTIC. I measured thejhb2009-03-091-0/+2
| | | | | | | | | debug.hashstat.rawnchash sysctl in particular as taking 7 milliseconds on a 3GHz Intel Xeon (4x2) running 7.1. It accounted for almost a quarter of the total runtime of 'sysctl -a'. It also performs lots of copyout's while holding the namecache lock (this does not attempt to fix that). MFC after: 2 weeks
* Fix a long-standing bug in newbus. It was introduced when subclassingimp2009-03-091-9/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | was introduced. If you have a bus, say cardbus, that is derived from a base-bus (say PCI), then ordinarily all PCI drivers would attach to cardbus devices. However, there had been one exception: kldload wouldn't work. The problem is in devclass_add_driver. In this routine, all we did was call to the pci device's BUS_DRIVER_ADDED routine. However, since cardbus bus instances had a different devclass, none of them were called. The solution is to call all subclass devclasses, recursively down the tree, of the class that was loaded. Since we don't have a 'children class' pointer, we search the whole list of devclasses for a class whose parent matches. Since just done a kldload time, this isn't as bad as it sounds. In addition, we short-circuit the whole process by marking those classes with subclasses with a flag. We'll likely have to reevaluate this method the number of devclasses with subclasses gets large. This means we can remove the "cardbus" lines from all the PCI drivers since we have no cardbus specific attach device attachments in the tree. # Also: minor tweak to an error message
* By default, don't compile in counters of calls to various timerwatson2009-03-081-13/+18
| | | | | | | | | | | | | | query functions in the kernel, as these effectively serialize parallel calls to the gettimeofday(2) system call, as well as other kernel services that use timestamps. Use the NetBSD version of the fix (kern_tc.c:1.32 by ad@) as they have picked up our timecounter code and also ran into the same problem. Reported by: kris Obtained from: NetBSD MFC after: 3 days
* Decompose the global UNIX domain sockets rwlock into two differentrwatson2009-03-082-102/+98
| | | | | | | | | | | | | | | | | | | | locks: a global list/counter/generation counter protected by a new mutex unp_list_lock, and a global linkage rwlock, unp_global_rwlock, which protects the connections between UNIX domain sockets. This eliminates conditional lock acquisition that was previously a property of the global lock being held over sonewconn() leading to a call to uipc_attach(), which also required the global lock, but couldn't rely on it as other paths existed to uipc_attach() that didn't hold it: now uipc_attach() uses only the list lock, which follows the linkage lock in the lock order. It may also reduce contention on the global lock for some workloads. Add global UNIX domain socket locks to hard-coded witness lock order. MFC after: 1 week Discussed with: kris
* Add a default implementation for VOP_VPTOCNP(9) which scans the parentmarcus2009-03-081-1/+235
| | | | | | | | | | | | directory of a vnode to find a dirent with a matching file number. The name from that dirent is then used to provide the component name. Note: if the initial vnode argument is not a directory itself, then the default VOP_VPTOCNP(9) implementation still returns ENOENT. Reviewed by: kib Approved by: kib Tested by: pho
* Remove 'uio' argument from MAC Framework and MAC policy entry points forrwatson2009-03-081-2/+2
| | | | | | | | | extended attribute get/set; in the case of get an uninitialized user buffer was passed before the EA was retrieved, making it of relatively little use; the latter was simply unused by any policies. Obtained from: TrustedBSD Project Sponsored by: Google, Inc.
* Improve the consistency of MAC Framework and MAC policy entry pointrwatson2009-03-081-9/+9
| | | | | | | | | | | | | | | | | | | | | | | naming by renaming certain "proc" entry points to "cred" entry points, reflecting their manipulation of credentials. For some entry points, the process was passed into the framework but not into policies; in these cases, stop passing in the process since we don't need it. mac_proc_check_setaudit -> mac_cred_check_setaudit mac_proc_check_setaudit_addr -> mac_cred_check_setaudit_addr mac_proc_check_setauid -> mac_cred_check_setauid mac_proc_check_setegid -> mac_cred_check_setegid mac_proc_check_seteuid -> mac_cred_check_seteuid mac_proc_check_setgid -> mac_cred_check_setgid mac_proc_check_setgroups -> mac_cred_ceck_setgroups mac_proc_check_setregid -> mac_cred_check_setregid mac_proc_check_setresgid -> mac_cred_check_setresgid mac_proc_check_setresuid -> mac_cred_check_setresuid mac_proc_check_setreuid -> mac_cred_check_setreuid mac_proc_check_setuid -> mac_cred_check_setuid Obtained from: TrustedBSD Project Sponsored by: Google, Inc.
* Extract the no_poll() and vop_nopoll() code into the common routinekib2009-03-063-22/+18
| | | | | | | | | poll_no_poll(). Return a poll_no_poll() result from devfs_poll_f() when filedescriptor does not reference the live cdev, instead of ENXIO. Noted and tested by: hps MFC after: 1 week
* Systematically use vm_size_t to specify the size of the segment for VM KPI.kib2009-03-051-6/+6
| | | | | | | | | Do not overload the local variable size in kern_shmat() due to vm_size_t change. Fix style bug by adding explicit comparision with 0. Discussed with: bde MFC after: 1 week
* as suggested by jhb@, panic in case the ncpus == 0.dchagin2009-03-031-1/+1
| | | | | | | it helps to catch bugs in the callers. Approved by: kib (mentor) MFC after: 5 days
* Reduce the verbosity of SDT trace points for DTrace by defining severalrwatson2009-03-031-6/+2
| | | | | | | | | | | wrapper macros that allow trace points and arguments to be declared using a single macro rather than several. This means a lot less repetition and vertical space for each trace point. Use these macros when defining privilege and MAC Framework trace points. Reviewed by: jb MFC after: 1 week
* Extend the "vfsopt" mount options for more general use. Make structjamie2009-03-021-48/+121
| | | | | | | | | | | | | | | | vfsopt and the vfs_buildopts function public, and add some new fields to struct vfsopt (pos and seen), and new functions vfs_getopt_pos and vfs_opterror. Further extend the interface to allow reading options from the kernel in addition to sending them to the kernel, with vfs_setopt and related functions. While this allows the "name=value" option interface to be used for more than just FS mounts (planned use is for jails), it retains the current "vfsopt" name and <sys/mount.h> requirement. Approved by: bz (mentor)
* Change vfs_busy to wait until an outcome of pending unmountkan2009-03-021-5/+13
| | | | | | | | | | | | operation is known and to retry or fail accordingly to that outcome. This fixes the problem with namespace traversing programs failing with random ENOENT errors if someone just happened to try to unmount that same filesystem at the same time. Reported by: dhw Reviewed by: kib, attilio Sponsored by: Juniper Networks, Inc.
* Correct types of variables used to track amount of allocated SysV sharedkib2009-03-021-7/+11
| | | | | | | | | | | | | | memory from int to size_t. Implement a workaround for current ABI not allowing to properly save size for and report more then 2Gb sized segment of shared memory. This makes it possible to use > 2 Gb shared memory segments on 64bit architectures. Please note the new BUGS section in shmctl(2) and UPDATING note for limitations of this temporal solution. Reviewed by: csjp Tested by: Nikolay Dzham <i levsha org ua> MFC after: 2 weeks
* Use the p_sysent->sv_flags flag SV_ILP32 to detect 32bit processkib2009-03-021-5/+4
| | | | | | executing on 64bit kernel. This eliminates the direct comparisions of p_sysent with &ia32_freebsd_sysvec, that were left intact after r185169.
* Fix range-check error introduced in r182292. Also do not do anythingdchagin2009-03-011-1/+3
| | | | | | | if all processors in the map are not available, simply return. Approved by: kib (mentor) MFC after: 1 week
* Improve my previous changes to the TTY code: also remove memcpy().ed2009-03-012-6/+6
| | | | | | | | It's better to just use internal language constructs, because it is likely the compiler has a better opinion on whether to perform inlining, which is very likely to happen to struct winsize. Submitted by: Christoph Mallon <christoph mallon gmx de>
* Move the NORELEASE check to after the recurse count decrement and bailout, thisthompsa2009-02-281-6/+6
| | | | is not counted as actually releasing the lock.
* Replace bcopy() calls inside the TTY layer with memcpy()/strlcpy().ed2009-02-283-9/+9
| | | | | In all these cases the buffers never overlap. Program names are also likely to be shorter, so use a regular strlcpy() to copy p_comm.
* For all files including net/vnet.h directly include opt_route.h andbz2009-02-272-0/+5
| | | | | | | | | | | | | | net/route.h. Remove the hidden include of opt_route.h and net/route.h from net/vnet.h. We need to make sure that both opt_route.h and net/route.h are included before net/vnet.h because of the way MRT figures out the number of FIBs from the kernel option. If we do not, we end up with the default number of 1 when including net/vnet.h and array sizes are wrong. This does not change the list of files which depend on opt_route.h but we can identify them now more easily.
* Remove redundant code in printf() and vprintf().ed2009-02-271-28/+1
| | | | | | | | printf() and vprintf() are exactly the same, except the way arguments are passed. Just like we see in other pieces of code (i.e. libc's printf()), implement printf() using vprintf(). Submitted by: Christoph Mallon <christoph mallon gmx de>
* Revert previous commit to subr_prf.c and make it more tidy.ed2009-02-271-3/+5
| | | | | | | As mentioned by bz and bde, the change I made wasn't the proper way to fix. Inspired by bde's patch, perform some small cleanups to uprintf(). Reviewed by: bz
* Remove unneeded pointer `ndp'.ed2009-02-261-11/+10
| | | | | | | Inside do_execve(), we have a pointer `ndp', which always points to `&nd'. I can imagine a primitive (non-optimizing) compiler to really reserve space for such a pointer, so just remove the variable and use `&nd' directly.
* Remove even more unneeded variable assignments.ed2009-02-269-20/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kern_time.c: - Unused variable `p'. kern_thr.c: - Variable `error' is always caught immediately, so no reason to initialize it. There is no way that error != 0 at the end of create_thread(). kern_sig.c: - Unused variable `code'. kern_synch.c: - `rval' is always assigned in all different cases. kern_rwlock.c: - `v' is always overwritten with RW_UNLOCKED further on. kern_malloc.c: - `size' is always initialized with the proper value before being used. kern_exit.c: - `error' is always caught and returned immediately. abort2() never returns a non-zero value. kern_exec.c: - `len' is always assigned inside the if-statement right below it. tty_info.c: - `td' is always overwritten by FOREACH_THREAD_IN_PROC(). Found by: LLVM's scan-build
* Remove unneeded variable `ocn_mute'.ed2009-02-261-2/+0
| | | | Found by: LLVM's scan-build
* Remove unused variables `p' and unneeded assignments of `rval'.ed2009-02-261-6/+0
| | | | Found by: LLVM's scan-build
* Remove redundant assignment of `p'.ed2009-02-261-1/+0
| | | | | | | `p' is already initialized with `td->td_proc'. Because td is always curthread, it is safe to initialize it without any locks. Found by: LLVM's scan-build
* Add static tracing for privilege checking:rwatson2009-02-261-9/+40
| | | | | | | | | | | | priv:kernel:priv_check:priv_ok fires for granted privileges priv:kernel:priv_check:priv_errr fires for denied privileges The first argument is the requested privilege number. The naming convention is a little different from the OpenSolaris equivilent because we can't have '-' in probefunc names, and our privilege namespace is different. MFC after: 1 week
* Silence compiler warning inside our ^T handler.ed2009-02-261-1/+1
| | | | | | It turns out we're casting fixpt_t* to int*. Spotted by: clang
* Use unsigned longs for the TTY's sysctl stats.ed2009-02-263-12/+12
| | | | Spotted by: clang
* Don't use PTY name as format string, even though it isn't insecure here.ed2009-02-261-1/+1
| | | | | It's guaranteed that the `name' variable always contains a string of the form pty[l‐sL‐S][0‐9a‐v], but I'd rather keep the compiler happy (LLVM).
OpenPOWER on IntegriCloud