C共享内存 [英] C shared memory
本文介绍了C共享内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用uClinux在嵌入式设备上实现共享内存.
I am trying to implement shared memory on embedded device with uClinux.
我的C语言源
#include <stdio.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <errno.h>
//using namespace std;
int main() {
int segment_id;
segment_id = shmget(04, getpagesize(), IPC_CREAT | 0666);
printf("Page size - %d\n",getpagesize());
printf("Error in socket - %d\n",errno);
}
我得到一个错误
Page size - 4096
Error in socket - 38
有人可以帮助我吗?谢谢.
Can anyone help me? Thanks.
推荐答案
errno 38对应于ENOSYS,这意味着未实现功能.我错过了内核配置.我必须启用CONFIG_SYSVIPC.
The errno 38 corresponds to ENOSYS which means function not implemented. I missed a kernel config. I have to enable CONFIG_SYSVIPC.
这篇关于C共享内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文