How to get fd from file




















Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked 7. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled. Ask Question. Asked 11 years, 6 months ago. Active 1 month ago. Viewed k times. Improve this question. Phil Miller. Phil Miller Phil Miller Or you could open the file with open 2 , and you would have a file descriptor from the beginning — Antoine Pelisse.

Add a comment. Active Oldest Votes. Improve this answer. SO Stinks 3, 4 4 gold badges 29 29 silver badges 36 36 bronze badges. Strictly speaking, there wouldn't be any need to mention any headers or libraries if the function was indeed a part of standard C library. However, it is not standard, which is why it might make sense to mention the header at least.

Accessing functions in the standard C library does require including headers, at least if your compiler expects prototypes I never remember what's actually standard behavior in that respect. Without headers, no names are defined at the beginning of a C file. Novelocrat: I didn't mean that there's no need to include anything. I need to get the name of a file from a given file descriptor, inside a small linux kernel module that I wrote. How can I do it?

If your code is running in process-context eg. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How can I get a filename from a file descriptor inside a kernel module? Ask Question. Asked 10 years, 1 month ago. Active 4 years, 7 months ago.

Viewed 15k times. Improve this question. Community Bot 1 1 1 silver badge.



0コメント