3rd. System V IPC

Source: Internet
Author: User

3.1 Overview

System V IPC Functions:

3.2 key_t and Ftok functions

Key_t is the external identifier of the system V IPC, also known as the IPC Key, through which multiple processes meet on the same IPC object

The Ftok function converts pathname and integer identifiers to key_t values

#include <sys/ipc.h>key_t ftok (char *pathname,int ID)

Client and server agree on pathname and ID, then both sides get the same IPC key by calling the Ftok function

Three get functions (Msgget, Semget, shmget) use the key and flag parameters to create or get an IPC object that returns an int type identifier

A) Key=ipc_private is created

b) key is not associated with an IPC object and the specified ipc_creat bit in flag is created


3.3 Ipc_perm Structure

struct ipc_perm{        uid_t   uid;        gid_t   GID;        uid_t   cuid;        gid_t   Cgid;        mode_t  mode;        ulong_t Sep;        key_t   Key;};

3.4 Creating and opening IPC channels

From the IPC key to the IPC identifier:

To open a logical process for an IPC object:

3rd. System V IPC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.