Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
The ONE Campaign to make poverty history

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

Who's Online
There are currently, 71 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here




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


       This manual page refers to the Linux implementation of the
       System V interprocess  communication  mechanisms:  message
       queues,  semaphore  sets,  and shared memory segments.  In
       the following, the word resource means an instantiation of
       one among such mechanisms.

   Resource Access Permissions
       For  each  resource, the system uses a common structure of
       type struct ipc_perm to store information needed in deter­
       mining  permissions  to  perform  an  ipc  operation.  The
       ipc_perm structure,  defined  by  the  <sys/ipc.h>  system
       header file, includes the following members:

            ushort cuid;    /* creator user id */
            ushort cgid;    /* creator group id */
            ushort uid;     /* owner user id */
            ushort gid;     /* owner group id */
            ushort mode;    /* r/w permissions */

       The  mode  member  of the ipc_perm structure defines, with
       its lower 9 bits, the access permissions to  the  resource
       for  a  process executing an ipc system call.  The permis­
       sions are interpreted as follows:

            0400 Read by user.
            0200 Write by user.
            0040 Read by group.
            0020 Write by group.
            0004 Read by others.
            0002 Write by others.

       Bits 0100, 0010, and 0001 (the execute bits) are unused by
       the   system.    Furthermore,  "write"  effectively  means
       "alter" for a semaphore set.

       The same system header file  also  defines  the  following
       symbolic constants:

       IPC_CREAT     Create entry if key doesn't exist.

       IPC_EXCL      Fail if key exists.

       IPC_NOWAIT    Error if request must wait.

       ger (its msqid) and has an associated  data  structure  of
       type  struct msquid_ds, defined in <sys/msg.h>, containing
       the following members:

            struct ipc_perm msg_perm;
            ushort msg_qnum;     /* no of messages on queue */
            ushort msg_qbytes;   /* bytes max on a queue */
            ushort msg_lspid;    /* pid of last msgsnd call */
            ushort msg_lrpid;    /* pid of last msgrcv call */
            time_t msg_stime;    /* last msgsnd time */
            time_t msg_rtime;    /* last msgrcv time */
            time_t msg_ctime;    /* last change time */

       msg_perm   ipc_perm structure that  specifies  the  access
                  permissions on the message queue.

       msg_qnum   Number  of  messages  currently  on the message

       msg_qbytes Maximum number of bytes of message text allowed
                  on the message queue.

       msg_lspid  ID  of  the  process  that  performed  the last
                  msgsnd system call.

       msg_lrpid  ID of  the  process  that  performed  the  last
                  msgrcv system call.

       msg_stime  Time of the last msgsnd system call.

       msg_rtime  Time of the last msgcv system call.

       msg_ctime  Time  of  the  last  system call that changed a
                  member of the msqid_ds structure.

   Semaphore Sets
       A semaphore set is uniquely identified by a positive inte­
       ger  (its  semid)  and has an associated data structure of
       type struct semid_ds, defined in  <sys/sem.h>,  containing
       the following members:

            struct ipc_perm sem_perm;
            time_t sem_otime;    /* last operation time */
            time_t sem_ctime;    /* last change time */
            ushort sem_nsems;    /* count of sems in set */

       sem_perm   ipc_perm  structure  that  specifies the access
                  permissions on the semaphore set.

       sem_otime  Time of last semop system call.

       sem_ctime  Time of last semctl system call that changed  a

       semval     Semaphore value: a non-negative integer.

       sempid     ID  of  the  last  process  that  performed   a
                  semaphore operation on this semaphore.

       semncnt    Number of processes suspended awaiting for sem­
                  val to increase.

       semznt     Number of processes suspended awaiting for sem­
                  val to become zero.

   Shared Memory Segments
       A  shared memory segment is uniquely identified by a posi­
       tive integer (its shmid) and has an associated data struc­
       ture of type struct shmid_ds, defined in <sys/shm.h>, con­
       taining the following members:

            struct ipc_perm shm_perm;
            int shm_segsz;       /* size of segment */
            ushort shm_cpid;     /* pid of creator */
            ushort shm_lpid;     /* pid, last operation */
            short shm_nattch;    /* no. of current attaches */
            time_t shm_atime;    /* time of last attach */
            time_t shm_dtime;    /* time of last detach */
            time_t shm_ctime;    /* time of last change */

       shm_perm   ipc_perm structure that  specifies  the  access
                  permissions on the shared memory segment.

       shm_segsz  Size in bytes of the shared memory segment.

       shm_cpid   ID  of the process that created the shared mem­
                  ory segment.

       shm_lpid   ID of the last process that executed a shmat or
                  shmdt system call.

       shm_nattch Number  of  current  alive  attaches  for  this
                  shared memory segment.

       shm_atime  Time of the last shmat system call.

       shm_dtime  Time of the last shmdt system call.

       shm_ctime  Time  of  the  last  shmctl  system  call  that
                  changed shmid_ds.


       ftok(3),  msgctl(2), msgget(2), msgrcv(2), msgsnd(2), sem­
       ctl(2),   semget(2),   semop(2),   shmat(2),    shmctl(2),
       shmget(2), shmdt(2)



Security Code
Security Code
Type Security Code

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!

Amazon Wish List

Did You Know?
The Linux Tutorial welcomes your suggestions and ideas.


Tell a Friend About Us

Bookmark and Share

Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.09 Seconds