To get information about open fd, you can use fstat (). I assume that the st_mode of the result should be S_IFIFO for the channel. Alternatively, / proc / self / fd / and / proc / self / fdinfo / also provide some information about the file descriptor. Keep in mind that / proc is Linux specific.
However, I think it would be easier to just try using splice () first, and if it doesn't work (with EINVAL?), Go back to your magic.
source
share