Error using POSIX mqueues on Arduino Yun Rev 2 lede 17.11?

Hello, I'm fairly new to openwrt and have an application written in c that I am attempting to run on my Arduino Rev 2. I have been cross-compiling using this buildroot https://github.com/arduino/lede-yun and have successfully gotten most of my code running, however I seem to have an error when I attempt to utilize the mqueue library on the yun. Here is the example code.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <mqueue.h>
#include <stdio.h> 
#include <string.h> 
#include <stdlib.h>

#include <fcntl.h>

#include "common.h"

int main(int argc, char **argv)
{
    mqd_t mq;
    struct mq_attr attr;
    char buffer[MAX_SIZE + 1];
    int must_stop = 0;

    /* initialize the queue attributes */
    attr.mq_flags = 0;
    attr.mq_maxmsg = 10;
    attr.mq_msgsize = MAX_SIZE;
    attr.mq_curmsgs = 0;

    /* create the message queue */
    mq = mq_open(QUEUE_NAME, O_CREAT | O_RDONLY, 0644, &attr);
    CHECK((mqd_t)-1 != mq);

    do {
        ssize_t bytes_read;

        /* receive the message */
        bytes_read = mq_receive(mq, buffer, MAX_SIZE, NULL);
        CHECK(bytes_read >= 0);

        buffer[bytes_read] = '\0';
        if (! strncmp(buffer, MSG_STOP, strlen(MSG_STOP)))
        {
            must_stop = 1;
        }
        else
        {
            printf("Received: %s\n", buffer);
        }
    } while (!must_stop);

    /* cleanup */
    CHECK((mqd_t)-1 != mq_close(mq));
    CHECK((mqd_t)-1 != mq_unlink(QUEUE_NAME));

    return 0;
}

I can get it compiled just fine but once I scp it to the yun I get this error from mq_open()

main:33: (mqd_t)-1 != mq: Function not implemented

Is there a way to configure or patch this? I am concerned with getting a totally new image on the yun since I want to utilize the integrated serial connection between the Yun's AVR chip and the microprocessor so I can send data from the AVR side to the microprocessor OpenWrt is on.

Thanks in advance for any assistance.

not "our" buildroot, ask the maintainer.

and that repository appears to be LEDE, not Openwrt.

1 Like

The buildroot has an mqueue.h file, so I was confused if I had to somehow boot the yun with the root I'm using, and wasn't sure how I might go about something like that. I will also ask the maintainer though.

Link to the issue if someone else has a similar problem https://bugs.openwrt.org/index.php?do=details&task_id=3981

dude, again, we're not the maintainer ....

post at https://github.com/arduino/lede-yun/issues

Ope. My bad. Here is the issue linked to the maintainer https://github.com/arduino/lede-yun/issues/9#issue-972807322

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.