getting a filename from an fd

getting a filename from an fd

Post by Jesse Marli » Tue, 18 Dec 2001 02:32:41



Is there a portable way to get a filename from a file descriptor?

 
 
 

getting a filename from an fd

Post by Paul Pluzhniko » Tue, 18 Dec 2001 02:59:53



Quote:

> Is there a portable way to get a filename from a file descriptor?

No. There may not even be any name for a file descriptor:
think socket, pipe, terminal ...

 
 
 

getting a filename from an fd

Post by Logan Sh » Tue, 18 Dec 2001 03:49:37






>> Is there a portable way to get a filename from a file descriptor?

>No. There may not even be any name for a file descriptor:
>think socket, pipe, terminal ...

..., file that's still open after someone called unlink() ...

  - Logan
--
"In order to be prepared to hope in what does not deceive,
 we must first lose hope in everything that deceives."

                                          Georges Bernanos

 
 
 

getting a filename from an fd

Post by -wisegu » Tue, 18 Dec 2001 03:53:08




Quote:

> Is there a portable way to get a filename from a file descriptor?

I don't believe so...Once you have the file descriptor you shouldn't need the
filename.  Obviously, you had the filename when you opened the descriptor,
right?

--
-wiseguy
slummin it in Colorado ski country, while watching the IT industry move
to India, and thinking about retraining as a Sanitation Engineer

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

 
 
 

getting a filename from an fd

Post by Jesse Marli » Tue, 18 Dec 2001 04:26:30





> > Is there a portable way to get a filename from a file descriptor?

> No. There may not even be any name for a file descriptor:
> think socket, pipe, terminal ...

Right.  I was thinking if something was available it would be NULL
for pipes, sockets, etc.  Thanks for the confirmation.
 
 
 

getting a filename from an fd

Post by Jesse Marli » Tue, 18 Dec 2001 04:27:48





> > Is there a portable way to get a filename from a file descriptor?

> I don't believe so...Once you have the file descriptor you shouldn't need the
> filename.  Obviously, you had the filename when you opened the descriptor,
> right?

Yeah.  This was to avoid changing a protoype for a function.
Quote:

> --
> -wiseguy
> slummin it in Colorado ski country, while watching the IT industry move
> to India, and thinking about retraining as a Sanitation Engineer

> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

 
 
 

getting a filename from an fd

Post by Frank Pilhof » Tue, 18 Dec 2001 22:52:06



> Is there a portable way to get a filename from a file descriptor?

 fstat ?

        Frank

--

A lawyer is someone who writes an eighty-page document and calls it
a brief. - Alfred E. Neuman