gpt4 book ai didi

c - WSL : Function not implemented

转载 作者:行者123 更新时间:2023-12-02 18:28:41 25 4
gpt4 key购买 nike

我知道 wsl 使用翻译从 Windows 内核执行的每个命令,但我的问题仍然是:
WSL 是否支持系统调用(例如消息队列)?如果支持,如何支持?

每当使用任何消息队列函数时,我都会收到“函数未实现”错误。还有希望吗?

[编辑:]

int main(int argc,char* argv[]){ 
key_t key=MSG_KEY;
mqid=msgget(key,0660 | IPC_CREAT );
if(mqid==-1){
perror("msgget error:");
printf(" %s",strerror(errno));
}
int lenght=0,n=0;
lenght=msgrcv(mqid,&req,MAX,1,0);
if(lenght==-1){
if (errno == ENOMSG)
{
printf("\nNo message in the queue\n");
}
else
{
printf("\nError receiving message: %s\n", strerror(errno));
}
}
else
{
printf("Received a message\n");
}
printf("\nreceived %d number of bytes\n",n);
msgctl(mqid,IPC_RMID,NULL);

return 0;
}

最佳答案

WSL(1) 中缺少 System V IPC,而 msgctl 属于该内容。

https://github.com/microsoft/WSL/issues/1016

关于c - WSL : Function not implemented,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69736929/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com