summaryrefslogtreecommitdiffstats
path: root/sys/sys
Commit message (Collapse)AuthorAgeFilesLines
...
* Provide ABI compatibility shim to enable configuring of addressesglebius2011-12-211-2/+2
| | | | | | with ifconfig(8) prior to r228571. Requested by: brooks
* Add a TASK_INITIALIZER() macro that can be used to staticallyjhb2011-12-191-0/+6
| | | | | | | initialize a task structure. Reviewed by: gj MFC after: 2 weeks
* On start most of sysctl_kern_proc functions use the same pattern:trociny2011-12-171-0/+14
| | | | | | | | | | | | | locate a process calling pfind() and do some additional checks like p_candebug(). To reduce this code duplication a new function pget() is introduced and used. As the function may be useful not only in kern_proc.c it is in the kernel name space. Suggested by: kib Reviewed by: kib MFC after: 2 weeks
* retire libkern getsavg2011-12-171-1/+0
| | | | | | Inspired by: bde MFC after: 2 months X-MFC-Note: if deemed a part of KPI, just call cngets internally
* move GETS_*ECHO* defintions from libkern.h to cons.havg2011-12-172-5/+5
| | | | MFC after: 2 months
* introduce cngets, a method for kernel to read a string from consoleavg2011-12-171-0/+1
| | | | | | | | | | | | | This is intended as a replacement for libkern's gets and mostly borrows its implementation. It uses cngrab/cnungrab to delimit kernel's access to console input. Note: libkern's gets obviously doesn't share any bits of implementation iwth libc's gets. They also have different APIs and the former doesn't have the overflow problems of the latter. Inspired by: bde MFC after: 2 months
* kern cons: introduce infrastructure for console grabbing by kernelavg2011-12-171-0/+10
| | | | | | | | | | | | At the moment grab and ungrab methods of all console drivers are no-ops. Current intended meaning of the calls is that the kernel takes control of console input. In the future the semantics may be extended to mean that the calling thread takes full ownership of the console (e.g. console output from other threads could be suspended). Inspired by: bde MFC after: 2 months
* A major overhaul of the CARP implementation. The ip_carp.c was startedglebius2011-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from scratch, copying needed functionality from the old implemenation on demand, with a thorough review of all code. The main change is that interface layer has been removed from the CARP. Now redundant addresses are configured exactly on the interfaces, they run on. The CARP configuration itself is, as before, configured and read via SIOCSVH/SIOCGVH ioctls. A new prefix created with SIOCAIFADDR or SIOCAIFADDR_IN6 may now be configured to a particular virtual host id, which makes the prefix redundant. ifconfig(8) semantics has been changed too: now one doesn't need to clone carpXX interface, he/she should directly configure a vhid on a Ethernet interface. To supply vhid data from the kernel to an application the getifaddrs(8) function had been changed to pass ifam_data with each address. [1] The new implementation definitely closes all PRs related to carp(4) being an interface, and may close several others. It also allows to run a single redundant IP per interface. Big thanks to Bjoern Zeeb for his help with inet6 part of patch, for idea on using ifam_data and for several rounds of reviewing! PR: kern/117000, kern/126945, kern/126714, kern/120130, kern/117448 Reviewed by: bz Submitted by: bz [1]
* Move kstack_cache_entry into the private header, and make thekib2011-12-161-0/+43
| | | | | | stack cache list header accessible outside vm_glue.c. MFC after: 1 week
* Fix typo in macro.ed2011-12-161-1/+1
| | | | | | | I copied this macro directly from Bruce's email, as I assumed it was awesome already. Reported by: tijl@
* Process a lot of feedback from bde@ on <sys/cdefs.h>:ed2011-12-161-20/+18
| | | | | | | | | | | | | | | | | - Add __alignof() for non-GCC and GCC < 2.95. - Simply implement the C1X keywords on top of the existing __macros. - Add struct __hack to _Static_assert to require consumers to add a semicolon. - Add an extra underscore to __assert_ to allow it to be combined with locally defined versions of CTASSERT in the tree. - Add proper casts to __offsetof() to make it work for cases where sizeof(size_t) != sizeof(uintptr_t). - Globally replace size_t and uintptr_t by __size_t and __uintptr_t. This removes the dependency on <sys/types.h> / <stdint.h>. Practically any header file ends up including <machines/_types.h> somehow. - Change argument names of macros to match with the rest of the file. MFC after: 3 months
* Add a pointless and superfluous GNUism that people at a certain large datatheraven2011-12-151-0/+7
| | | | | | aggregation and advertising company seem to believe is standard. Approved by: dim (mentor)
* Add a helper API to allow in-kernel code to map portions of shared memoryjhb2011-12-141-0/+5
| | | | | | objects created by shm_open(2) into the kernel's address space. This provides a convenient way for creating shared memory buffers between userland and the kernel without requiring custom character devices.
* Slightly alter the C1X definitions in in cdefs.h:ed2011-12-141-3/+6
| | | | | | | | | | | - Add _Alignas(). Unfortunately this macro is only partially functional. The C1X standard will allow both an integer and a type name to be passed to this macro, while this macro only allows an integer. To be portable, one must use _Alignas(_Alignof(double)) to use type names. - Don't do _Static_assert() when __COUNTER__ is not supported. We'd better keep this implementation robust and allow it to be used in header files, without mysteriously breaking older compilers.
* Reimplement CTASSERT() using _Static_assert().ed2011-12-131-4/+2
|
* Make support for C1X keywords more complete.ed2011-12-131-3/+22
| | | | | | | | | - _Alignof(), which returns the aligment of a certain type. - _Static_assert(), which can be used to check compile-time assertions. - _Thread_local, which uses TLS on a variable. MFC after: 3 months Reviewed by: mdf
* Replace __const by const in all non-contributed source code.ed2011-12-131-1/+1
| | | | | | As C1X is close to being released, there is no need to wrap around a feature that is already part of C90. Most of these files already use `const' in different placed as well.
* Revert the approach for skipping lockstat_probe_func call when doingattilio2011-12-121-13/+6
| | | | | | | | | | | | | lock_success/lock_failure, introduced in r228424, by directly skipping in dtrace_probe. This mainly helps in avoiding namespace pollution and thus lockstat.h dependency by systm.h. As an added bonus, this also helps in MFC case. Reviewed by: avg MFC after: 3 months (or never) X-MFC: r228424
* - Define true and false in sys/types.h for _KERNEL consumers, andmdf2011-12-122-1/+11
| | | | | | | | | | | | | | | | typedef bool. Due to macro expansion it seemed better to use a typedef for kernel consumers (specifically ofed won't compile without more changes if a define is used). - <stdbool.h> should also not re-define bool/true/false if they are defined by <sys/types.h>. It would probably be a programming error to define _KERNEL for user-space code, but downstream consumers like Isilon have already been including <stdbool.h> in kernel sources, and this protects that usage. - sizeof(_Bool) is not necessarily the same as sizeof(int), so kernel modules should be rebuild with this change. Bump __FreeBSD_version. MFC after: 2 weeks Sponsored by: Isilon Systems, LLC
* Add definitions for GNU-specific STT_GNU_IFUNC symbol type,kib2011-12-121-0/+3
| | | | | | and R_{386,X86_64}_IRELATIVE relocations. MFC after: 3 weeks
* panic: add a switch and infrastructure for stopping other CPUs in SMP caseavg2011-12-113-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historical behavior of letting other CPUs merily go on is a default for time being. The new behavior can be switched on via kern.stop_scheduler_on_panic tunable and sysctl. Stopping of the CPUs has (at least) the following benefits: - more of the system state at panic time is preserved intact - threads and interrupts do not interfere with dumping of the system state Only one thread runs uninterrupted after panic if stop_scheduler_on_panic is set. That thread might call code that is also used in normal context and that code might use locks to prevent concurrent execution of certain parts. Those locks might be held by the stopped threads and would never be released. To work around this issue, it was decided that instead of explicit checks for panic context, we would rather put those checks inside the locking primitives. This change has substantial portions written and re-written by attilio and kib at various times. Other changes are heavily based on the ideas and patches submitted by jhb and mdf. bde has provided many insights into the details and history of the current code. The new behavior may cause problems for systems that use a USB keyboard for interfacing with system console. This is because of some unusual locking patterns in the ukbd code which have to be used because on one hand ukbd is below syscons, but on the other hand it has to interface with other usb code that uses regular mutexes/Giant for its concurrency protection. Dumping to USB-connected disks may also be affected. PR: amd64/139614 (at least) In cooperation with: attilio, jhb, kib, mdf Discussed with: arch@, bde Tested by: Eugene Grosbein <eugen@grosbein.net>, gnn, Steven Hartland <killing@multiplay.co.uk>, glebius, Andrew Boyer <aboyer@averesystems.com> (various versions of the patch) MFC after: 3 months (or never)
* As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is antheraven2011-12-071-4/+4
| | | | | | | | identifier reserved for the implementation in C99 and earlier so there is no sensible reason for introducing yet another reserved identifier when we could just use the one C1x uses. Approved by: brooks (mentor)
* Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add atheraven2011-12-071-0/+11
| | | | | | | | | | | | | | | | __noreturn macro and modify the other exiting functions to use it. The __noreturn macro, unlike __dead2, must be used BEFORE the function. This is in line with the C and C++ specifications that place _Noreturn (c1x) and [[noreturn]] (C++11) in front of the functions. As with __dead2, this macro falls back to using the GCC attribute. Unfortunately, clang currently sets the same value for the C version macro in C99 and C1x modes, so these functions are hidden by default. At some point before 10.0, I need to go through the headers and clean up the C1x / C++11 visibility. Reviewed by: brooks (mentor)
* Add declaration of umtx_copyin_timeout()pho2011-12-031-0/+1
| | | | | In collaboration with: kib MFC after: 1 week
* Revise the sysctl handling code and restructure the hierarchy of sysctlslstewart2011-12-011-0/+6
| | | | | | | | | | | | | | | | | | | | introduced when feed-forward clock support is enabled in the kernel: - Rename the "choice" variable to "available". - Streamline the implementation of the "active" variable's sysctl handler function. - Create a kern.sysclock sysctl node for general sysclock related configuration options. Place the "available" and "active" variables under this node. - Create a kern.sysclock.ffclock sysctl node for feed-forward clock specific configuration options. Place the "version" and "ffcounter_bypass" variables under this node. - Tweak some of the description strings. Discussed with: Julien Ridoux (jridoux at unimelb edu au)
* Make sysclock_active publicly available to external consumers.lstewart2011-11-291-0/+1
| | | | | | | | | | | Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Discussed with: Julien Ridoux (jridoux at unimelb edu au) Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Introduce the new "fromclock" public wrapper API which allows consumers tolstewart2011-11-291-0/+126
| | | | | | | | | | | | | | | | | select which system clock to obtain time from, independent of the current default system clock. In the brave new multi sysclock world, both feedback and feed-forward system clocks can be maintained and used concurrently, so this API provides a minimalist first step for interested consumers to exercise control over their choice of system clock. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Discussed with: Julien Ridoux (jridoux at unimelb edu au) Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Make the fbclock_[get]{bin,nano,micro}[up]time() function prototypes public solstewart2011-11-291-0/+22
| | | | | | | | | | | | | | that new APIs with some performance sensitivity can be built on top of them. These functions should not be called directly except in special circumstances. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Discussed with: Julien Ridoux (jridoux at unimelb edu au) Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* This should have been committed in r228030.trociny2011-11-271-0/+1
| | | | MFC after: 2 weeks
* Add sysctl to get process resource limits.trociny2011-11-241-0/+1
| | | | | Reviewed by: kib MFC after: 2 weeks
* Add const qualifier to rlimit_ident.trociny2011-11-241-1/+1
| | | | | Reviewed by: kib MFC after: 2 weeks
* Rename device_delete_all_children() into device_delete_children().hselasky2011-11-221-1/+1
| | | | | Suggested by: jhb @ and marius @ MFC after: 1 week
* Add new sysctls, KERN_PROC_ENV and KERN_PROC_AUXV, to returntrociny2011-11-222-0/+7
| | | | | | | | | | | | | | | | environment strings and ELF auxiliary vectors from a process stack. Make sysctl_kern_proc_args to read not cached arguments from the process stack. Export proc_getargv() and proc_getenvv() so they can be reused by procfs and linprocfs. Suggested by: kib Reviewed by: kib Discussed with: kib, rwatson, jilles Tested by: pho MFC after: 2 weeks
* - Add a DEVMETHOD_END alias for KOBJMETHOD_END so that along with 'driver_t'marius2011-11-221-1/+2
| | | | | | | | | and DEVMETHOD() we can fully hide the explicit mention of kobj(9) from device drivers. - Update the example in driver.9 to use DEVMETHOD_END. Submitted by: jhb MFC after: 3 days
* Define __FreeBSD_kernel__ macro in sys/param.h.rmh2011-11-221-0/+16
| | | | | | | | | | | | | | | | | __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, which by definition is always true on FreeBSD. This macro is also defined on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD. It is tempting to use this macro in userland code when we want to enable kernel-specific routines, and in fact it's fine to do this in code that is part of FreeBSD itself. However, be aware that as presence of this macro is still not widespread (e.g. older FreeBSD versions, 3rd party compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in external applications without also checking for __FreeBSD__ as an alternative. Approved by: kib (mentor) MFC after: 2 weeks
* - Add Pulse-Per-Second timestamping using raw ffcounter and correspondinglstewart2011-11-211-0/+49
| | | | | | | | | | | | | | ffclock time in seconds. - Add IOCTL to retrieve ffclock timestamps from userland. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Introduce the same mutex-wise fix in r227758 for sx locks.attilio2011-11-211-35/+51
| | | | | | | | | | | | | | | | | | | | | The functions that offer file and line specifications are: - sx_assert_ - sx_downgrade_ - sx_slock_ - sx_slock_sig_ - sx_sunlock_ - sx_try_slock_ - sx_try_xlock_ - sx_try_upgrade_ - sx_unlock_ - sx_xlock_ - sx_xlock_sig_ - sx_xunlock_ Now vm_map locking is fully converted and can avoid to know specifics about locking procedures. Reviewed by: kib MFC after: 1 month
* - Add the ffclock_getcounter(), ffclock_getestimate() and ffclock_setestimate()lstewart2011-11-214-0/+31
| | | | | | | | | | | | | | | | | | | | system calls to provide feed-forward clock management capabilities to userspace processes. ffclock_getcounter() returns the current value of the kernel's feed-forward clock counter. ffclock_getestimate() returns the current feed-forward clock parameter estimates and ffclock_setestimate() updates the feed-forward clock parameter estimates. - Document the syscalls in the ffclock.2 man page. - Regenerate the script-derived syscall related files. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Introduce macro stubs in the mutex implementation that will be alwaysattilio2011-11-201-30/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | defined and will allow consumers, willing to provide options, file and line to locking requests, to not worry about options redefining the interfaces. This is typically useful when there is the need to build another locking interface on top of the mutex one. The introduced functions that consumers can use are: - mtx_lock_flags_ - mtx_unlock_flags_ - mtx_lock_spin_flags_ - mtx_unlock_spin_flags_ - mtx_assert_ - thread_lock_flags_ Spare notes: - Likely we can get rid of all the 'INVARIANTS' specification in the ppbus code by using the same macro as done in this patch (but this is left to the ppbus maintainer) - all the other locking interfaces may require a similar cleanup, where the most notable case is sx which will allow a further cleanup of vm_map locking facilities - The patch should be fully compatible with older branches, thus a MFC is previewed (infact it uses all the underlying mechanisms already present). Comments review by: eadler, Ben Kaduk Discussed with: kib, jhb MFC after: 1 month
* - Provide a sysctl interface to change the active system clock at runtime.lstewart2011-11-201-0/+36
| | | | | | | | | | | | | | | | | - Wrap [get]{bin,nano,micro}[up]time() functions of sys/time.h to allow requesting time from either the feedback or the feed-forward clock. If a feedback (e.g. ntpd) and feed-forward (e.g. radclock) daemon are both running on the system, both kernel clocks are updated but only one serves time. - Add similar wrappers for the feed-forward difference clock. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Fix a whitespace nit.lstewart2011-11-201-1/+1
| | | | Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Provide high-level functions to access the feed-forward absolute and differencelstewart2011-11-201-0/+23
| | | | | | | | | | | | | | clocks. Each routine can output an upper bound on the absolute time or time interval requested. Different flavours of absolute time can be requested, for example with or without leap seconds, monotonic or not, etc. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Core structure and functions to support a feed-forward clock within the kernel.lstewart2011-11-192-0/+152
| | | | | | | | | | | | | | | | | Implement ffcounter, a monotonically increasing cumulative counter on top of the active timecounter. Provide low-level functions to read the ffcounter and convert it to absolute time or a time interval in seconds using the current ffclock estimates, which track the drift of the oscillator. Add a ring of fftimehands to track passing of time on each kernel tick and pick up updates of ffclock estimates. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Move the device_delete_all_children() function from usb_util.chselasky2011-11-191-0/+1
| | | | | | | | to kern/subr_bus.c. Simplify this function so that it no longer depends on malloc() to execute. Identify a few other places where it makes sense to use device_delete_all_children(). MFC after: 1 week
* Regenerate system call tables.ed2011-11-193-6/+6
|
* Consistently use process spin lock for protection of thekib2011-11-181-1/+1
| | | | | | | | | | p->p_boundary_count. Race could cause the execve(2) from the threaded process to hung since thread boundary counter was incorrect and single-threading never finished. Reported by: pluknet, pho Tested by: pho MFC after: 1 week
* Use the alternate form of the gcc extension that works even withkib2011-11-181-1/+1
| | | | | | | -ansi -pedantic without issuing a warning, and which is recommended by gcc manual. MFC after: 1 week
* Add unicode support to msdosfs and smbfs; original pathes from imura,kevlo2011-11-182-1/+3
| | | | | | bug fixes by Kuan-Chung Chiu <buganini at gmail dot com>. Tested by me in production for several days at work.
* Constify arguments for locking KPIs where possible.pjd2011-11-166-12/+12
| | | | | | | This enables locking consumers to pass their own structures around as const and be able to assert locks embedded into those structures. Reviewed by: ed, kib, jhb
* Constify stack argument for functions that don't modify it.pjd2011-11-161-8/+9
| | | | Reviewed by: ed, kib, jhb
OpenPOWER on IntegriCloud