fd_same(3)
limb manual
fd_same(3)
NAME
fd_same - return whether or not two file descriptors reference the same file
SYNOPSIS
#include <limb/djbunix.h>
int fd_same(int fd1, int fd2)
DESCRIPTION
The fd_same() function returns whether or not the file descriptors fd1 and
fd2 reference the same file.
This is determined by calling fstat(3) for both and comparing the value of
members st_dev and st_ino of their respective struct stat.
RETURN VALUE
On success, the fd_same() function returns 1 when both file descriptors
reference the same file, and 0 when they don't.
Otherwise, it returns -1 and sets errno to indicate the error.
ERRORS
The fd_same() function may fail and set errno for any of the errors specified
for fstat(3).