One Quickie
Finding the path corresponding to an open file descriptor (Unix->General)
With fcntl, all things are possible.
char pathbuf[PATH_MAX];
if (fcntl(fd, F_GETPATH, pathbuf) >= 0) {
printf ("wow: %s\n", pathbuf);
} else {
printf ("oops %s\n", strerror(errno));
}
Finding this feature was a surprise, having lived under the assumption that you can't map from a file descriptor to a path in the file system. Obviously things like sockets and pipes will return an error, but it actually seems to work.