summaryrefslogtreecommitdiffstats
path: root/sys/posix4
Commit message (Collapse)AuthorAgeFilesLines
* Add scheduler API sched_relinquish(), the API is used to implementdavidxu2006-06-151-3/+1
| | | | | | | yield() and sched_yield() syscalls. Every scheduler has its own way to relinquish cpu, the ULE and CORE schedulers have two internal run- queues, a timesharing thread which calls yield() syscall should be moved to inactive queue.
* Don't allow non-root user to set a scheduler policy, otherwise this coulddavidxu2006-05-211-0/+4
| | | | | | be a local DOS. Submitted by: Diane Bruce at db at db.net
* Style fixes.davidxu2006-05-192-34/+51
| | | | Submitted by: Diane Bruce < db at db dot net >
* Use proc lock to prevent a thread from exiting, Giant was no longer used todavidxu2006-04-102-27/+10
| | | | protect thread list.
* mqueue.h has been superceded by sys/mqueue.h thanks to David Xu's work.scottl2005-11-281-77/+0
| | | | Submitted by: dolt
* Const-qualify ksem_timedwait's parameter abstime as it's only passed in.stefanf2005-10-181-1/+1
|
* Introduce MAC Framework and MAC Policy entry points to label and controlrwatson2005-05-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | access to POSIX Semaphores: mac_init_posix_sem() Initialize label for POSIX semaphore mac_create_posix_sem() Create POSIX semaphore mac_destroy_posix_sem() Destroy POSIX semaphore mac_check_posix_sem_destroy() Check whether semaphore may be destroyed mac_check_posix_sem_getvalue() Check whether semaphore may be queried mac_check_possix_sem_open() Check whether semaphore may be opened mac_check_posix_sem_post() Check whether semaphore may be posted to mac_check_posix_sem_unlink() Check whether semaphore may be unlinked mac_check_posix_sem_wait() Check whether may wait on semaphore Update Biba, MLS, Stub, and Test policies to implement these entry points. For information flow policies, most semaphore operations are effectively read/write. Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net> Sponsored by: DARPA, McAfee, SPARTA Obtained from: TrustedBSD Project
* Move definitions of 'struct kuser' and 'struct ksem' from uipc_sem.crwatson2005-05-031-0/+55
| | | | | | | | | | | to ksem.h so that they are accessible from the MAC Framework for the purposes of labeling and enforcing additional protections. #error if these are included without _KERNEL, since they are not intended (nor installed) for user application use. Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net> Sponsored by: DARPA, SPARTA Obtained from: TrustedBSD Project
* Actually commit the code for kern_sched_get_rr_interval().jhb2005-03-311-13/+20
|
* /* -> /*- 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)
OpenPOWER on IntegriCloud