summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_ipc.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r283416:dchagin2016-01-091-10/+0
| | | | | | x86_64 Linux do not use multiplexing on ipc system calls. Move struct ipc_perm definition to the MD path as it differs for 64 and 32 bit platform.
* Convert files to UTF-8uqs2012-01-151-1/+1
|
* In order to maximize the re-usability of kernel code in user space thiskmacy2011-09-161-6/+6
| | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz)
* Remove the 'either' from the comment as it'll be less obvious that webz2011-07-171-4/+4
| | | | | | removed semmap in a bit of time from now. Re-wrap. Suggested by: jhb
* Remove semaphore map entry count "semmap" field and its tuningbz2011-07-141-1/+9
| | | | | | | | | | | option that is highly recommended to be adjusted in too much documentation while doing nothing in FreeBSD since r2729 (rev 1.1). ipcs(1) needs to be recompiled as it is accessing _KERNEL private variables. Reviewed by: jhb (before comment change on linux code) Sponsored by: Sandvine Incorporated
* Style(9) fixes. No functional changes.dchagin2011-03-121-252/+261
| | | | MFC after: 2 Week
* Fix typo in kernel message. The fix is based upon the patch in the PR.netchild2009-11-051-1/+1
| | | | | | PR: kern/140279 Submitted by: Alexander Best <alexbestms@math.uni-muenster.de> MFC after: 1 week
* Change the ABI of some of the structures used by the SYSV IPC API:jhb2009-06-241-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The uid/cuid members of struct ipc_perm are now uid_t instead of unsigned short. - The gid/cgid members of struct ipc_perm are now gid_t instead of unsigned short. - The mode member of struct ipc_perm is now mode_t instead of unsigned short (this is merely a style bug). - The rather dubious padding fields for ABI compat with SV/I386 have been removed from struct msqid_ds and struct semid_ds. - The shm_segsz member of struct shmid_ds is now a size_t instead of an int. This removes the need for the shm_bsegsz member in struct shmid_kernel and should allow for complete support of SYSV SHM regions >= 2GB. - The shm_nattch member of struct shmid_ds is now an int instead of a short. - The shm_internal member of struct shmid_ds is now gone. The internal VM object pointer for SHM regions has been moved into struct shmid_kernel. - The existing __semctl(), msgctl(), and shmctl() system call entries are now marked COMPAT7 and new versions of those system calls which support the new ABI are now present. - The new system calls are assigned to the FBSD-1.1 version in libc. The FBSD-1.0 symbols in libc now refer to the old COMPAT7 system calls. - A simplistic framework for tagging system calls with compatibility symbol versions has been added to libc. Version tags are added to system calls by adding an appropriate __sym_compat() entry to src/lib/libc/incldue/compat.h. [1] PR: kern/16195 kern/113218 bin/129855 Reviewed by: arch@, rwatson Discussed with: kan, kib [1]
* Document that all the other commands are eitherrdivacky2008-11-261-0/+16
| | | | | | | | | identical to the FreeBSD ones or rejected by kern_msgctl(). Found with: Coverity Prevent(tm) CID: 3456 Approved by: kib (mentor)
* MFp4 (112379):netchild2007-01-141-2/+6
| | | | | | | Implement SETALL/GETALL IPC primitives. This fixes some LTP testcases and LabView is able to proceed a little bit further. Submitted by: rdivacky
* MFP4: 110179jkim2006-12-201-3/+41
| | | | | | Add rudimentary IPC_INFO/MSG_INFO command support for linux_msgctl() to pacify Linux ipcs(1). While I am here, add more bound checks for linux_msgsnd() and linux_msgrcv().
* MFP4: (part of) 110058jkim2006-12-201-24/+26
| | | | Use new kern_msgsnd()/kern_msgrcv() to fix linux32 emulation on amd64.
* Don't pass unused bufsz to kern_shmctl().jhb2006-10-101-7/+6
|
* Only try to copyin a msqid for the IPC_SET command to msgctl(). Otherjhb2006-10-101-5/+6
| | | | | | commands (such as IPC_RMID) were bogusly failing with EFAULT. Tested by: jkim
* Remove unnecessary casts before PTRIN().jhb2006-10-101-11/+11
|
* Rework kern_semctl a bit to always assume the UIO_SYSSPACE case. Thisjhb2006-07-081-11/+12
| | | | | | | | | | | | | | | mostly consists of pushing a few copyin's and copyout's up into __semctl() as all the other callers were already doing the UIO_SYSSPACE case. This also changes kern_semctl() to set the return value in a passed in pointer to a register_t rather than td->td_retval[0] directly so that callers can only set td->td_retval[0] if all the various copyout's succeed. As a result of these changes, kern_semctl() no longer does copyin/copyout (except for GETALL/SETALL) so simplify the locking to acquire the semakptr mutex before the MAC check and hold it all the way until the end of the big switch statement. The GETALL/SETALL cases have to temporarily drop it while they do copyin/malloc and copyout. Also, simplify the SETALL case to remove handling for a non-existent race condition.
* - Add a kern_semctl() helper function for __semctl(). It accepts a pointerjhb2006-06-271-38/+26
| | | | | | | to a copied-in copy of the 'union semun' and a uioseg to indicate which memory space the 'buf' pointer of the union points to. This is then used in linux_semctl() and svr4_sys_semctl() to eliminate use of the stackgap. - Mark linux_ipc() and svr4_sys_semsys() MPSAFE.
* Unbreak COMPAT_LINUX32 option support on amd64.ru2006-03-191-0/+2
| | | | Broken by: netchild
* Fixup some problems in my previous commit (COMPAT_43).netchild2006-03-181-2/+0
| | | | Pointyhat to: netchild
* Move MODULE_DEPEND() statements for SYSVIPC dependencies to linux_ipc.cjhb2005-07-291-0/+4
| | | | | so that they aren't duplicated 3 times and are also in the same file as the code that depends on the SYSVIPC modules.
* Semctl with IPC_STAT command should return zero in case of success.sobomax2005-02-111-2/+3
| | | | | | PR: 73778 Submitted by: Andriy Gapon <avg@icyb.net.ua> MFC after: 2 weeks
* - Tweak kern_msgctl() to return a copy of the requested message queue idjhb2005-02-071-3/+2
| | | | | | | | | | | | | | | | | 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-17/+10
| | | | | | | | 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
* Match the LINUX32's style with existing styleobrien2005-01-141-9/+9
| | | | | | Submitted by: Jung-uk Kim <jkim@niksun.com> Use positive, not negative logic.
* Changes to MI Linux emulation code necessary to run 32-bit Linux binariestjr2004-08-161-34/+56
| | | | | | | | | | | | | | | on AMD64, and the general case where the emulated platform has different size pointers than we use natively: - declare certain structure members as l_uintptr_t and use the new PTRIN and PTROUT macros to convert to and from native pointers. - declare some structures __packed on amd64 when the layout would differ from that used on i386. - include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h> if compiling with COMPAT_LINUX32. This will need to be revisited before 32-bit and 64-bit Linux emulation support can coexist in the same kernel. - other small scattered changes. This should be a no-op on i386 and Alpha.
* Back out the following revisions:fjoe2003-11-051-6/+6
| | | | | | | | | | | | | | | | | | 1.36 +73 -60 src/sys/compat/linux/linux_ipc.c 1.83 +102 -48 src/sys/kern/sysv_shm.c 1.8 +4 -0 src/sys/sys/syscallsubr.h That change was intended to support vmware3, but wantrem parameter is useless because vmware3 uses SYSV shared memory to talk with X server and X server is native application. The patch worked because check for wantrem was not valid (wantrem and SHMSEG_REMOVED was never checked for SHMSEG_ALLOCATED segments). Add kern.ipc.shm_allow_removed (integer, rw) sysctl (default 0) which when set to 1 allows to return removed segments in shm_find_segment_by_shmid() and shm_find_segment_by_shmidx(). MFC after: 1 week
* Use __FBSDID().obrien2003-06-101-2/+3
|
* Change the semantics of sysv shm emulation to take a additionalmbr2003-05-051-60/+73
| | | | | | | | | | | | | | | | | argument to the functions shm{at,ctl}1 and shm_find_segment_by_shmid{x}. The BSD semantics didn't allow the usage of shared segment after being marked for removal through IPC_RMID. The patch involves the following functions: - shmat - shmctl - shm_find_segment_by_shmid - shm_find_segment_by_shmidx - linux_shmat - linux_shmctl Submitted by: Orlando Bassotto <orlando.bassotto@ieo-research.it> Reviewed by: marcel
* Deprecate machine/limits.h in favor of new sys/limits.h.kan2003-04-291-2/+1
| | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
* Clean up whitespace and remove register keyword.des2003-03-031-16/+16
|
* More caddr_t removal, in conjunction with copy{in,out}(9) this time.des2003-03-031-3/+3
| | | | Also clean up some egregious casts and incorrect use of sizeof.
* Add function linux_msg() for regulating output from the linux emulationalfred2003-01-021-3/+2
| | | | | | | | | | | code, make the emulator use it. Rename unsupported_msg() to unimplemented_syscall(). Rename some arguments for clarity Fixup grammar. Requested by: bde
* - Add support for IPC_64 extensions into shmctl(2), semctl(2) and msgctl(2);sobomax2002-10-111-23/+285
| | | | | | | | | | | | | - add wrappers for mmap2(2) and ftruncate64(2) system calls; - don't spam console with printf's when VFAT_READDIR_BOTH ioctl(2) is invoked; - add support for SOUND_MIXER_READ_STEREODEVS ioctl(2); - make msgctl(IPC_STAT) and IPC_SET actually working by converting from BSD msqid_ds to Linux and vice versa; - properly return EINVAL if semget(2) is called with nsems being negative. Reviewed by: marcel Approved by: marcel Tested with: LSB runtime test
* Fix typo in the BSD copyright: s/withough/without/schweikh2002-06-021-1/+1
| | | | | Spotted and suggested by: des MFC after: 3 weeks
* In msgrcv(), set msgtyp correctly. Hardwiring 0 as the message typemarcel2002-05-181-1/+1
| | | | | | | | | | yields incorrect behaviour. The hardwiring was present in the very first commit that implemented msgrcv() (revision 1.4) and hasn't been changed since. The native implementation was complete at that time, so there doesn't seem to be a reason for the hardwiring from a technical point of view. Submitted by: Reinier Bezuidenhout <rbezuide@yahoo.com>
* Introduce [IPC|SHM]_[INFO|STAT] to shmctl to makemr2001-10-281-3/+52
| | | | `/compat/linux/usr/bin/ipcs -m` happy.
* Swap the src and dst arguments of the bcopy added in themarcel2001-09-281-1/+1
| | | | previous commit. It ain't memcpy... *cough*
* The arg parameter is passed by value in Linux, but not in FreeBSD.marcel2001-09-261-5/+6
| | | | | | | | | We still have to account for a copyin. Make sure the copyin will succeed by passing the FreeBSD syscall a pointer to userspace, albeit one that's automagically mapped into kernel space. Reported by: mr, Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org> Tested by: Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
* Implement LINUX_[SEM|IPC]_[STAT|INFO]mr2001-09-151-2/+58
| | | | | | | to make /compat/linux/usr/bin/ipcs -s happy. PR: kern/29698 (part) Reviewed by: audit
* KSE Milestone 2julian2001-09-121-28/+28
| | | | | | | | | | | | | | 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
* Round of cleanups and enhancements. These include (in random order):marcel2001-09-081-126/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Introduce private types for use in linux syscalls for two reasons: 1. establish type independence for ease in porting and, 2. provide a visual queue as to which syscalls have proper prototypes to further cleanup the i386/alpha split. Linuxulator types are prefixed by 'l_'. void and char have not been "virtualized". o Provide dummy functions for all syscalls and remove dummy functions or implementations of truely obsolete syscalls. o Sanitize the shm*, sem* and msg* syscalls. o Make a first attempt to implement the linux_sysctl syscall. At this time it only returns one MIB (KERN_VERSION), but most importantly, it tells us when we need to add additional sysctls :-) o Bump the kenel version up to 2.4.2 (this is not the same as the KERN_VERSION MIB, BTW). o Implement new syscalls, of which most are specific to i386. Our syscall table is now up to date with Linux 2.4.2. Some highlights: - Implement the 32-bit uid_t and gid_t bases syscalls. - Implement a couple of 64-bit file size/offset bases syscalls. o Fix or improve numerous syscalls and prototypes. o Reduce style(9) violations while I'm here. Especially indentation inconsistencies within the same file are addressed. Re-indenting did not obfuscate actual changes to the extend that it could not be combined. NOTE: I spend some time testing these changes and found that if there were regressions, they were not caused by these changes AFAICT. It was observed that installing a RH 7.1 runtime environment did make matters worse. Hangs and/or reboots have been observed with and without these changes, so when it failed to make life better in cases it doesn't look like it made it worse.
* Don't auto-generate the syscalls.marcel2000-12-031-4/+0
|
* Revert auto-generation. The Alpha port is broken.marcel2000-11-101-0/+4
| | | | Syncing with it is wrong.
* Sync with Alpha:marcel2000-11-091-4/+0
| | | | | Do not use sysent.c, proto.h and syscall.h in source tree; use auto-generated versions.
* Support for the linux ipc syscalls on the alpha, where each one hasgallatin2000-11-011-13/+15
| | | | | its own syscall rather than going through a demux function like linux_ipc() on i386
* The MI/MD split wasn't perfect and the MI files need hacks for theobrien2000-11-011-0/+4
| | | | | | AlphaLinux compat bits. This will be better cleaned up soon. Agreed to what ever was necessary by: marcel
* Update include directives.marcel2000-08-221-58/+15
| | | | | | | Make the sem*, msg* and shm* function non-static as they are called from MD code. Move linux_ipc to MD code.
* Linux doesn't complain if you remove a msg queue that doesn't existmarcel1999-09-231-1/+3
| | | | (given the proper permissions).
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* ".. x11amp appears to be calling shmctl(id, IPC_RMID, 0) and the emulationjkh1998-06-021-9/+13
| | | | | | | | layer does not like the null shmid_ds buffer pointer. The emulation layer returned an error without ever calling FreeBSD's shmctl, so the segments were not being deleted when the reference count went to zero." Submitted by: Kevin Street <street@iname.com>
OpenPOWER on IntegriCloud