- 论坛徽章:
- 0
|
在我的目标系统上(内核2.6.30 glibc 2.5-cs4.1-176),使用mq_open时(POSIX消息队列打开函数) ,提示“Function not implemented”.
我查看了/proc,也没有/proc/sys/fs/mqueue目录。
我该怎么做才能让目标系统支持POSIX消息队列呢?
重新编译内核?
实验代码如下:
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
- #include <pthread.h>
- #include <mqueue.h>
- #include <limits.h>
- #include <fcntl.h>
- #include <sys/stat.h>
- #define FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
- int main(void)
- {
- int err;
- mqd_t mqd;
- mqd = mq_open("/mq01", O_CREAT | O_RDWR, FILE_MODE, NULL);
- if(mqd == (mqd_t)-1)
- {
- perror("mq_open");
- }else{
- printf("mq_open: success\n");
- err = mq_unlink("/mq01");
- if(err == 0){
- printf("mq_unlink: success.\n");
- }
- }
- printf("message queue end\n");
- return 0;
- }
复制代码 |
|