Suppose you have the following bits of code:
int fd[2];
pipe(fd);
close(fd[0]);
//I'd like some code that takes in
//fd and tells me that the read end has been closed but the write end is
//still open, without actually writing or reading in C.
What's the simplest way to accomplish this?