ipcmk [OPTIONS]
!subtitle:功能
创建进程间通信(IPC)资源。
!subtitle:类型
可执行文件(/usr/bin/ipcmk),属于 util-linux。
!subtitle:参数
OPTIONS 选项:
-M, --shmem SIZE - 创建 SIZE 大小的共享内存;支持 KiB(1024)、KB(1000) 等单位后缀
-Q, --queue - 创建消息队列
-S, --semaphore NUMBER - 创建包含 NUMBER 个信号量的数组
-p, --mode MODE - 资源的访问权限;默认为 0644
--help - 显示帮助
--version - 显示版本
$ ipcmk -M 256 # 创建 256 字节的共享内存
Shared memory id: 0
$ ipcmk -Q # 创建消息队列
Message queue id: 0
$ ipcmk -S 8 # 创建 8 个信号量的数组
Semaphore id: 0
$ ipcs # 查看所有 IPC 资源
------ Message Queues --------
key msqid owner perms used-bytes messages
0xb8bca3e8 0 primers 644 0 0
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0xcbff4ae1 0 primers 644 256 0
------ Semaphore Arrays --------
key semid owner perms nsems
0x768e487c 0 primers 644 8
| 命令 | 说明 |
|---|---|
| ipcrm | 删除 IPC 资源 |
| ipcs | 查看 IPC 资源 |
IPCMK(1) User Commands IPCMK(1)
NAME
ipcmk - make various IPC resources
SYNOPSIS
ipcmk [options]
DESCRIPTION
ipcmk allows you to create System V inter-process communication (IPC)
objects: shared memory segments, message queues, and semaphore arrays.
OPTIONS
Resources can be specified with these options:
-M, --shmem size
Create a shared memory segment of size bytes. The size argument may
be followed by the multiplicative suffixes KiB (=1024), MiB
(=1024*1024), and so on for GiB, etc. (the "iB" is optional, e.g.,
"K" has the same meaning as "KiB") or the suffixes KB (=1000), MB
(=1000*1000), and so on for GB, etc.
-Q, --queue
Create a message queue.
-S, --semaphore number
Create a semaphore array with number of elements.
Other options are:
-p, --mode mode
Access permissions for the resource. Default is 0644.
-h, --help
Display help text and exit.
-V, --version
Print version and exit.
AUTHORS
Hayden A. James <[email protected]>
SEE ALSO
ipcrm(1), ipcs(1), sysvipc(7)
REPORTING BUGS
For bug reports, use the issue tracker at
https://github.com/util-linux/util-linux/issues.
AVAILABILITY
The ipcmk command is part of the util-linux package which can be
downloaded from Linux Kernel Archive
<https://www.kernel.org/pub/linux/utils/util-linux/>.
util-linux 2.39.3 2023-10-23 IPCMK(1)