C shared memory
问题 I am trying to implement shared memory on embedded device with uClinux. My C source #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); } I get an error Page size - 4096 Error in socket - 38 Can anyone help me? Thanks. 回答1: You need to test segment_id