Unix-system-calls-msgget
[top]#
[[File:]]
[[File:]] |
|Web |This Site
- 初心者向けのUnix *
- Unix-ホーム
- Unix-はじめに
- Unix-ファイル管理
- Unix-ディレクトリ
- Unix-ファイル権限
- Unix-環境
- Unix-基本ユーティリティ
- Unix-パイプとフィルタ
- Unix-プロセス
- Unix-コミュニケーション
- Unix-The Vi Editor
- Unix Shellプログラミング*
- Unix-シェルとは?
- Unix-変数の使用
- Unix-特殊変数
- Unix-配列の使用
- Unix-基本的な演算子
- Unix-意思決定
- Unix-シェルループ
- Unix-ループ制御
- Unix-シェル置換
- Unix-引用メカニズム
- Unix-IOリダイレクト
- UNIX-シェル関数
- Unix-マンページヘルプ
- 高度なUnix *
- Unix-正規表現
- Unix-ファイルシステムの基本
- Unix-ユーザー管理
- Unix-システムパフォーマンス
- Unix-システムログ
- Unix-信号とトラップ
- Unixの便利なリファレンス*
- Unix-便利なコマンド
- Unix-クイックガイド
- Unix-組み込み関数
- Unix-システムコール
- Unix-コマンドリスト
- Unixの役立つリソース*
- Unix役立つリソース
選択した読書
Copyright©2014 by finddevguides
Home | References | Discussion Forums | About TP |
msgget()-Unix、Linuxシステムコール
[[File:]] image :http://www.finddevguides.com/images/next.gif [next] image:http://www.finddevguides.com/add- this.gif [AddThisソーシャルブックマークボタン]
広告
NAME
msgget-メッセージキュー識別子を取得する
概要
#include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> |
説明
_msgflg_が IPC_CREAT と IPC_EXCL の両方を指定し、_key_のメッセージキューが既に存在する場合、 msgget ()は失敗し、_errno_が EEXIST に設定されます。 (これは、 open (2)の O_CREAT | O_EXCL の組み合わせの効果に似ています。)
作成時に、引数_msgflg_の最下位ビットがメッセージキューの権限を定義します。 これらの許可ビットの形式とセマンティクスは、 open (2)の_mode_引数に指定された許可と同じです。 (実行許可は使用されません。)
新しいメッセージキューが作成されると、関連するデータ構造_msqid_ds_( msgctl (2)を参照)は次のように初期化されます。
Tag
説明
_msg_perm.cuid_および_msg_perm.uid_は、呼び出しプロセスの有効なユーザーIDに設定されます。
_msg_perm.cgid_および_msg_perm.gid_は、呼び出しプロセスの有効なグループIDに設定されます。
_msg_perm.mode_の最下位9ビットは、_msgflg_の最下位9ビットに設定されます。
msg_qnum _、 msg_lspid 、 msg_lrpid 、 msg_stime_、および_msg_rtime_は0に設定されます。
_msg_ctime_は現在の時刻に設定されます。
_msg_qbytes_はシステム制限 MSGMNB に設定されます。
メッセージキューが既に存在する場合、アクセス許可が検証され、破棄のマークが付けられているかどうかが確認されます。
返り値
成功した場合、戻り値はメッセージキューID(負でない整数)になり、そうでない場合は-1がエラーを示す_errno_になります。
エラー
失敗すると、_errno_は次の値のいずれかに設定されます。
Tag | Description |
---|---|
*EACCES * | A message queue exists for key, but the calling process does not have permission to access the queue, and does not have the* CAP_IPC_OWNER* capability. |
*EEXIST * | A message queue exists for key and msgflg specified both* IPC_CREAT and IPC_EXCL*. |
*ENOENT * | No message queue exists for key and msgflg did not specify* IPC_CREAT*. |
ENOMEM | A message queue has to be created but the system does not have enough memory for the new data structure. |
ENOSPC | A message queue has to be created but the system limit for the maximum number of message queues (MSGMNI) would be exceeded. |
ノート
Tag | Description |
---|---|
MSGMNI | System wide maximum number of message queues: policy dependent (on Linux, this limit can be read and modified via /proc/sys/kernel/msgmni). |
BUGS
IPC_PRIVATEという名前の選択は、おそらく残念でしたが、IPC_NEWはその機能をより明確に示します。
準拠
SVr4、POSIX.1-2001。
Linuxノート
バージョン2.3.20まで、Linuxは、削除がスケジュールされているメッセージキューの msgget ()に対してEIDRMを返します。
関連項目
[[File:]] image :http://www.finddevguides.com/images/next.gif [next] [[File:]]
広告
Advertisements |