bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

O_DIRECT "packet mode" pipes on Linux


From: Vito Caputo
Subject: O_DIRECT "packet mode" pipes on Linux
Date: Tue, 22 Sep 2020 20:23:06 -0700

Hello list,

Is there any chance we could get a | modifier for enabling O_DIRECT on the
created pipe?  "Packet" style pipes have some interesting and potentially
useful properties, it would be nice if bash made them more accessible.

pipe(2) O_DIRECT excerpt:

    O_DIRECT (since Linux 3.4)
           Create a pipe that performs I/O in "packet" mode.  Each write(2)
           to  the  pipe  is  dealt with as a separate packet, and read(2)s
           from the pipe will read one packet at a time.  Note the  follow‐
           ing points:
   
           *  Writes  of  greater than PIPE_BUF bytes (see pipe(7)) will be
              split  into  multiple  packets.   The  constant  PIPE_BUF  is
              defined in <limits.h>.
   
           *  If a read(2) specifies a buffer size that is smaller than the
              next packet, then the requested number of bytes are read, and
              the  excess  bytes in the packet are discarded.  Specifying a
              buffer size of  PIPE_BUF  will  be  sufficient  to  read  the
              largest possible packets (see the previous point).
   
           *  Zero-length packets are not supported.  (A read(2) that spec‐
              ifies a buffer size of zero is a no-op, and returns 0.)
   
           Older kernels that do not support this flag will  indicate  this
           via an EINVAL error.

Regards,
Vito Caputo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]