aboutsummaryrefslogtreecommitdiff
path: root/sys/posix4
Commit message (Collapse)AuthorAgeFilesLines
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-1/+1
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Move a bunch of flags from the KSE to the thread.Julian Elischer2003-02-171-3/+3
| | | | | | | | | | | I was in two minds as to where to put them in the first case.. I should have listenned to the other mind. Submitted by: parts by davidxu@ Reviewed by: jeff@ mini@ Notes: svn path=/head/; revision=111032
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-1/+1
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Use copyout to access user memory.Alfred Perlstein2003-01-071-1/+5
| | | | | | | | Submittted by: pho MFC After: 2 days Notes: svn path=/head/; revision=108896
* Rework the sysconf(3) interaction with aio:Alfred Perlstein2002-11-172-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | sysconf.c: Use 'break' rather than 'goto yesno' in sysconf.c so that we report a '0' return value from the kernel sysctl. vfs_aio.c: Make aio reset its configuration parameters to -1 after unloading instead of 0. posix4_mib.c: Initialize the aio configuration parameters to -1 to indicate that it is not loaded. Add a facility (p31b_iscfg()) to determine if a posix4 facility has been initialized to avoid having to re-order the SYSINITs. Use p31b_iscfg() to determine if aio has had a chance to run yet which is likely if it is compiled into the kernel and avoid spamming its values. Introduce a macro P31B_VALID() instead of doing the same comparison over and over. posix4.h: Prototype p31b_iscfg(). Notes: svn path=/head/; revision=106998
* headers should not really include "opt_foo.h" (in this case opt_posix.h).Alfred Perlstein2002-11-153-2/+4
| | | | | | | remove it from the header and add it to the files that require it. Notes: svn path=/head/; revision=106969
* Change the way support for asynchronous I/O is indicated to applicationsGarrett Wollman2002-10-271-1/+3
| | | | | | | | | | | | | to conform to 1003.1-2001. Make it possible for applications to actually tell whether or not asynchronous I/O is supported. Since FreeBSD's aio implementation works on all descriptor types, don't call down into file or vnode ops when [f]pathconf() is asked about _PC_ASYNC_IO; this avoids the need for every file and vnode op to know about it. Notes: svn path=/head/; revision=106057
* Tidy up the scheduler's code for changing the priority of a thread.Julian Elischer2002-10-141-8/+2
| | | | | | | Logically pretty much a NOP. Notes: svn path=/head/; revision=105127
* - Create a new scheduler api that is defined in sys/sched.hJeff Roberson2002-10-121-1/+2
| | | | | | | | | | | | | - Begin moving scheduler specific functionality into sched_4bsd.c - Replace direct manipulation of scheduler data with hooks provided by the new api. - Remove KSE specific state modifications and single runq assumptions from kern_switch.c Reviewed by: -arch Notes: svn path=/head/; revision=104964
* Remove duplicate uninstalled aio.h header.Mike Barcroft2002-10-071-110/+0
| | | | Notes: svn path=/head/; revision=104634
* o Adjust the SEM_VALUE_MAX macro so that <machine/limits.h> isn'tMike Barcroft2002-10-041-14/+6
| | | | | | | | | | needed. o Remove unneeded includes which only add namespace pollution. o Sort function prototypes. o Add restrict type-qualifier to sem_getvalue(). Notes: svn path=/head/; revision=104491
* Fix various style(9) bugs:Mike Barcroft2002-10-031-9/+9
| | | | | | | | | o Unusual order of #ifndef _FOO_H_, followed by license. o Missing tabs in typedef and #define. o Reversed comment for #endif. Notes: svn path=/head/; revision=104417
* Remove namespace pollution by not including <sys/types.h> andMike Barcroft2002-10-031-3/+6
| | | | | | | | <time.h>, instead provide a local typedef for pid_t and forward declare struct timespec. Notes: svn path=/head/; revision=104398
* Fix various style(9) bugs:Mike Barcroft2002-10-021-23/+21
| | | | | | | | | | | | | | o Unusual order of #ifndef _FOO_H_, followed by license. o Missing tab in struct sched_param between type and member name. o Space used, instead of tab, after #define. o Reversed comment for #endif. o Irregular comment block. o Space used, instead of tab, to seperate return value type from function name. o Unordered function prototypes. Notes: svn path=/head/; revision=104391
* Fix various style(9) bugs:Mike Barcroft2002-09-201-19/+19
| | | | | | | | | | | o Unusual order of #ifndef _FOO_H_, followed by license. o Missing tabs in typedef. o Missing tabs in struct between types and member names. o Unaligned, unordered function prototypes. o Reversed comment for #endif. Notes: svn path=/head/; revision=103704
* Add the rest of the kernel support for the sem_ API in kern/uipc_sem.c.Alfred Perlstein2002-09-193-1/+84
| | | | | | | | | | | | | Option 'P1003_1B_SEMAPHORES' to compile them in, or load the "sem" module to activate them. Have kern/makesyscalls.sh emit an include for sys/_semaphore.h into sysproto.h to pull in the typedef for semid_t. Add the syscalls to the syscall table as module stubs. Notes: svn path=/head/; revision=103574
* Completely redo thread states.Julian Elischer2002-09-111-4/+4
| | | | | | | Reviewed by: davidxu@freebsd.org Notes: svn path=/head/; revision=103216
* Part 1 of KSE-IIIJulian Elischer2002-06-291-2/+25
| | | | | | | | | | | | | | | | The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals.. Notes: svn path=/head/; revision=99072
* Change p_can{debug,see,sched,signal}()'s first argument to be a threadJohn Baldwin2002-05-191-5/+5
| | | | | | | | | | pointer instead of a proc pointer and require the process pointed to by the second argument to be locked. We now use the thread ucred reference for the credential checks in p_can*() as a result. p_canfoo() should now no longer need Giant. Notes: svn path=/head/; revision=96886
* Remove __P.Alfred Perlstein2002-03-195-35/+35
| | | | Notes: svn path=/head/; revision=92727
* In a threaded world, differnt priorirites become properties ofJulian Elischer2002-02-111-4/+5
| | | | | | | | | different entities. Make it so. Reviewed by: jhb@freebsd.org (john baldwin) Notes: svn path=/head/; revision=90538
* Pre-KSE/M3 commit.Julian Elischer2002-02-071-5/+5
| | | | | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice, Notes: svn path=/head/; revision=90361
* KSE Milestone 2Julian Elischer2001-09-123-56/+77
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Protect pri_to_rtp() with sched_lock when needed.John Baldwin2001-09-021-0/+4
| | | | Notes: svn path=/head/; revision=82775
* Make various posix4 system calls MPSAFE (will fixup syscalls.master later)Matthew Dillon2001-08-311-42/+95
| | | | | | | | | | | | | | sched_setparam() sched_getparam() sched_setscheduler() sched_getscheduler() sched_yield() sched_get_priority_max() sched_get_priority_min() sched_rr_get_interval() Notes: svn path=/head/; revision=82701
* - Close races with signals and other AST's being triggered while we are inJohn Baldwin2001-08-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | the process of exiting the kernel. The ast() function now loops as long as the PS_ASTPENDING or PS_NEEDRESCHED flags are set. It returns with preemption disabled so that any further AST's that arrive via an interrupt will be delayed until the low-level MD code returns to user mode. - Use u_int's to store the tick counts for profiling purposes so that we do not need sched_lock just to read p_sticks. This also closes a problem where the call to addupc_task() could screw up the arithmetic due to non-atomic reads of p_sticks. - Axe need_proftick(), aston(), astoff(), astpending(), need_resched(), clear_resched(), and resched_wanted() in favor of direct bit operations on p_sflag. - Fix up locking with sched_lock some. In addupc_intr(), use sched_lock to ensure pr_addr and pr_ticks are updated atomically with setting PS_OWEUPC. In ast() we clear pr_ticks atomically with clearing PS_OWEUPC. We also do not grab the lock just to test a flag. - Simplify the handling of Giant in ast() slightly. Reviewed by: bde (mostly) Notes: svn path=/head/; revision=81493
* o Replace calls to p_can(..., P_CAN_xxx) with calls to p_canxxx().Robert Watson2001-07-051-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | The p_can(...) construct was a premature (and, it turns out, awkward) abstraction. The individual calls to p_canxxx() better reflect differences between the inter-process authorization checks, such as differing checks based on the type of signal. This has a side effect of improving code readability. o Replace direct credential authorization checks in ktrace() with invocation of p_candebug(), while maintaining the special case check of KTR_ROOT. This allows ktrace() to "play more nicely" with new mandatory access control schemes, as well as making its authorization checks consistent with other "debugging class" checks. o Eliminate "privused" construct for p_can*() calls which allowed the caller to determine if privilege was required for successful evaluation of the access control check. This primitive is currently unused, and as such, serves only to complicate the API. Approved by: ({procfs,linprocfs} changes) des Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=79335
* o Unfold p31b_proc() into the individual posix4 system calls so as toRobert Watson2001-06-301-66/+60
| | | | | | | | | | | | allow call-specific authorization. o Modify the authorization model so that p_can() is used to check scheduling get/set events, using P_CAN_SEE for gets, and P_CAN_SCHED for sets. This brings the checks in line with get/setpriority(). Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=79020
* Replace some use of 'p' with 'targetp' so as to not scarily overload theRobert Watson2001-06-301-11/+17
| | | | | | | | | passed 'p' argument. No functional change. Obtained from: USENIX Emporium, Cheap Tricks Department Notes: svn path=/head/; revision=79004
* Remove a fascinating but confusing construct involving chainingRobert Watson2001-06-281-33/+31
| | | | | | | | | | | conditional clauses in the following way: (0 || a || b); No functional change. Notes: svn path=/head/; revision=78944
* Add error checking for copyin() operations in posix4 scheduling code.Robert Watson2001-06-281-2/+6
| | | | Notes: svn path=/head/; revision=78943
* o Merge contents of struct pcred into struct ucred. Specifically, add theRobert Watson2001-05-251-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | real uid, saved uid, real gid, and saved gid to ucred, as well as the pcred->pc_uidinfo, which was associated with the real uid, only rename it to cr_ruidinfo so as not to conflict with cr_uidinfo, which corresponds to the effective uid. o Remove p_cred from struct proc; add p_ucred to struct proc, replacing original macro that pointed. p->p_ucred to p->p_cred->pc_ucred. o Universally update code so that it makes use of ucred instead of pcred, p->p_ucred instead of p->p_pcred, cr_ruidinfo instead of p_uidinfo, cr_{r,sv}{u,g}id instead of p_*, etc. o Remove pcred0 and its initialization from init_main.c; initialize cr_ruidinfo there. o Restruction many credential modification chunks to always crdup while we figure out locking and optimizations; generally speaking, this means moving to a structure like this: newcred = crdup(oldcred); ... p->p_ucred = newcred; crfree(oldcred); It's not race-free, but better than nothing. There are also races in sys_process.c, all inter-process authorization, fork, exec, and exit. o Remove sigio->sio_ruid since sigio->sio_ucred now contains the ruid; remove comments indicating that the old arrangement was a problem. o Restructure exec1() a little to use newcred/oldcred arrangement, and use improved uid management primitives. o Clean up exit1() so as to do less work in credential cleanup due to pcred removal. o Clean up fork1() so as to do less work in credential cleanup and allocation. o Clean up ktrcanset() to take into account changes, and move to using suser_xxx() instead of performing a direct uid==0 comparision. o Improve commenting in various kern_prot.c credential modification calls to better document current behavior. In a couple of places, current behavior is a little questionable and we need to check POSIX.1 to make sure it's "right". More commenting work still remains to be done. o Update credential management calls, such as crfree(), to take into account new ruidinfo reference. o Modify or add the following uid and gid helper routines: change_euid() change_egid() change_ruid() change_rgid() change_svuid() change_svgid() In each case, the call now acts on a credential not a process, and as such no longer requires more complicated process locking/etc. They now assume the caller will do any necessary allocation of an exclusive credential reference. Each is commented to document its reference requirements. o CANSIGIO() is simplified to require only credentials, not processes and pcreds. o Remove lots of (p_pcred==NULL) checks. o Add an XXX to authorization code in nfs_lock.c, since it's questionable, and needs to be considered carefully. o Simplify posix4 authorization code to require only credentials, not processes and pcreds. Note that this authorization, as well as CANSIGIO(), needs to be updated to use the p_cansignal() and p_cansched() centralized authorization routines, as they currently do not take into account some desirable restrictions that are handled by the centralized routines, as well as being inconsistent with other similar authorization instances. o Update libkvm to take these changes into account. Obtained from: TrustedBSD Project Reviewed by: green, bde, jhb, freebsd-arch, freebsd-audit Notes: svn path=/head/; revision=77183
* o First step in cleaning up authorization code for the posix4Robert Watson2001-05-061-8/+8
| | | | | | | | | | | | implementation. Move from direct uid 0 comparision to using suser_xxx() call with the same semantics. Simplify CAN_AFFECT() macro as passed pcred was redundant. The checks here still aren't "right", but they are probably "better". Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=76316
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inMark Murray2001-05-012-4/+7
| | | | | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations) Notes: svn path=/head/; revision=76166
* Overhaul of the SMP code. Several portions of the SMP kernel support haveJohn Baldwin2001-04-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | been made machine independent and various other adjustments have been made to support Alpha SMP. - It splits the per-process portions of hardclock() and statclock() off into hardclock_process() and statclock_process() respectively. hardclock() and statclock() call the *_process() functions for the current process so that UP systems will run as before. For SMP systems, it is simply necessary to ensure that all other processors execute the *_process() functions when the main clock functions are triggered on one CPU by an interrupt. For the alpha 4100, clock interrupts are delievered in a staggered broadcast fashion, so we simply call hardclock/statclock on the boot CPU and call the *_process() functions on the secondaries. For x86, we call statclock and hardclock as usual and then call forward_hardclock/statclock in the MD code to send an IPI to cause the AP's to execute forwared_hardclock/statclock which then call the *_process() functions. - forward_signal() and forward_roundrobin() have been reworked to be MI and to involve less hackery. Now the cpu doing the forward sets any flags, etc. and sends a very simple IPI_AST to the other cpu(s). AST IPIs now just basically return so that they can execute ast() and don't bother with setting the astpending or needresched flags themselves. This also removes the loop in forward_signal() as sched_lock closes the race condition that the loop worked around. - need_resched(), resched_wanted() and clear_resched() have been changed to take a process to act on rather than assuming curproc so that they can be used to implement forward_roundrobin() as described above. - Various other SMP variables have been moved to a MI subr_smp.c and a new header sys/smp.h declares MI SMP variables and API's. The IPI API's from machine/ipl.h have moved to machine/smp.h which is included by sys/smp.h. - The globaldata_register() and globaldata_find() functions as well as the SLIST of globaldata structures has become MI and moved into subr_smp.c. Also, the globaldata list is only available if SMP support is compiled in. Reviewed by: jake, peter Looked over by: eivind Notes: svn path=/head/; revision=76078
* Change the pfind() and zpfind() functions to lock the process that theyJohn Baldwin2001-04-241-2/+4
| | | | | | | | | find before releasing the allproc lock and returning. Reviewed by: -smp, dfr, jake Notes: svn path=/head/; revision=75893
* Lock need_resched with sched_lock.John Baldwin2001-02-221-2/+7
| | | | | | | Reported by: des Notes: svn path=/head/; revision=72885
* Implement a unified run queue and adjust priority levels accordingly.Jake Burkholder2001-02-121-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - All processes go into the same array of queues, with different scheduling classes using different portions of the array. This allows user processes to have their priorities propogated up into interrupt thread range if need be. - I chose 64 run queues as an arbitrary number that is greater than 32. We used to have 4 separate arrays of 32 queues each, so this may not be optimal. The new run queue code was written with this in mind; changing the number of run queues only requires changing constants in runq.h and adjusting the priority levels. - The new run queue code takes the run queue as a parameter. This is intended to be used to create per-cpu run queues. Implement wrappers for compatibility with the old interface which pass in the global run queue structure. - Group the priority level, user priority, native priority (before propogation) and the scheduling class into a struct priority. - Change any hard coded priority levels that I found to use symbolic constants (TTIPRI and TTOPRI). - Remove the curpriority global variable and use that of curproc. This was used to detect when a process' priority had lowered and it should yield. We now effectively yield on every interrupt. - Activate propogate_priority(). It should now have the desired effect without needing to also propogate the scheduling class. - Temporarily comment out the call to vm_page_zero_idle() in the idle loop. It interfered with propogate_priority() because the idle process needed to do a non-blocking acquire of Giant and then other processes would try to propogate their priority onto it. The idle process should not do anything except idle. vm_page_zero_idle() will return in the form of an idle priority kernel thread which is woken up at apprioriate times by the vm system. - Update struct kinfo_proc to the new priority interface. Deliberately change its size by adjusting the spare fields. It remained the same size, but the layout has changed, so userland processes that use it would parse the data incorrectly. The size constraint should really be changed to an arbitrary version number. Also add a debug.sizeof sysctl node for struct kinfo_proc. Notes: svn path=/head/; revision=72376
* Add $FreeBSD$Peter Wemm2000-05-011-0/+1
| | | | Notes: svn path=/head/; revision=59874
* Remove unneeded #include <sys/kernel.h>Poul-Henning Kamp2000-04-291-1/+0
| | | | Notes: svn path=/head/; revision=59760
* Add $FreeBSD$.Garrett Wollman2000-04-221-0/+17
| | | | | | | | Initialize the POSIX.1b sysconf information appropriately for non-optional kernel functions. Notes: svn path=/head/; revision=59494
* Commit major SMP cleanups and move the BGL (big giant lock) in theMatthew Dillon2000-03-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | syscall path inward. A system call may select whether it needs the MP lock or not (the default being that it does need it). A great deal of conditional SMP code for various deadended experiments has been removed. 'cil' and 'cml' have been removed entirely, and the locking around the cpl has been removed. The conditional separately-locked fast-interrupt code has been removed, meaning that interrupts must hold the CPL now (but they pretty much had to anyway). Another reason for doing this is that the original separate-lock for interrupts just doesn't apply to the interrupt thread mechanism being contemplated. Modifications to the cpl may now ONLY occur while holding the MP lock. For example, if an otherwise MP safe syscall needs to mess with the cpl, it must hold the MP lock for the duration and must (as usual) save/restore the cpl in a nested fashion. This is precursor work for the real meat coming later: avoiding having to hold the MP lock for common syscalls and I/O's and interrupt threads. It is expected that the spl mechanisms and new interrupt threading mechanisms will be able to run in tandem, allowing a slow piecemeal transition to occur. This patch should result in a moderate performance improvement due to the considerable amount of code that has been removed from the critical path, especially the simplification of the spl*() calls. The real performance gains will come later. Approved by: jkh Reviewed by: current, bde (exception.s) Some work taken from: luoqi's patch Notes: svn path=/head/; revision=58717
* Track libc_r addition of semaphores implementation.Jason Evans2000-01-201-10/+16
| | | | | | | Approved by: jkh Notes: svn path=/head/; revision=56321
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"Peter Wemm1999-12-294-10/+13
| | | | | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come. Notes: svn path=/head/; revision=55206
* Fixed some type mismatches. p_retval[0] in struct proc has typeBruce Evans1999-12-272-18/+22
| | | | | | | | | register_t, so pointers to it must be passed around as `register_t *', not as `int *'. The type mismatches were non-benign on alphas, but the broken code is normally only configured by LINT. Notes: svn path=/head/; revision=55140
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Well folks, this is it - The second stage of the removal for build supportPeter Wemm1999-04-172-2/+2
| | | | | | | for LKM's.. Notes: svn path=/head/; revision=45739
* * Change sysctl from using linker_set to construct its tree using SLISTs.Doug Rabson1999-02-161-1/+5
| | | | | | | | | | | | | This makes it possible to change the sysctl tree at runtime. * Change KLD to find and register any sysctl nodes contained in the loaded file and to unregister them when the file is unloaded. Reviewed by: Archie Cobbs <archie@whistle.com>, Peter Wemm <peter@netplex.com.au> (well they looked at it anyway) Notes: svn path=/head/; revision=44078
* Set PAGE_SIZE for _SC_PAGESIZE sysconf().Peter Dufault1998-06-011-0/+1
| | | | Notes: svn path=/head/; revision=36578
* 1. Add new defs for mins and maxs for the POSIX flavor priorities. TheyPeter Dufault1998-05-192-9/+26
| | | | | | | | | | | | | | | | end up being the same, but it doesn't look like you're comparing apples and oranges. 2. Use need_resched instead of reset_priority. This isn't right either, since for example you'll round-robin against equal priority FIFO processes when lowering the priority of another process, but this works better and a real fix needs to be in kern_synch and not out here. 3. This is not a device driver: copyin/copyout the structure. Notes: svn path=/head/; revision=36218