c - msgget 功能未实现
问题描述
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#define BUFF_SIZE 1024
typedef struct {
long data_type;
int data_num;
char data_buff[BUFF_SIZE];
} t_data;
int main(){
key_t msqid;
int ndx = 0;
t_data data;
msqid = msgget( (key_t)1234, IPC_CREAT | 0666);
if ( -1 == msqid)
{
perror( "msgget() fail");
exit( 1);
}
return 0;
}
接下来,我愿意
gcc -o parent parent.c
接下来,
./parent
但结果是
msgget() fail: Function not implemented
我不知道为什么 msgget 函数没有实现,即使这只是简单的代码。我该如何修复我的代码?
解决方案
推荐阅读
- python - 如何在此客户小部件中添加命令选项,例如 tkinter 按钮?
- angular - 如何重用我的模型类型属性?
- firebase - 是否有任何 REST api 可以在 Firebase 中创建用户?
- c++ - 想要最小化我的代码,使其消耗的时间少于 1 秒。它使用模幂的概念。正确输出但超出时间限制
- laravel - TypeError:无法读取未定义的属性“提交”
- javascript - react-redux中加载组件时如何自动执行功能
- routes - HERE API 多式联运:设置/限制到公共交通的最大距离或时间
- docker - AWS Lambda 的 Docker 无法连接处理程序
- angular - Angular Material Accordion 打开外部点击问题
- javascript - 在 chrome 中阻止特定请求 URL,但带有子目录的 URL 应该通过