Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
323 views
in Technique[技术] by (71.8m points)

c - Can't create message queue in Linux subsystem on Windows

I try to create message queue on linux subsystem in Windows 10. When I try to create message queue using this function:

 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
");
            return;
        }
        else
        {
            printf("Couldn't create message queue. Process ended with error: %d
", errno);
            exit(EXIT_FAILURE);
        }
    }
    else
    {
        printf("Message queue has been created with id: %d
", queueId);
    }

I receive an error number 38 which is ENAMETOOLONG. What can I do in this case?

question from:https://stackoverflow.com/questions/65849444/cant-create-message-queue-in-linux-subsystem-on-windows

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

According to this github issue, WSL does not support SysV message queues. You'll need to switch to WSL2, a Linux instance running in a proper VM, or find a different approach.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...