【问题标题】:Can't create message queue in Linux subsystem on Windows无法在 Windows 上的 Linux 子系统中创建消息队列
【发布时间】:2021-01-22 16:55:08
【问题描述】:

我尝试在 Windows 10 的 linux 子系统上创建消息队列。 当我尝试使用此函数创建消息队列时:

 queueId = msgget(*key, IPC_CREAT | IPC_EXCL | 0660);
    if (queueId == -1)
    {
        if (errno == EEXIST)
        {
            queueId = msgget(*key, IPC_CREAT | 0660);
            printf("Messege queue already exists, access acquired\n");
            return;
        }
        else
        {
            printf("Couldn't create message queue. Process ended with error: %d\n", errno);
            exit(EXIT_FAILURE);
        }
    }
    else
    {
        printf("Message queue has been created with id: %d\n", queueId);
    }

我收到错误编号 38,即 ENAMETOOLONG。在这种情况下我该怎么办?

【问题讨论】:

  • 这是在 WSL2 上还是在原始 WSL 上?
  • @PiRocks 原创 WSL
  • 你用的是什么名字?
  • @Shawn 叫什么名字?

标签: c linux windows-subsystem-for-linux


【解决方案1】:

根据this github issue,WSL 不支持 SysV 消息队列。您需要切换到 WSL2,这是一个在适当的 VM 中运行的 Linux 实例,或者找到其他方法。

【讨论】:

  • 转换修复了它。谢谢。
猜你喜欢
  • 2014-08-26
  • 1970-01-01
  • 2011-01-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多