当前位置: 技术问答>linux和unix
shm_open函数问题.奇怪!!!奇怪!!!!!
来源: 互联网 发布时间:2015-12-29
本文导语: 程序如下: char * shm_name; int cre_rw = O_RDWR | O_CREAT; int mode_777 = S_IRWXO | S_IRWXG | S_IRWXU; int shm_fd; shm_name = "SHM_NAME"; shm_fd = shm_open(shm_name,cre_rw,mode_777); 执行的时候总是返回-1值,而且报错误:Permission denied. 请问...
程序如下:
char * shm_name;
int cre_rw = O_RDWR | O_CREAT;
int mode_777 = S_IRWXO | S_IRWXG | S_IRWXU;
int shm_fd;
shm_name = "SHM_NAME";
shm_fd = shm_open(shm_name,cre_rw,mode_777);
执行的时候总是返回-1值,而且报错误:Permission denied.
请问是什么问题?
谢谢....
char * shm_name;
int cre_rw = O_RDWR | O_CREAT;
int mode_777 = S_IRWXO | S_IRWXG | S_IRWXU;
int shm_fd;
shm_name = "SHM_NAME";
shm_fd = shm_open(shm_name,cre_rw,mode_777);
执行的时候总是返回-1值,而且报错误:Permission denied.
请问是什么问题?
谢谢....
|
mode_777?看樣子你是設置文件權限位了,這樣以普通權限執行是不行的,你應該用超級權限執行,比如用 ./sudo ~~~