ChinaUnix.net
相关文章推荐:

mq_open

代码大体如下: int main(...) { ... mqd = mq_open(MSGQOBJ, O_RDWR | O_CREAT, FILE_MODE, NULL); if(mqd == -1) { perror("mq_open"); exit(1); } ... mq_close(mqd); mq_unlink(MSGQOBJ); exit(0); } 问题在: mq_open(MSGQOBJ, O_RDWR | O_CREAT, FILE_MODE, NULL); 编译后,能通过,也能正常执行。 但是如果把第四个参数由NULL改为attr,重新编译的时候就会...

by akei48 - C/C++ - 2009-09-04 15:40:09 阅读(9745) 回复(9)

相关讨论

我利用mq_open创建队列 程序提示未定义 在makefile中加入 -lposix4 结果提示无法找到 -lposixe4 请问linux下使用mq_open需要如何设置 谢谢

by luckmonkey - 程序开发 - 2006-02-13 16:03:24 阅读(1115) 回复(4)

函数中使用mq_open函数产生一个posix消息队列,运行后出现mq_open: Permission denied, su到root模式下运行还是这样,请问会是什么样的问题会导致这种情况? 我的环境是fedora7 谢谢指点!

by xiaozhu2007 - C/C++ - 2011-04-16 14:54:05 阅读(13105) 回复(10)

测试IPC时,提示如下信息: 先是找不到mqueue.h 后来copy了一个过来,结果提示mqd_t 未定义,后来定义为int类型, 提示如下信息: mq_open is not implemented and will always fail 请教各位大侠,怎样处理啊!!!!!!

by walif - 程序开发 - 2006-04-07 16:51:01 阅读(2519) 回复(11)

源码如下: #include #include #include <mqueue.h> #include #include #include void errorabort ( void ) { char *e = strerror(errno); printf("%s\n", e); } int main( int C, char **v ) { mqd_t mq; int flags; flags = O_CREAT; if((mq = mq_open( v[1], flags, 0666, NULL)) ==...

by luckmonkey - C/C++ - 2006-02-13 16:12:26 阅读(1091) 回复(1)

/tmp/cc0jERlh.o(.text+0x67): In function `eph_createmq': : undefined reference to `mq_open' /tmp/cc0jERlh.o(.text+0x9c): In function `eph_createmq': : undefined reference to `mq_unlink' collect2: ld returned 1 exit status

by elssann - C/C++ - 2004-10-19 18:02:32 阅读(3330) 回复(4)

一个动态库,使用mq_open打开消息队列,然后使用mq_send发送信息,再mq_close关闭,一个进程调用这个动态库,在家里环境运行正常,但在现场出现问题:每调用一次虚拟内存多占用20M,调用不到200次,该进程占用虚拟内存4G,无法运行了,哪位老大能分析一下原因吗?有没有什么补丁能解决这个问题?

by chu11cn - 其他UNIX - 2006-09-20 11:34:57 阅读(3078) 回复(1)

[code] #include #include <mqueue.h> #include int main(void) { printf("mq_open_MAX = %ld, mq_PRIO_MAX = %ld\n", \ sysconf(_SC_mq_open_MAX), sysconf(_SC_mq_PRIO_MAX)); return 0; } [/code] 运行: mq_open_MAX = -1, mq_PRIO_MAX = 32768 即:一个进程能够同时拥有打开的队列的最大数目mq_open_MAX, 在这里结果为-1,正常吗? 我的系统是fedora7 [ 本帖最后由...

by xiaozhu2007 - C/C++ - 2007-11-19 23:58:16 阅读(1329) 回复(0)

在学习消息队列时编译提示:undefined reference to ‘mq_open’,联想线程的情况是不是缺少什么连接库?搜索论坛,-lrt和-lpthread都不行,请问应该是什么? 编译命令如下:cc mq_creat.c -lrt 有什么错误吗? 操作系统是freebsd5.2 [ 本帖最后由 user2003 于 2006-3-27 23:03 编辑 ]

by user2003 - BSD - 2006-03-28 21:08:03 阅读(4070) 回复(2)

如下这段代码如果用g++当成C++编译就可以编译过去,命令如下: g++ -lrt main.cpp 但是如果用gcc当成C语言编译就编译不过去,命令如下: gcc -lrt main.c 提示的错误如下: main.c: In function ‘main’: main.c:17: error: ‘S_IREAD’ undeclared (first use in this function) main.c:17: error: (Each undeclared identifier is reported only once main.c:17: error: for each function it appears in.) ...

by ytsmtipe - C/C++ - 2009-07-22 10:55:42 阅读(3172) 回复(2)

mq_open_MAX这个参数在哪,改为多大比较合适?哪位大侠告诉一下,谢了!!

by hlhl2003 - Solaris - 2007-03-21 16:14:16 阅读(1032) 回复(0)