Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ shmctl(2) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

disclaim

shmat

shmdt

shmget

master



SHMCTL(2,L)                 AIX Technical Reference                 SHMCTL(2,L)



-------------------------------------------------------------------------------
shmctl



PURPOSE

Controls shared memory operations.

SYNTAX

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>

int shmctl (shmid, cmd, buf)
int shmid, cmd;
struct shmid_ds *buf;

DESCRIPTION

The shmctl system call performs a variety of shared memory control operations
as specified by the cmd parameter.  The shmid parameter is a shared memory
identifier returned by the shmget system call.  The following cmds are
available:

IPC_STAT    Places the current value of each member of the data structure
            associated with the shmid parameter into the shmid_ds structure
            pointed to by the buf parameter.  The current process must have
            read permission in order to perform this operation.  The shmid_ds
            structure is defined in the sys/shm.h header file, and it contains
            the following members:

  struct ipc_perm shm_perm;  /* Operation permission structure */
  int     shm_segsz;         /* Segment size */
  struct vseg *shm_vseg;     /* Segment identifier */
  pid_t   shm_lpid;          /* ID of last process to call shmop */
  pid_t   shm_cpid;          /* ID of process that created this shmid */
  ushort  shm_nattch;        /* Current number of processes attached */
  ushort  shm_cnattach;      /* No. of in-memory processes attached */
  time_t  shm_atime;         /* Time of last shmat call */
  time_t  shm_dtime;         /* Time of last shmdt call */
  time_t  shm_ctime;         /* Time of the last change to this */
                             /*  structure with a shmctl call */

IPC_SET     Sets the value of the following members of the data structure
            associated with the shmid parameter to the corresponding value
            found in the structure pointed to by the buf parameter:

                  shm_perm.uid
                  shm_perm.gid
                  shm_perm.mode  /* Only the low-order nine bits */



Processed November 7, 1990        SHMCTL(2,L)                                 1





SHMCTL(2,L)                 AIX Technical Reference                 SHMCTL(2,L)




            This cmd can only be performed by a process that has an effective
            user ID equal to either that of superuser or to the value of
            shm_perm.uid in the data structure associated with the shmid
            parameter.

IPC_RMID    Removes the shared memory identifier specified by the shmid
            parameter from the system and erases the shared memory segment and
            data structure associated with it.  This cmd can only be executed
            by a process that has an effective user ID equal to either that of
            superuser or to the value of shm_perm.uid in the data structure
            associated with the shmid parameter.

            Note:  In a Transparent Computing Facility cluster, shared memory
                   segments exist only on the cluster site on which they are
                   created.  Consequently, processes that use shared memory
                   segments cannot be migrated to other sites and processes on
                   different cluster sites cannot share memory segments.

RETURN VALUE

Upon successful completion, a value of 0 is returned.  If shmctl fails, a value
of -1 is returned and errno is set to indicate the error.

ERROR CONDITIONS

The shmctl system call fails if one or more of the following are true:

EINVAL  The shmid parameter is not a valid shared memory identifier.

EINVAL  The cmd parameter is not a valid command.

EACCES  The cmd parameter is equal to IPC_STAT and read permission is denied to
        the calling process.

EPERM   The cmd parameter is equal to IPC_RMID or IPC_SET, and the effective
        user ID of the calling process is neither equal to the superuser ID,
        nor is it equal to the value of shm_perm.uid in the data structure
        associated with shmid.

EFAULT  The buf parameter points to a location outside of the process's
        allocated address space.

RELATED INFORMATION

In this book:  "disclaim," "shmat,"  "shmdt,"  "shmget," and "master."









Processed November 7, 1990        SHMCTL(2,L)                                 2



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026