aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_ipc.c
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-231-2/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in current: (cherry picked from commit 685dc743dc3b)
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-07-251-1/+1
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
* linux(4): Rename linux_timer.h to linux_time.hDmitry Chagin2023-03-011-1/+1
| | | | | | | | | | | To avoid confusing people, rename linux_timer.h to linux_time.h, as linux_timer.c is the implementation of timer syscalls only, while linux_time.c contains implementation of all stuff declared in linux_time.h. MFC after: 2 weeks (cherry picked from commit c8a79231a5a74fc4263ec3d18c6519a974efb529)
* linux(4): Cleanup includes under compat/linuxDmitry Chagin2023-03-011-4/+3
| | | | | | | | | Cleanup unneeded includes, sort the rest according to style(9). No functional changes. MFC after: 2 weeks (cherry picked from commit d8e53d94fae90cf3c83db5af0eaba0be0f55e00a)
* linux(4): Cleanup sys/sysent.h from linux_utilDmitry Chagin2023-03-011-0/+1
| | | | | | | | | | Include sys/sysent.h directly where it needed. The linux_util.h included in a most source files of the Linuxulator, avoid collecting a rarely used includes here. MFC after: 2 weeks (cherry picked from commit 513eb69edf382923bff1b09edda64010d89f74bd)
* linux(4): Get rid of the opt_compat.h include.Dmitry Chagin2023-02-261-2/+0
| | | | | | | | | Since e013e369 COMPAT_LINUX, COMPAT_LINUX32 build options are removed, so include of opt_compat.h is no more needed. MFC after: 2 weeks (cherry picked from commit 10d16789a383a5b9e007dfd4c2e7844e044eaf7d)
* linux(4): Microoptimize linux_ipc code to unindent else blocks.Dmitry Chagin2023-02-091-120/+100
| | | | | | | | No functional change. MFC after: 1 week (cherry picked from commit eb08932156dc5801418924cf0bf9f167b15f7bf0)
* linux(4): Use designated initializers.Dmitry Chagin2023-02-091-34/+22
| | | | | | MFC after: 1 week (cherry picked from commit 3e0c56a717d6af3b680463b25388c7acd7cb8844)
* linux(4): Add a helper intended for copying timespec's from the userspace.Dmitry Chagin2022-06-171-8/+2
| | | | | | | | | | There are many places where we copyin Linux timespec from the userspace and then convert it to the kernel timespec. To avoid code duplication add a tiny halper for doing this. MFC after: 2 weeks (cherry picked from commit 707e567a4061669b7643ddbe8a1ad9c4e6545a75)
* linux(4): Implement semtimedop syscalls.Dmitry Chagin2022-06-171-0/+45
| | | | | | | | | | On i386 are two semtimedop. The old one is called via multiplexor and uses 32-bit timespec, and new semtimedop_tim64, which is uses 64-bit timespec. MFC after: 2 weeks (cherry picked from commit 3245a2ecea21ace3d97cec1266fbe29c88ba1a59)
* linux(4): Retire linux_semop implementation.Dmitry Chagin2022-06-171-17/+0
| | | | | | | | | In i386 Linux semop called via ipc() multiplexor, so use kern_semop directly from multiplexor. MFC after: 2 weeks (cherry picked from commit f48a68874bf4503a18c0c55887a028dab0a4600f)
* compat: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365080
* Linux between 4.18 and 5.0 split IPC system calls.Dmitry Chagin2019-03-241-13/+1
| | | | | | | | | | In preparation for doing this in the Linuxulator modify our linux_shmat() to match actual Linux shmat() system call. MFC after: 1 month Notes: svn path=/head/; revision=345469
* sys/linux: Fix a few potential infoleaks in Linux IPCEitan Adler2018-03-031-0/+10
| | | | | | | | Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> MFC After: 1 month Notes: svn path=/head/; revision=330356
* Rationalize license text on Linuxolator filesEd Maste2018-02-161-15/+13
| | | | | | | | | | | | | | | Many licenses on Linuxolator files contained small variations from the standard FreeBSD license text. To avoid license proliferation switch to the standard 2-clause FreeBSD license for those files where I have permission from each of the listed copyright holders. Additional files waiting on permission from others are listed in review D14210. Approved by: kan, marcel, sos, rdivacky MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=329370
* Linuxolator whitespace cleanupEd Maste2018-02-051-2/+2
| | | | | | | | | | | | | A version of each of the MD files by necessity exists for each CPU architecture supported by the Linuxolator. Clean these up so that new architectures do not inherit whitespace issues. Clean up shared Linuxolator files while here. Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=328890
* sys/compat: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326266
* Prevent ushort values overflow when convert new Linux 64-bit ipcDmitry Chagin2017-04-071-2/+2
| | | | | | | | | | | | struct to the old Linux ipc struct. Reported by: PVS-Studio XMFC with: r314866 MFC after: 3 days Notes: svn path=/head/; revision=316599
* Linux semop system call return EINVAL in case when the invalid nsopsDmitry Chagin2017-03-071-0/+2
| | | | | | | | | or semid values specified. MFC after: 1 month Notes: svn path=/head/; revision=314868
* Linux kernel does not export to the user space ipc_perm.mode valuesDmitry Chagin2017-03-071-1/+2
| | | | | | | | | other than S_IRWXUGO (0777). MFC after: 1 month Notes: svn path=/head/; revision=314867
* Reduce code duplication between MD Linux code by moving SYSV IPC 64-bitDmitry Chagin2017-03-071-175/+225
| | | | | | | | | | | | | | | | | related struct definitions out into the MI path. Invert the native ipc structs to the Linux ipc structs convesion logic. Since 64-bit variant of ipc structs has more precision convert native ipc structs to the 64-bit Linux ipc structs and then truncate 64-bit values into the non 64-bit if needed. Unlike Linux, return EOVERFLOW if the values do not fit. Fix SYSV IPC for 64-bit Linuxulator which never sets IPC_64 bit. MFC after: 1 month Notes: svn path=/head/; revision=314866
* Style(9).Dmitry Chagin2017-03-041-12/+12
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=314648
* Remove attribute __packed from some IPC struct definition sinceDmitry Chagin2017-03-041-11/+2
| | | | | | | | | | | | Linuxulator is x86 only. The only notable differences in algnment for an LP64 64-bit system when compared to a 32-bit system is an eight or large byte types alignment. MFC after: 1 month Notes: svn path=/head/; revision=314647
* x86_64 Linux do not use multiplexing on ipc system calls.Dmitry Chagin2015-05-241-10/+0
| | | | | | | | | | | Move struct ipc_perm definition to the MD path as it differs for 64 and 32 bit platform. Differential Revision: https://reviews.freebsd.org/D1068 Reviewed by: trasz Notes: svn path=/head/; revision=283416
* Convert files to UTF-8Ulrich Spörlein2012-01-151-1/+1
| | | | Notes: svn path=/head/; revision=230132
* In order to maximize the re-usability of kernel code in user space thisKip Macy2011-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) Notes: svn path=/head/; revision=225617
* Remove the 'either' from the comment as it'll be less obvious that weBjoern A. Zeeb2011-07-171-4/+4
| | | | | | | | | removed semmap in a bit of time from now. Re-wrap. Suggested by: jhb Notes: svn path=/head/; revision=224123
* Remove semaphore map entry count "semmap" field and its tuningBjoern A. Zeeb2011-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 Notes: svn path=/head/; revision=224016
* Style(9) fixes. No functional changes.Dmitry Chagin2011-03-121-243/+252
| | | | | | | MFC after: 2 Week Notes: svn path=/head/; revision=219558
* Fix typo in kernel message. The fix is based upon the patch in the PR.Alexander Leidinger2009-11-051-1/+1
| | | | | | | | | PR: kern/140279 Submitted by: Alexander Best <alexbestms@math.uni-muenster.de> MFC after: 1 week Notes: svn path=/head/; revision=198945
* Change the ABI of some of the structures used by the SYSV IPC API:John Baldwin2009-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] Notes: svn path=/head/; revision=194910
* Document that all the other commands are eitherRoman Divacky2008-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) Notes: svn path=/head/; revision=185337
* MFp4 (112379):Alexander Leidinger2007-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 Notes: svn path=/head/; revision=166008
* MFP4: 110179Jung-uk Kim2006-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(). Notes: svn path=/head/; revision=165407
* MFP4: (part of) 110058Jung-uk Kim2006-12-201-24/+26
| | | | | | | Use new kern_msgsnd()/kern_msgrcv() to fix linux32 emulation on amd64. Notes: svn path=/head/; revision=165404
* Don't pass unused bufsz to kern_shmctl().John Baldwin2006-10-101-7/+6
| | | | Notes: svn path=/head/; revision=163217
* Only try to copyin a msqid for the IPC_SET command to msgctl(). OtherJohn Baldwin2006-10-101-5/+6
| | | | | | | | | commands (such as IPC_RMID) were bogusly failing with EFAULT. Tested by: jkim Notes: svn path=/head/; revision=163216
* Remove unnecessary casts before PTRIN().John Baldwin2006-10-101-11/+11
| | | | Notes: svn path=/head/; revision=163215
* Rework kern_semctl a bit to always assume the UIO_SYSSPACE case. ThisJohn Baldwin2006-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. Notes: svn path=/head/; revision=160187
* - Add a kern_semctl() helper function for __semctl(). It accepts a pointerJohn Baldwin2006-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. Notes: svn path=/head/; revision=159991
* Unbreak COMPAT_LINUX32 option support on amd64.Ruslan Ermilov2006-03-191-0/+2
| | | | | | | Broken by: netchild Notes: svn path=/head/; revision=156874
* Fixup some problems in my previous commit (COMPAT_43).Alexander Leidinger2006-03-181-2/+0
| | | | | | | Pointyhat to: netchild Notes: svn path=/head/; revision=156850
* Move MODULE_DEPEND() statements for SYSVIPC dependencies to linux_ipc.cJohn Baldwin2005-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. Notes: svn path=/head/; revision=148540
* Semctl with IPC_STAT command should return zero in case of success.Maxim Sobolev2005-02-111-2/+3
| | | | | | | | | PR: 73778 Submitted by: Andriy Gapon <avg@icyb.net.ua> MFC after: 2 weeks Notes: svn path=/head/; revision=141691
* - Tweak kern_msgctl() to return a copy of the requested message queue idJohn Baldwin2005-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. Notes: svn path=/head/; revision=141471
* Split out kernel side of msgctl(2) into two parts: the first that pops dataMaxim Sobolev2005-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 Notes: svn path=/head/; revision=140839
* Match the LINUX32's style with existing styleDavid E. O'Brien2005-01-141-9/+9
| | | | | | | | | Submitted by: Jung-uk Kim <jkim@niksun.com> Use positive, not negative logic. Notes: svn path=/head/; revision=140214
* Changes to MI Linux emulation code necessary to run 32-bit Linux binariesTim J. Robbins2004-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. Notes: svn path=/head/; revision=133816
* Back out the following revisions:Max Khon2003-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 Notes: svn path=/head/; revision=122088
* Use __FBSDID().David E. O'Brien2003-06-101-2/+3
| | | | Notes: svn path=/head/; revision=116173