summaryrefslogtreecommitdiffstats
path: root/sys/kern/sysv_msg.c
Commit message (Collapse)AuthorAgeFilesLines
* Add much needed descriptions for a number of the IPC related sysctl OIDs.csjp2005-02-121-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This information will be very useful for people who are tuning applications which have a dependence on IPC mechanisms. The following OIDs were documented: Message queues: kern.ipc.msgmax kern.ipc.msgmni kern.ipc.msgmnb kern.ipc.msgtlq kern.ipc.msgssz kern.ipc.msgseg Semaphores: kern.ipc.semmap kern.ipc.semmni kern.ipc.semmns kern.ipc.semmnu kern.ipc.semmsl kern.ipc.semopm kern.ipc.semume kern.ipc.semusz kern.ipc.semvmx kern.ipc.semaem Shared memory: kern.ipc.shmmax kern.ipc.shmmin kern.ipc.shmmni kern.ipc.shmseg kern.ipc.shmall kern.ipc.shm_use_phys kern.ipc.shm_allow_removed kern.ipc.shmsegs These new descriptions can be viewed using sysctl -d PR: kern/65219 Submitted by: Dan Nelson <dnelson at allantgroup dot com> (modified) No objections: developers@ Descriptions reviewed by: gnn MFC after: 1 week
* - Tweak kern_msgctl() to return a copy of the requested message queue idjhb2005-02-071-7/+5
| | | | | | | | | | | | | | | | | structure in the struct pointed to by the 3rd argument for IPC_STAT and get rid of the 4th argument. The old way returned a pointer into the kernel array that the calling function would then access afterwards without holding the appropriate locks and doing non-lock-safe things like copyout() with the data anyways. This change removes that unsafeness and resulting race conditions as well as simplifying the interface. - Implement kern_foo wrappers for stat(), lstat(), fstat(), statfs(), fstatfs(), and fhstatfs(). Use these wrappers to cut out a lot of code duplication for freebsd4 and netbsd compatability system calls. - Add a new lookup function kern_alternate_path() that looks up a filename under an alternate prefix and determines which filename should be used. This is basically a more general version of linux_emul_convpath() that can be shared by all the ABIs thus allowing for further reduction of code duplication.
* Split out kernel side of msgctl(2) into two parts: the first that pops datasobomax2005-01-261-21/+37
| | | | | | | | from the userland and pushes results back and the second which does actual processing. Use the latter to eliminate stackgap in the linux wrapper of that syscall. MFC after: 2 weeks
* Invoke label initialization, creation, cleanup, and tear-down MACrwatson2005-01-221-0/+162
| | | | | | | | Framework entry points for System V IPC message queues. Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net> Obtained from: TrustedBSD Project Sponsored by: DARPA, SPAWAR, McAfee Research
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-061-1/+1
|
* Make the sysctls kern.ipc.msgmnb and kern.ipc.msgtql into tunables asrwatson2004-12-301-2/+4
| | | | | | | | | is the case for most other sysctls in the System V IPC message queue implementation. PR: 75541 Submitted by: Sergiy Vyshnevetskiy <serg at vostok dot net> MFC after: 2 weeks
* Second of several commits to allow kernel System V IPC data structuresrwatson2004-11-121-134/+126
| | | | | | | | | | | | | | | | to be modified and extended without breaking the user space ABI: Use _kernel variants on _ds structures for System V sempahores, message queues, and shared memory. When interfacing with userspace, export only the _ds subsets of the _kernel data structures. A lot of search and replace. Define the message structure in the _KERNEL portion of msg.h so that it can be used by other kernel consumers, but not exposed to user space. Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net> Obtained from: TrustedBSD Project Sponsored by: DARPA, SPAWAR, McAfee Research
* Add missing #include <sys/module.h>phk2004-05-301-0/+1
|
* Slight whitespace consistency improvement:rwatson2003-11-071-1/+1
| | | | | Trim trailing whitespace. Remove unmatched " " before ")".
* Change all SYSCTLS which are readonly and have a related TUNABLEsilby2003-10-211-3/+3
| | | | | from CTLFLAG_RD to CTLFLAG_RDTUN so that sysctl(8) can provide more useful error messages.
* Update some argument-documenting comments to match reality.nectar2003-08-071-2/+3
| | | | | Add an explicit range check to those same arguments to reduce risk of cardiac arrest in future code readers.
* Use __FBSDID().obrien2003-06-111-2/+3
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-4/+4
| | | | Approved by: trb
* fix warningsalfred2003-01-261-2/+2
|
* Add const qualifier to data argument for msgsnd.alfred2003-01-261-2/+2
| | | | | PR: standards/45274 Submitted by: Craig Rodrigues <rodrigc@attbi.com>
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-4/+4
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* o Clear a high bit of ipc_perm.seq so msgget(3) never returns amaxim2002-12-151-1/+1
| | | | | | | | negative message queue id. PR: kern/46122 Submitted by: Vladimir B.Grebenschikov <vova@sw.ru> MFC after: 2 weeks
* Make SYSVMSG mpsafe. Right now there is a global lock over thealfred2002-08-131-19/+31
| | | | | | | | | | entire subsystem, we could move to per-message queue locks, however the messages themselves seem to come from a global pool and to avoid over-locking this code (locking individual queues, then the global pool) I've opted to just do it this way. Requested by: rwatson Tested by: NetBSD's regression suite.
* Cleanup:alfred2002-07-221-184/+83
| | | | | Define a debug printf macro rather than wrapping all calls to printf with #ifdefs.
* Remove caddr_t.alfred2002-07-221-16/+14
|
* Consistently use semicolons to terminate macro invocations. Cleanermarkm2002-07-151-1/+1
| | | | style and fixes later warnings.
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-1/+1
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* Remove __P.alfred2002-03-191-4/+4
|
* - Use td_ucred for jail checks.jhb2002-03-051-30/+17
| | | | | | | | - Move jail checks and some other checks involving constants and stack variables out from under Giant. This isn't perfectly safe atm because jail_sysvipc_allowed is read w/o a lock meaning that its value could be stale. This global variable will soon become a per-jail flag, however, at which time it will either not need a lock or will use the prison lock.
* Make AIO a loadable module.alfred2001-12-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Remove the explicit call to aio_proc_rundown() from exit1(), instead AIO will use at_exit(9). Add functions at_exec(9), rm_at_exec(9) which function nearly the same as at_exec(9) and rm_at_exec(9), these functions are called on behalf of modules at the time of execve(2) after the image activator has run. Use a modified version of tegge's suggestion via at_exec(9) to close an exploitable race in AIO. Fix SYSCALL_MODULE_HELPER such that it's archetecuterally neutral, the problem was that one had to pass it a paramater indicating the number of arguments which were actually the number of "int". Fix it by using an inline version of the AS macro against the syscall arguments. (AS should be available globally but we'll get to that later.) Add a primative system for dynamically adding kqueue ops, it's really not as sophisticated as it should be, but I'll discuss with jlemon when he's around.
* Make msgseg, msgssz (->msgmax) and msgmni TUNABLE.mr2001-09-211-0/+5
|
* KSE Milestone 2julian2001-09-121-35/+30
| | | | | | | | | | | | | | 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
* Giant Pushdown: sysv shm, sem, and msg calls.dillon2001-08-311-86/+158
|
* Fix obsolete code.asmodai2001-07-301-5/+0
| | | | | | | | FreeBSD _does_ define ENOMSG, so no need for checking if we support it. Inspired by PR: 22470 Which was submitted by: Bjorn Tornqvist <bjorn@west.se> MFC after: 1 week
* Export via sysctl:dd2001-05-301-0/+18
| | | | | | | | | | | * all members of msginfo from sysv_msg.c; * msqids from sysv_msg.c; * sema from sysv_sem.c; and * shmsegs from sysv_shm.c; These will be used by ipcs(1) in non-kvm mode. Reviewed by: tmm
* o Move per-process jail pointer (p->pr_prison) to inside of the subjectrwatson2001-02-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | credential structure, ucred (cr->cr_prison). o Allow jail inheritence to be a function of credential inheritence. o Abstract prison structure reference counting behind pr_hold() and pr_free(), invoked by the similarly named credential reference management functions, removing this code from per-ABI fork/exit code. o Modify various jail() functions to use struct ucred arguments instead of struct proc arguments. o Introduce jailed() function to determine if a credential is jailed, rather than directly checking pointers all over the place. o Convert PRISON_CHECK() macro to prison_check() function. o Move jail() function prototypes to jail.h. o Emulate the P_JAILED flag in fill_kinfo_proc() and no longer set the flag in the process flags field itself. o Eliminate that "const" qualifier from suser/p_can/etc to reflect mutex use. Notes: o Some further cleanup of the linux/jail code is still required. o It's now possible to consider resolving some of the process vs credential based permission checking confusion in the socket code. o Mutex protection of struct prison is still not present, and is required to protect the reference count plus some fields in the structure. Reviewed by: freebsd-arch Obtained from: TrustedBSD Project
* Use predictable internal names for the sysvipc modules, so we have ades2001-01-141-3/+4
| | | | chance of getting dependencies working.
* Add forgotten SYSCALL_MODULE_HELPER() for msgsys() syscall.alfred2000-12-051-0/+1
| | | | Discovered by: Valentin Chopov <valentin@valcho.net>
* sysvipc loadable.alfred2000-12-011-4/+69
| | | | | | new syscall entry lkmressys - "reserved loadable syscall" Make syscall_register allow overwriting of such entries (lkmressys).
* o Deny access to System V IPC from within jail by default, as in therwatson2000-10-311-0/+16
| | | | | | | | | | | | current implementation, jail neither virtualizes the Sys V IPC namespace, nor provides inter-jail protections on IPC objects. o Support for System V IPC can be enabled by setting jail.sysvipc_allowed=1 using sysctl. o This is not the "real fix" which involves virtualizing the System V IPC namespace, but prevents processes within jail from influencing those outside of jail when not approved by the administrator. Reported by: Paulo Fragoso <paulo@nlink.com.br>
* Fully initialize msqids[]. This could lead to ENOSPC and other strangepeter2000-09-191-0/+1
| | | | | | | stuff. PR: 21085 Submitted by: Marcin Cieslak <saper@SYSTEM.PL>
* Move the MSG* and SEM* options to opt_sysvipc.hpeter2000-05-011-36/+93
| | | | | | | | | | | | | | | Remove evil allocation macros from machdep.c (why was that there???) and use malloc() instead. Move paramters out of param.h and into the code itself. Move a bunch of internal definitions from public sys/*.h headers (without #ifdef _KERNEL even) into the code itself. I had hoped to make some of this more dynamic, but the cost of doing wakeups on all sleeping processes on old arrays was too frightening. The other possibility is to initialize on the first use, and allow dynamic sysctl changes to parameters right until that point. That would allow /etc/rc.sysctl to change SEM* and MSG* defaults as we presently do with SHM*, but without the nightmare of changing a running system.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Change suser_xxx() to suser() where it applies.phk1999-04-271-11/+8
|
* Suser() simplification:phk1999-04-271-2/+2
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* The function msgrcv() could copy larger data than it should dosada1999-04-211-3/+3
| | | | | | under some circumstances. PR: kern/10765 Submitted by: Yasuhito FUTATSUKI <futatuki@fureai.or.jp>
* Use suser() to determine super-user-ness, don't examine cr_uid directly.phk1999-01-301-3/+6
|
* Eradicate the variable "time" from the kernel, using various measures.phk1998-03-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde
* Move the "retval" (3rd) parameter from all syscall functions and putphk1997-11-061-20/+15
| | | | | | | | | | | | it in struct proc instead. This fixes a boatload of compiler warning, and removes a lot of cruft from the sources. I have not removed the /*ARGSUSED*/, they will require some looking at. libkvm, ps and other userland struct proc frobbing programs will need recompiled.
* Removed unused #includes.bde1997-08-021-3/+1
|
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Don't depend in the kernel on the gcc feature of doing arithmetic onbde1996-08-311-5/+5
| | | | pointers of type `void *'. Warn about this in future.
* Somehow managed to miss these four files when converting the SYSV IPCwollman1996-01-051-1/+3
| | | | options over to the new style.
* Update sysv_*.c to get their argument definitions from sysproto.hpeter1995-12-151-13/+23
|
OpenPOWER on IntegriCloud