2

I know that wsl uses translates every command to be executed from the Windows kernel, but still, my question is :
Does WSL support system calls (e.g. message queues) and if yes,how?

I am getting the "Function not implemented" error whenever using any of the message queue functions.Is there any hope at all?

[EDIT:]

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;
}
6
  • 3
    Show us a piece of code that's not working. WSL is actually using a virtual machine, so it should support all functions of linux. Commented Oct 27, 2021 at 10:29
  • @PMF , just posted the code Commented Oct 27, 2021 at 10:51
  • Have you added the required header file for msgctl? Commented Oct 27, 2021 at 10:57
  • The first sentence about the translation of Linux system calls to Windows NT system calls is only true for WSL 1. WSL 2 includes its own Linux kernel running in parallel with the Windows NT kernel. Commented Oct 27, 2021 at 11:14
  • Does your version of Windows support WSL 2? If so, it is possible to convert existing WSL 1 distros to WSL 2, which should solve the problem. Commented Oct 27, 2021 at 11:41

1 Answer 1

5

System V IPC is missing in WSL(1), which is what msgctl belongs to.

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.