0

I'm on the latest Raspbian Jessie.

I'd like to increase the size of an open FIFO pipe buffer.

I've already upped the max size via sudo sysctl fs.pipe-max-size=4194304

Then I'm attempting the following perl script to set my open pipe to that size:

#!/usr/bin/perl
# usage: name-of-open-fifo size-in-bytes
use Fcntl;
my $fifo = shift @ARGV or die "usage: fifo size";
my $size = shift @ARGV or die "usage: fifo size";
open(FD, $fifo) or die "cannot open";
printf "old size %d\n",fcntl(\*FD, Fcntl::F_GETPIPE_SZ, 0);
my $new = fcntl(\*FD, Fcntl::F_SETPIPE_SZ, int($size));
die "failed" if $new<$size;
printf "new size %d\n",$new;

But no luck:

$ ~/setfifo.sh /tmp/temp_video.h264 4194304
old size 4 failed at /home/pi/setfifo.sh line 10

Anyone know how to do this?

0

Your code to calculate the old size looks dodgy to me. Are you sure it's not just that line failing. In C \* introduces a multi-line comment, what does it do in perl.

In C I use the following invocation to change the pipe size. I have seen no evidence that it doesn't work.

   if (bufSize != 0)
   {
      i = fcntl(fd, F_SETPIPE_SZ, bufSize);
      if (i != bufSize)
      {
         gpioNotify[slot].state = PI_NOTIFY_CLOSED;
         SOFT_ERROR(PI_BAD_PATHNAME,
            "fcntl %s size %d failed (%m)", name, bufSize);
      }
   }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.