ipc
SYSNOPSIS
int sys_ipc (uint call, int first, int second, int third, void *ptr);
PARAMETERS
call: [in] the ipc call to perform.
first, second, third: parameters. Depend on call.
ptr: [in] pointer to a buffer.
DESCRIPTION
This is an in kernel wrapper for other ipc calls. call can take the following values:
SEMOP
sys_semop(first, (struct sembuf *)ptr, second);
SEMGET
sys_semget (first, second, third);
SEMCTL
sys_semctl (first, second, third, ptr);
MSGSND
sys_msgsnd (first, (struct msgbuf *) ptr, second, third);
MSGRCV
This one is a little tricky...
struct ipc_kludge tmp; if (!ptr) return -EINVAL;
memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr, sizeof (tmp));
return sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
MSGGET
sys_msgget ((key_t) first, second);
MSGCTL
sys_msgctl (first, second, (struct msqid_ds *) ptr);
SHMAT
sys_shmat (first, (char *) ptr, second, (ulong *) third);
SHMDT
sys_shmdt ((char *)ptr);
SHMGET
sys_shmget (first, second, third);
SHMCTL
sys_shmctl (first, second, (struct shmid_ds *) ptr);
**************************************************************************************
msgctl
SYNOPSIS
int msgctl(int msqid,int cmd,struct msqid_ds *buf);
PARAMETERS
msqid: [in] the message queue to manipulate.
cmd: [in] the operation to perform on the message queue.
buf: the interpretation of this parameter depends on cmd.
DESCRIPTION
Manipulates a message queue. cmd may be one of:
IPC_STAT
retreives some information on the queue.
IPC_SET
modify some operating parameters of the queue. buf points to a msqid_ds structure. The only
modifiable parameters are: msg_perm.uid, msg_perm.gid, msg_perm.mode (only lowest 9 bits)
and msg_qbytes. The calling task uid must be one of the creator uid or the owner uid of the
queue or the superuser uid. Only the superuser may rise msg_qbytes beyond the system limit
of MSGMNB.
IPC_RMID
immediately destroys the message queue and awake all sleaping reader and writer processes.
RETURN VALUE
On success zero is returned. On error -1 is returned and errno is set to one of the
following values:
EACCESS: the caller tried IPC_STAT but does not have read permission on the queue.
EIDRM: the queue is already removed.
EINVAL: invalid value for cmd or msqid.
EPERM: the taks tried an operation for which it does not have the necessary privileges.
EFAULT.
**************************************************************************************
msgget
SYNOPSIS
int msgget(key_t key, int msgflg);
PARAMETERS
key: [in] the message queue identifier to get.
msgflg: [in] some flags (see description).
DESCRIPTION
Gets a message queue identifier. If key is IPC_PRIVATE, a new queue is created, otherwise
the result depends on msgflg. The possible values for msgflg are:
IPC_CREAT
creates a new queue for the key if it does not already exist.
IPC_EXCL
if there is already a existing queue associated with key, the call fails.
The 9 lower bits of msgflg specify the permission bits of the new queue. They have the same
layout and meaning as those for files. However, the execute permissions are meaningless for
queues.
When creating a queue the system sets the appropriate parameters in the msqid_ds structure
associated with the new queue. When accessing an already existing queue, the system simply
check if the queue can be accessed.
RETURN VALUE
On success, the call returns the new queue identificator. On error -1 is returned and errno
is set to one of the following values:
EACCESS: the task has no access permission to the queue.
EEXIST: IPC_CREAT and IPC_EXCL were specified and the queue already exists.
EIDRM: the message queue no longer exists in the system.
ENOENT: the message queue never existed.
ENOSPC: the maximum number of message queues for the system has been reached.
ENOMEM
**************************************************************************************
msgrcv and msgsnd
SYNOPSIS
int msgsnd(int msqid, struct msgbuf *msgp, int msgsz, int msgflg);
int msgrcv(int msqid, struct msgbuf *msgp, int msgsz, long msgtyp, int msgflg);
PARAMETERS
msqid: [in] the message queue.
msgp: for msgsnd, [in] points to the message to send. For msgrcv, [out] points to the buffer
where to put the message.
msgsz: [in] size of the mtext part of the buffer. The maximum possible size is MSGMAX and is
currently 4080 bytes.
msgflg: [in] flags (see description).
msgtyp: [in] the type of message to receive.
DESCRIPTION
msgp must point to a buffer having the following structure:
struct msgbuf {
long mtype; /* message type, must > 0 */
char mtext[1]; /* message data */
}
The calling process must have read permission on the queue to call msgrcv and write
permission on the queue to call msgsnd.
msgsnd tries to enqueue the message. If msglfg is set to IPC_NOWAIT and the queue is full,
the call fails. Otherwise the call blocks. If the send succeed, the message queue structure
is updated as follow:
msg_lspid is set to the pid of the calling process.
msg_qnum is incremented by 1.
msg_stime is set to the current time.
msgrcv dequeues a message from the message queue. If the message to be dequeued has a length
greater than msgsz, then the call fails. If the length is greater but the MSG_NOERROR flag
is specified, the message gets truncated (and the truncated information is lost forever).
The message to be dequeued can be choosed by the following values of msgtyp:
msgtyp equals 0: in this case the 1st message on the queue is dequeued.
msgtyp is greater than 0: if the flag MSG_EXCEPT is not specified, the first message of type
msgtyp on the queue will be dequeued, otherwise the first message not of type msgtyp on the
queue will be dequeued.
msgtyp is less than 0: the first message of type in the range [1,-msgtyp] will be dequeued.
If the flag IPC_NOWAIT is specified and there is no message of the specified type on the
message queue, the call will fail, otherwise the call will block. On success, the queue
data structure is updated as follow:
msg_lrpid is set to the pid of the calling process.
msg_qnum is decremented by 1.
msg_rtime is set to the current time.
RETURN VALUE
On success msgsnd returns zero and msgrcv returns the number of bytes copied in the mtext
array. On error -1 is returned and errno is set to one of the following values:
for msgsnd:
EAGAIN: IPC_NOWAIT was specified and the queue is full.
EACCESS: the calling task does not have write permission on the queue.
EIDRM: the queue has been removed.
EINVAL: invalid msqid, msgsz or mtype value.
EFAULT, EINTR and ENOMEM.
for msgrcv:
E2BIG: MSG_NOERROR is not specified and the message that should be dequeued is too bigger
than msgsz.
EACCESS: the calling task does not have read permission on the queue.
EIDRM: the queue has been removed.
EINVAL: invalid msqid or msgsz value.
ENOMSG: IPC_NOWAIT was specified no message of the specified type is on the queue.
EFAULT, EINTR
**************************************************************************************
semctl
SYNOPSIS
int semctl(int semid, int semnun, int cmd, union semun arg);
PARAMETERS
semid: [in] the semaphore set to manipulate.
semnum: [in] the semaphore in the set to manipulate (0 is the first).
cmd: [in] the operation to perform.
arg: [in out] an argument to the operation (see description).
DESCRIPTION
Manipulates a semaphore set or members of a semaphore set. The possible values for cmd are:
IPC_STAT
gets some information on the semaphore set. The calling task must have read access to the
semaphore set.
IPC_SET
modify some members of the semid_ds structure
没有合适的资源?快使用搜索试试~ 我知道了~
Linux C语言函数大全.rarWindows 2000提供的常用对象可分成三类:核心应用服务、线程同步和线程间通讯。其中,开...

共31个文件
htm:18个
txt:13个

需积分: 9 25 下载量 177 浏览量
2008-11-07
00:49:08
上传
评论
收藏 112KB RAR 举报
温馨提示
Windows 2000提供的常用对象可分成三类:核心应用服务、线程同步和线程间通讯。其中,开发人员可以使用线程同步对象来协调线程和进程的工作,以使其共享信息并执行任务。此类对象包括互锁数据、临界段、事件、互斥体和信号等。
资源推荐
资源详情
资源评论






















收起资源包目录


































共 31 条
- 1
资源评论


a586084
- 粉丝: 0
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 反垄断法之电子商务市场反垄断规制(BB交易市场).doc
- 平面设计实施方案实训六Photoshop色彩调整.doc
- 初探网络游戏虚拟财产保险法律问题.doc
- 2017年度大数据时代的互联网信息安全考试及答案.doc
- 基于大数据的高职英语写作教学改革探讨.docx
- 基于云计算医疗物资供应商管理平台解决方案.docx
- 初中信息技术教学如何提升学生的网络学习能力.docx
- 基于PLC控制的打地鼠游戏装置的设计与制作.docx
- 移动互联网技术在物业管理中的应用.docx
- 大数据时代下如何做好初中英语课堂的教学改革.docx
- 计算机科学及其技术的发展趋势研究.docx
- 无线网络视频监控系统实施方案概述.doc
- 互联网金融专业化销售流程.ppt
- VB宿舍文档管理系统论文范文.doc
- 项目管理学概论作业题答案.doc
- 单片机步进电动机控制系统方案设计书.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
