uClinux 上 使用 msgget, msgsnd, msgrcv 问题
uClinux 上,
代码如下
#define BRCBRPT_MSGQ_ID 'a'
int m_brcbRptMsgQ;
int main()
{
unsigned int threadId;
unsigned char buf[16];
/*创建消息队列*/
if ((m_brcbRptMsgQ =
msgget (ftok (".", BRCBRPT_MSGQ_ID), IPC_CREAT | IPC_EXCL)) == -1)
{
if ((m_brcbRptMsgQ =
msgget (ftok (".", BRCBRPT_MSGQ_ID), IPC_CREAT)) == -1)
{
perror ("msgget") ;
exit (1) ;
}
msgctl (m_brcbRptMsgQ, IPC_RMID, 0) ;
if ((m_brcbRptMsgQ =
msgget (ftok (".", BRCBRPT_MSGQ_ID), IPC_CREAT | IPC_EXCL))
== -1)
{
perror ("msgget") ;
exit (1) ;
}
}
/*发送消息*/
if (msgsnd (m_brcbRptMsgQ, (struct msgbuf *)buf,
sizeof (buf) - sizeof (long), IPC_NOWAIT) == -1)
{
printf ("msgsnd : error !\n") ;
return 1;
}
printf("hello!\n");
return 0;
}
编译通过,
文件系统, 下到板子中,
运行,
>/hello
光标 一直停在 ">/hello" 的下一行 , 不动, 没有打印出 "hello!"
请问 uClinux 上 无法 使用 msgget 等 吗?
还是 需要在编译内核时,设置?
如果 不能使用 msgget 等, 请问,用什么方法替代?
还有, 那位高人 介绍 一些 uClinux 的资料, 配置, 编译 内核,文件系统, uClinux 上 编程的 资料, 不胜感激!