WSL2——Linux C中进程相关操作编程问题
生活随笔
收集整理的這篇文章主要介紹了
WSL2——Linux C中进程相关操作编程问题
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
問題描述
1、lockf函數(shù)無效
https://shentuzhigang.blog.csdn.net/article/details/110878697
2、共享內(nèi)存的系統(tǒng)調(diào)用異常
https://shentuzhigang.blog.csdn.net/article/details/111184090
#include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <stdlib.h> #include <sys/ipc.h> #include <sys/shm.h>int main(){key_t key=200; /*在實際實驗過程中,為了避免每個同學(xué)建立的共享存儲區(qū)關(guān)鍵字一樣而相互干擾,關(guān)鍵字請用學(xué)號末3位*/int shmid_1,shmid_2;if ((shmid_1=shmget(key,1000,0644|IPC_CREAT))==-1){perror("shmget shmid_1");exit(1);}printf("First shared memory identifier is %d\n",shmid_1);if ((shmid_2=shmget(IPC_PRIVATE,20,0644))==-1){perror("shmget shmid_2");exit(2);}printf("Second shared memory identifier is %d\n",shmid_2);exit(0);return 0; }3、
參考文章
【填坑】使用 WSL、WSL2 編譯代碼可能遇到問題匯總
與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的WSL2——Linux C中进程相关操作编程问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 服务外包技术培训——后端开发技术栈分析(
- 下一篇: 《编译原理》实验预习报告——基于YACC