Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ././../../../../../../usr/man/man2/shmop.2
Real path: /usr/share/man/man2/shmop.2
Zurück
'\" te .\" Copyright (c) 1989, AT&T. All rights reserved. .\" Portions Copyright (c) 2008, 2020, Oracle and/or its affiliates. .TH shmop 2 "15 Sep 2020" "Oracle Solaris 11.4" "System Calls" .SH NAME shmop, shmat, shmdt \- shared memory operations .SH SYNOPSIS .LP .nf #include <sys/types.h> #include <sys/shm.h> \fBvoid *\fR\fBshmat\fR(\fBint\fR \fIshmid\fR, \fBconst void *\fR\fIshmaddr\fR, \fBint\fR \fIshmflg\fR); .fi .LP .nf \fBint\fR \fBshmdt\fR(\fBconst void *\fR\fIshmaddr\fR); .fi .SH DESCRIPTION .sp .LP The \fBshmat()\fR function attaches the shared memory segment associated with the shared memory identifier specified by \fIshmid\fR to the data segment of the calling process. .sp .LP The permission required for a shared memory control operation is given as {\fItoken\fR}, where \fItoken\fR is the type of permission needed. The types of permission are interpreted as follows: .sp .in +2 .nf 00400 READ by user 00200 WRITE by user 00040 READ by group 00020 WRITE by group 00004 READ by others 00002 WRITE by others .fi .in -2 .sp .sp .LP See the \fIShared Memory Operation Permissions\fR section of \fBIntro\fR(2) for more information. .sp .LP For shared memory segments created with the \fBSHM_SHARE_MMU\fR or \fBSHM_PAGEABLE\fR flags, the default protections cannot be changed so as to prevent a single process from affecting other processes sharing the same shared segment. .sp .LP When (\fIshmflg\fR \fB& SHM_SHARE_MMU\fR) is true, virtual memory resources in addition to shared memory itself are shared among processes that use the same shared memory. .sp .LP When (\fIshmflg\fR \fB& SHM_PAGEABLE\fR) is true, virtual memory resources are shared and the dynamic shared memory (\fBDISM\fR) framework is created. The dynamic shared memory can be resized dynamically within the specified size in \fBshmget\fR(2). The DISM shared memory is pageable unless it is locked. .sp .LP Segments created using \fBshmget_osm\fR(2) may not be attached with \fBshmflag\fR flags of \fBSHM_SHARE_MMU\fR, \fBSHM_PAGEABLE\fR, or \fBSHM_RND\fR. .sp .LP The shared memory segment is attached to the data segment of the calling process at the address specified based on one of the following criteria: .RS +4 .TP .ie t \(bu .el o If \fIshmaddr\fR is equal to \fBNULL\fR, the segment is attached to the first available address as selected by the system. .RE .RS +4 .TP .ie t \(bu .el o If \fIshmaddr\fR is equal to \fBNULL\fR and (\fIshmflg\fR \fB& SHM_SHARE_MMU\fR) or (\fIshmflg\fR \fB& SHM_PAGEABLE\fR) is true, then the segment is attached to the first available suitably aligned address. When (\fIshmflg\fR \fB& SHM_SHARE_MMU\fR) or (\fIshmflg\fR \fB& SHM_PAGEABLE\fR) is set, however, the permission given by \fBshmget()\fR determines whether the segment is attached for reading or reading and writing. .RE .RS +4 .TP .ie t \(bu .el o If \fIshmaddr\fR is not equal to \fBNULL\fR and (\fIshmflg\fR \fB& SHM_RND\fR) is true, the segment is attached to the address given by (\fIshmaddr\fR \fB\(mi\fR (\fIshmaddr\fR modulus \fBSHMLBA\fR)). .RE .RS +4 .TP .ie t \(bu .el o If \fIshmaddr\fR is not equal to \fBNULL\fR and (\fIshmflg\fR \fB& SHM_RND\fR) is false, the segment is attached to the address given by \fIshmaddr\fR. .RE .RS +4 .TP .ie t \(bu .el o The segment is attached for reading if (\fIshmflg\fR \fB& SHM_RDONLY\fR) is true \fB{READ}\fR, otherwise it is attached for reading and writing \fB{READ/WRITE}\fR. .RE .sp .LP The \fBshmdt()\fR function detaches from the calling process's data segment the shared memory segment located at the address specified by \fIshmaddr\fR. .sp .LP Shared memory segments must be explicitly removed after the last reference to them has been removed. .sp .LP Upon successful completion, \fBshmat()\fR increments the value of \fBshm_nattch\fR and updates the \fBshm_atime\fR timestamp in the \fBshmid_ds\fR structure associated with the shared memory segment; \fBshmdt()\fR decrements the value of \fBshm_nattch\fR and updates the \fBshm_dtime\fR timestamp. See the \fIShared Memory Identifier\fR section of \fBIntro\fR(2) for more information. .SH RETURN VALUES .sp .LP Upon successful completion, \fBshmat()\fR returns the data segment start address of the attached shared memory segment. Otherwise, \fBSHM_FAILED (\(mi1)\fR is returned, the shared memory segment is not attached, and \fBerrno\fR is set to indicate the error. .sp .LP Upon successful completion, \fBshmdt()\fR returns \fB0\fR. Otherwise, \fBSHM_FAILED (\(mi1)\fR is returned, the shared memory segment is not detached, and \fBerrno\fR is set to indicate the error. .SH ERRORS .sp .LP The \fBshmat()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEACCES\fR\fR .ad .RS 10n .rt Operation permission is denied to the calling process (see \fBIntro\fR(2)). .RE .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt The \fIshmid\fR argument is not a valid shared memory identifier. .sp The \fIshmaddr\fR argument is not equal to 0, and the value of (\fIshmaddr\fR \fB\(mi\fR (\fIshmaddr\fR modulus \fBSHMLBA\fR)) is an illegal address. .sp The \fIshmaddr\fR argument is not equal to 0, is an illegal address, and (\fIshmflg\fR \fB& SHM_RND\fR) is false. .sp The \fIshmaddr\fR argument is not equal to 0, is not properly aligned, and (\fIshmflg\fR \fB& SHM_SHARE_MMU\fR) is true. .sp \fBSHM_SHARE_MMU\fR is not supported in certain architectures. .sp Both (\fIshmflg\fR \fB& SHM_SHARE_MMU\fR) and (\fIshmflg\fR \fB& SHM_PAGEABLE\fR) are true. .sp (\fIshmflg\fR \fB& SHM_SHARE_MMU\fR) is true and the shared memory segment specified by \fBshmid()\fR had previously been attached by a call to \fBshmat()\fR in which (\fIshmflg\fR \fB& SHM_PAGEABLE\fR) was true. .sp (\fIshmflg\fR \fB& SHM_PAGEABLE\fR) is true and the shared memory segment specified by \fBshmid()\fR had previously been attached by a call to \fBshmat()\fR in which (\fIshmflg\fR \fB& SHM_SHARE_MMU\fR) was true. .sp The segment was created using \fBshmget_osm\fR(2), and one of (\fIshmflg\fR \fB& SHM_PAGEABLE\fR), (\fIshmflg\fR \fB& SHM_SHARE_MMU\fR), or (\fIshmflg\fR \fB& SHM_RND\fR) is true. .sp The segment was created using \fBshmget_osm\fR(2), and the \fIshmaddr\fR argument is not equal to 0, and \fIshmaddr\fR is not aligned to the segment's granule size. .RE .sp .ne 2 .mk .na \fB\fBEMFILE\fR\fR .ad .RS 10n .rt The number of shared memory segments attached to the calling process would exceed the system-imposed limit. .RE .sp .ne 2 .mk .na \fB\fBENOMEM\fR\fR .ad .RS 10n .rt The available data space is not large enough to accommodate the shared memory segment. .RE .sp .LP The \fBshmdt()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt The \fIshmaddr\fR argument is not the data segment start address of a shared memory segment. .RE .sp .ne 2 .mk .na \fB\fBENOMEM\fR\fR .ad .RS 10n .rt (\fIshmflg\fR \fB& SHM_SHARE_MMU\fR) is true and attaching to the shared memory segment would exceed a limit or resource control on locked memory. .RE .SH WARNINGS .sp .LP Using a fixed value for the \fIshmaddr\fR argument can adversely affect performance on certain platforms due to D-cache aliasing. .sp .LP Using a fixed value for the \fIshmaddr\fR argument can also result in hard-to-reproduce failures to attach shared memory segments at a given address when Address Space Layout Randomization (\fBASLR\fR) is enabled. Programs that require specifying memory layouts can be tagged at link time to disable ASLR for their process. For more information, see the \fBld\fR(1) and \fBsxadm\fR(8) man pages. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .TS tab( ) box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ MT-Level Async-Signal-Safe _ Standard See \fBstandards\fR(7). .TE .sp .SH SEE ALSO .sp .LP \fBexec\fR(2), \fBexit\fR(2), \fBfork\fR(2), \fBIntro\fR(2), \fBshmctl\fR(2), \fBshmget\fR(2), \fBshmget_osm\fR(2), \fBattributes\fR(7), \fBstandards\fR(7) .SH HISTORY .sp .LP The \fBshmat()\fR and \fBshmdt()\fR functions, and the flags \fBSHM_RDONLY\fR and \fBSHM_RND\fR, have been included in all Sun and Oracle releases of Solaris since Solaris 2.0. .sp .LP Support for the \fBSHM_SHARE_MMU\fR flag was added to Solaris in the Solaris 2.2 release. .sp .LP Support for the \fBSHM_PAGEABLE\fR flag was added to Solaris in the Solaris 8 1/01 (Update 3) release.