Logo Search packages:      
Sourcecode: leafnode version File versions

static nlink_t fd_st_nlink ( const int  fd  )  [static]

get hard link count of open file pointed to by filedes. uses fstat(2)

Returns:
0 in case of trouble (which is also logged), the count of hard links otherwise
NOTE: you cannot distinguish "fstat error" from "deleted file".
Parameters:
fd  open file descriptor

Definition at line 52 of file lockfile.c.

Referenced by try_lock().

{
    struct stat st;

    if (fstat(fd, &st)) {
      ln_log(LNLOG_SERR, LNLOG_CTOP, "Cannot fstat %d: %m", fd);
      return 0;
    }

    return st.st_nlink;
}


Generated by  Doxygen 1.6.0   Back to index