Back to index

glibc  2.9
fd_to_filename.h File Reference
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <stdio-common/_itoa.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


static const char * fd_to_filename (int fd)

Function Documentation

static const char* fd_to_filename ( int  fd) [inline, static]

Definition at line 26 of file fd_to_filename.h.

  char *ret = malloc (30);

  if (ret != NULL)
      struct stat64 st;

      *_fitoa_word (fd, __stpcpy (ret, "/proc/self/fd/"), 10, 0) = '\0';

      /* We must make sure the file exists.  */
      if (__lxstat64 (_STAT_VER, ret, &st) < 0)
         /* /proc is not mounted or something else happened.  Don't
            return the file name.  */
         free (ret);
         ret = NULL;
  return ret;

Here is the call graph for this function: