History log of /freebsd-current/sys/sys/shm.h
Revision Date Author Comments
# 87a15652 13-May-2024 Konstantin Belousov <kib@FreeBSD.org>

SysV IPC: provide in-kernel helpers to obtain ipcs(8)-like information

PR: 278949
Reviewed by: markj
Tested by: Ricardo Branco <rbranco@suse.de>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D45175


# 53725168 16-May-2024 Konstantin Belousov <kib@FreeBSD.org>

SysV SHM: move SHMSEG constants to sys/shm.h

There are planned consumers in linprocfs.

Tested by: Ricardo Branco <rbranco@suse.de>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D45175


# 71625ec9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c comment pattern

Remove /^/[*/]\s*\$FreeBSD\$.*\n/


# ea7e7006 15-Jan-2019 Konstantin Belousov <kib@FreeBSD.org>

Implement shmat(2) flag SHM_REMAP.

Based on the description in Linux man page.

Reviewed by: markj, ngie (previous version)
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18837


# 27b95863 15-Feb-2018 Brooks Davis <brooks@FreeBSD.org>

Get rid of the requirement to include SysV IPC headers with _KERNEL
defined in ipcrm by introducing _WANT_SYSVxxx_INTERNALS defines.

Reviewed by: jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14271


# c4e20cad 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/sys: further adoption of SPDX licensing ID tags.

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.


# b8db1c9f 14-Nov-2017 John Baldwin <jhb@FreeBSD.org>

Use #if instead of #ifdef for __BSD_VISIBLE tests.

__BSD_VISIBLE is always defined and it's value instead needs to be
tested via #if to determine if FreeBSD-specific APIs should be
exposed.

PR: 196226, 223481 (exp-run)
Submitted by: pluknet
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12977


# f63cd251 26-Jul-2016 Ed Schouten <ed@FreeBSD.org>

Add shmatt_t.

It looks like our "struct shmid_ds::shm_nattch" deviates from the
standard in the sense that it is a signed integer, whereas POSIX
requires that it is unsigned, having a special type shmatt_t.

Patch up our native and 32-bit copies to use a new shmatt_t that is an
unsigned integer. As it's unsigned, we can relax the comparisons that
are performed on it. Leave the Linux, iBCS2, etc. copies of the
structure alone.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D6655


# 0d7ed8fe 31-May-2016 Ed Schouten <ed@FreeBSD.org>

Add missing dependency on <machine/param.h>.

The SHMLBA definition provided by this header file is defined as
PAGE_SIZE. PAGE_SIZE is only available when <machine/param.h> is
included.


# 7f417bfa 03-May-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/sys: minor spelling fixes.

While the changes are minor, these headers are very visible.

MFC after: 2 weeks


# bc81f737 30-Jul-2015 Craig Rodrigues <rodrigc@FreeBSD.org>

Get function prototypes for msg, shm, sem functions
from header files.

Differential Revision: D2669


# 8caddd81 06-Apr-2011 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add ucred pointer to the SysV-related memory structures. This is required
for racct.

Note that after this commit, ipcs(1) needs to be rebuilt. Otherwise, it will
fail with "ipcs: sysctlbyname: kern.ipc.msqids: Cannot allocate memory".

Sponsored by: The FreeBSD Foundation
Reviewed by: kib (earlier version)


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# b648d480 24-Jun-2009 John Baldwin <jhb@FreeBSD.org>

Change the ABI of some of the structures used by the SYSV IPC API:
- 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]


# 7e005f01 14-Mar-2009 David Schultz <das@FreeBSD.org>

Namespace: semsys() and shmsys() aren't standard.


# 65067cc8 02-Mar-2009 Konstantin Belousov <kib@FreeBSD.org>

Correct types of variables used to track amount of allocated SysV shared
memory from int to size_t. Implement a workaround for current ABI not
allowing to properly save size for and report more then 2Gb sized segment
of shared memory.

This makes it possible to use > 2 Gb shared memory segments on 64bit
architectures. Please note the new BUGS section in shmctl(2) and
UPDATING note for limitations of this temporal solution.

Reviewed by: csjp
Tested by: Nikolay Dzham <i levsha org ua>
MFC after: 2 weeks


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 4f18813f 12-Feb-2008 Christian S.J. Peron <csjp@FreeBSD.org>

Make sure we restrict Linux only IPC calls from being executed
through the FreeBSD ABI. IPC_INFO, SHM_INFO, SHM_STAT were added
specifically for Linux binary support. They are not documented
as being a part of the FreeBSD ABI, also, the structures necessary
for them have been hidden away from the users for a long time.

Also, the Linux ABI layer uses it's own structures to populate the
responses back to the user to ensure that the ABI is consistent.

I think there is a bit more separation work that needs to happen.

Reviewed by: jhb
Discussed with: jhb
Discussed on: freebsd-arch@ (very briefly)
MFC after: 1 month


# 9baea4b4 06-Aug-2005 Christian S.J. Peron <csjp@FreeBSD.org>

Change the data type of the upper shared memory limits from a signed
integer to an unsigned long. This lifts variables like the maximum
number of pages available for shared memory from 2^31 to 2^32 on 32
bit architectures, and from 2^31 to 2^64 on 64 bit architectures.

It should be noted that this changes breaks ABI on 64 bit architectures
because the size of the shmmax, shmmin, shmmni, shmseg and shmall members
of the shminfo structure has changed.

Silence on: current@


# 0d892b4a 01-Apr-2005 David Schultz <das@FreeBSD.org>

This header is supposed to declare pid_t, size_t, and time_t.


# 60727d8b 06-Jan-2005 Warner Losh <imp@FreeBSD.org>

/* -> /*- for license, minor formatting changes


# 21335a5e 17-Nov-2004 Robert Watson <rwatson@FreeBSD.org>

In the kernel-only portionss of System V IPC objects (messages,
message queues, shared memory segments, and semaphores), add a struct
label pointer, which will hold the MAC labels for the objects. As a
result of recent work to separate kernel and user space ABIs, this
should not break the ABI for applications using System V IPC, but will
require a rebuild of the ipcs monitoring tool.

Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research


# b37d625c 12-Nov-2004 Robert Watson <rwatson@FreeBSD.org>

First of several commits to allow kernel System V IPC data structures
to be modified and extended without breaking the user space ABI:

Define _kernel wrapper data structures for the user-exposed data
structures that current server as the internal data structures for
the implementation:

- struct msqid_kernel wraps struct msqid_ds.
- struct semid_kernel wraps truct semid_ds.
- struct shmid_kernel wraps struct shmid_ds.
- Don't expose extern definition 'shmsegs' outside of sysv_shm.c.

Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research


# e1d7d0bb 25-Jan-2003 Alfred Perlstein <alfred@FreeBSD.org>

Bring shm functions closer the the opengroup standards.

PR: 47469
Submitted by: Craig Rodrigues <rodrigc@attbi.com>


# 3db161e0 13-Jan-2003 Matthew Dillon <dillon@FreeBSD.org>

It is possible for an active aio to prevent shared memory from being
dereferenced when a process exits due to the vmspace ref-count being
bumped. Change shmexit() and shmexit_myhook() to take a vmspace instead
of a process and call it in vmspace_dofree(). This way if it is missed
in exit1()'s early-resource-free it will still be caught when the zombie is
reaped.

Also fix a potential race in shmexit_myhook() by NULLing out
vmspace->vm_shm prior to calling shm_delete_mapping() and free().

MFC after: 7 days


# 789f12fe 19-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove __P


# 491dec93 28-Oct-2001 Michael Reifenberger <mr@FreeBSD.org>

Introduce [IPC|SHM]_[INFO|STAT] to shmctl to make
`/compat/linux/usr/bin/ipcs -m` happy.


# b40ce416 12-Sep-2001 Julian Elischer <julian@FreeBSD.org>

KSE Milestone 2
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


# 664a31e4 28-Dec-1999 Peter Wemm <peter@FreeBSD.org>

Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot). This is consistant with the other
BSD's who made this change quite some time ago. More commits to come.


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 8bcc577e 01-Feb-1998 Bruce Evans <bde@FreeBSD.org>

Forward declare more structs that are used in prototypes here - don't
depend on <sys/types.h> forward declaring common ones.


# 6875d254 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

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.


# e911eafc 02-May-1996 Poul-Henning Kamp <phk@FreeBSD.org>

removed:
CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei()
ptei() kvtopte() ptetov() ispt() ptetoav() &c &c
new:
NPDEPG

Major macro cleanup.


# dabee6fe 23-Feb-1996 Peter Wemm <peter@FreeBSD.org>

kern_descrip.c: add fdshare()/fdcopy()
kern_fork.c: add the tiny bit of code for rfork operation.
kern/sysv_*: shmfork() takes one less arg, it was never used.
sys/shm.h: drop "isvfork" arg from shmfork() prototype
sys/param.h: declare rfork args.. (this is where OpenBSD put it..)
sys/filedesc.h: protos for fdshare/fdcopy.
vm/vm_mmap.c: add minherit code, add rounding to mmap() type args where
it makes sense.
vm/*: drop unused isvfork arg.

Note: this rfork() implementation copies the address space mappings,
it does not connect the mappings together. ie: once the two processes
have split, the pages may be shared, but the address space is not. If one
does a mmap() etc, it does not appear in the other. This makes it not
useful for pthreads, but it is useful in it's own right for having
light-weight threads in a static shared address space.

Obtained from: Original by Ron Minnich, extended by OpenBSD


# 6c5e9bbd 30-Jan-1996 Mike Pritchard <mpp@FreeBSD.org>

Fix a bunch of spelling errors in the comment fields of
a bunch of system include files.


# 44fc47d7 29-Aug-1995 Bruce Evans <bde@FreeBSD.org>

Fix several sysinit functions that had the wrong type and unnecessarily
external linkage.


# 28f8db14 29-Jul-1995 Bruce Evans <bde@FreeBSD.org>

Eliminate sloppy common-style declarations. There should be none left for
the LINT configuation.


# aed5ecb7 08-Jul-1995 Joerg Wunsch <joerg@FreeBSD.org>

Several constants have been missing in the SysV IPC header files that
are recommended by the literature.

Fixes PR# misc/575: constants in sys/sem.h...

Submitted by: daveho@infocom.com (Dave Hovemeyer)


# f86eaaca 02-Oct-1994 Poul-Henning Kamp <phk@FreeBSD.org>

Prototypes, prototypes and even more prototypes. Not quite done yet, but
getting closer all the time.


# 789668e2 17-Sep-1994 David Greenman <dg@FreeBSD.org>

Got rid of compiler warnings.


# 3d903220 13-Sep-1994 Doug Rabson <dfr@FreeBSD.org>

Added SYSV ipcs.

Obtained from: NetBSD and FreeBSD-1.1.5