having problem with mkfifo I/O operations in android

188 views
Skip to first unread message

Shahriar Vaghar

unread,
Sep 8, 2018, 12:54:58 PM9/8/18
to android-ndk
Hello,

Please direct me to the right group if this not right one.

I am using named pipe for inter-process communication in my native processes on android arm 64 (version > 24).

I use mkfifo to create the named pipe successfully. I set the size of the pipe to 264KB.

The problems is the writer side reports EAGAIN (11) after writing less than 10KB in to the pipe and can never recover from the error.

        aec_fd = open(pipe_name, O_WRONLY | O_SYNC | O_NONBLOCK);


        pipeFD = open(pipe_name, O_RDONLY);


        bytes_wrote = write(aec_fd, buffer, bytes);


Why the pipe overflows so fast? How do you recover from it?



Best regards, Shahriar

Dan Albert

unread,
Sep 8, 2018, 1:47:47 PM9/8/18
to android-ndk
EAGAIN doesn't mean the pipe is full, it means the operation was interrupted. Use TEMP_FAILURE_RETRY.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/9a5577d9-c624-405d-ae65-a461782bf1e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shahriar Vaghar

unread,
Sep 8, 2018, 9:29:31 PM9/8/18
to android-ndk
Hi

Thanks for the suggestion. I'll try that.

To give you more information about my problem

In normal runtime condition, write returns EAGAIN after a while several minutes.

But to find out why, I tested by not reading from the pipe. Write returns EAGAIN after 6 writes of 1K buffer.
Reply all
Reply to author
Forward
0 new messages