summaryrefslogtreecommitdiffstats
path: root/sys/posix4
Commit message (Collapse)AuthorAgeFilesLines
* /* -> /*- for license, minor formatting changesimp2005-01-073-3/+3
|
* Back when VOP_* was introduced, we did not have new-style structphk2004-12-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initializations but we did have lofty goals and big ideals. Adjust to more contemporary circumstances and gain type checking. Replace the entire vop_t frobbing thing with properly typed structures. The only casualty is that we can not add a new VOP_ method with a loadable module. History has not given us reason to belive this would ever be feasible in the the first place. Eliminate in toto VOCALL(), vop_t, VNODEOP_SET() etc. Give coda correct prototypes and function definitions for all vop_()s. Generate a bit more data from the vnode_if.src file: a struct vop_vector and protype typedefs for all vop methods. Add a new vop_bypass() and make vop_default be a pointer to another struct vop_vector. Remove a lot of vfs_init since vop_vector is ready to use from the compiler. Cast various vop_mumble() to void * with uppercase name, for instance VOP_PANIC, VOP_NULL etc. Implement VCALL() by making vdesc_offset the offsetof() the relevant function pointer in vop_vector. This is disgusting but since the code is generated by a script comparatively safe. The alternative for nullfs etc. would be much worse. Fix up all vnode method vectors to remove casts so they become typesafe. (The bulk of this is generated by scripts)
* The sem_timedwait() and ksem_timedwait() functions bothdeischen2004-02-032-0/+3
| | | | | | need struct timespec, so define it here. Discussed in: standards (wollman)
* Add prototype for sem_timedwait().deischen2004-02-031-0/+1
| | | | Reviewed by: standards (Stefan Farfeleder)
* Add ksem_timedwait() to complement ksem_wait().deischen2004-02-031-0/+1
| | | | Glanced at by: alfred
* sched_setscheduler: Return EINVAL when a invalid policy is specified,nectar2003-09-131-0/+4
| | | | | thus complying with POLA and the man page. (Previously, no error was returned for this case.)
* Use __FBSDID().obrien2003-06-113-6/+9
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Move a bunch of flags from the KSE to the thread.julian2003-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@
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Use copyout to access user memory.alfred2003-01-071-1/+5
| | | | | Submittted by: pho MFC After: 2 days
* Rework the sysconf(3) interaction with aio:alfred2002-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().
* headers should not really include "opt_foo.h" (in this case opt_posix.h).alfred2002-11-153-2/+4
| | | | remove it from the header and add it to the files that require it.
* Change the way support for asynchronous I/O is indicated to applicationswollman2002-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.
* Tidy up the scheduler's code for changing the priority of a thread.julian2002-10-141-8/+2
| | | | Logically pretty much a NOP.
* - Create a new scheduler api that is defined in sys/sched.hjeff2002-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
* Remove duplicate uninstalled aio.h header.mike2002-10-071-110/+0
|
* o Adjust the SEM_VALUE_MAX macro so that <machine/limits.h> isn'tmike2002-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().
* Fix various style(9) bugs:mike2002-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.
* Remove namespace pollution by not including <sys/types.h> andmike2002-10-031-3/+6
| | | | | <time.h>, instead provide a local typedef for pid_t and forward declare struct timespec.
* Fix various style(9) bugs:mike2002-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.
* Fix various style(9) bugs:mike2002-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.
* Add the rest of the kernel support for the sem_ API in kern/uipc_sem.c.alfred2002-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.
* Completely redo thread states.julian2002-09-111-4/+4
| | | | Reviewed by: davidxu@freebsd.org
* Part 1 of KSE-IIIjulian2002-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..
* Change p_can{debug,see,sched,signal}()'s first argument to be a threadjhb2002-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.
* Remove __P.alfred2002-03-195-35/+35
|
* In a threaded world, differnt priorirites become properties ofjulian2002-02-111-4/+5
| | | | | | different entities. Make it so. Reviewed by: jhb@freebsd.org (john baldwin)
* Pre-KSE/M3 commit.julian2002-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,
* KSE Milestone 2julian2001-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
* Protect pri_to_rtp() with sched_lock when needed.jhb2001-09-021-0/+4
|
* Make various posix4 system calls MPSAFE (will fixup syscalls.master later)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()
* - Close races with signals and other AST's being triggered while we are injhb2001-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)
* o Replace calls to p_can(..., P_CAN_xxx) with calls to p_canxxx().rwatson2001-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
* o Unfold p31b_proc() into the individual posix4 system calls so as torwatson2001-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
* Replace some use of 'p' with 'targetp' so as to not scarily overload therwatson2001-06-301-11/+17
| | | | | | passed 'p' argument. No functional change. Obtained from: USENIX Emporium, Cheap Tricks Department
* Remove a fascinating but confusing construct involving chainingrwatson2001-06-281-33/+31
| | | | | | | | conditional clauses in the following way: (0 || a || b); No functional change.
* Add error checking for copyin() operations in posix4 scheduling code.rwatson2001-06-281-2/+6
|
* o Merge contents of struct pcred into struct ucred. Specifically, add therwatson2001-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
* o First step in cleaning up authorization code for the posix4rwatson2001-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
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-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)
* Overhaul of the SMP code. Several portions of the SMP kernel support havejhb2001-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
* Change the pfind() and zpfind() functions to lock the process that theyjhb2001-04-241-2/+4
| | | | | | find before releasing the allproc lock and returning. Reviewed by: -smp, dfr, jake
* Lock need_resched with sched_lock.jhb2001-02-221-2/+7
| | | | Reported by: des
* Implement a unified run queue and adjust priority levels accordingly.jake2001-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.
* Add $FreeBSD$peter2000-05-011-0/+1
|
* Remove unneeded #include <sys/kernel.h>phk2000-04-291-1/+0
|
* Add $FreeBSD$.wollman2000-04-221-0/+17
| | | | | Initialize the POSIX.1b sysconf information appropriately for non-optional kernel functions.
* Commit major SMP cleanups and move the BGL (big giant lock) in thedillon2000-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
* Track libc_r addition of semaphores implementation.jasone2000-01-201-10/+16
| | | | Approved by: jkh
OpenPOWER on IntegriCloud