Ioctl capacity query

Can anyone help me construct a call to ioctl ! ioctl to accomplish the below Linux Call?

The following ioctl(2) operation, which can be applied to a file descriptor that refers to either end of a pipe, places a count of the number of unread bytes in the pipe in the int buffer pointed to by the final argument of the call: ioctl(fd, FIONREAD, &nbytes); The FIONREAD operation is not specified in any standard, but is provided on many implementations.

You can use the libc crate. It provides both the ioctl function and the FIONREAD constant.

1 Like

Is there a way to get the "File" that is wrapped in a LineWriter?

You can use into_inner on a LineWriter<File> (as per the example).

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.