The HyperNews Linux KHG Discussion Pages

Note: A way to "transform" a file descriptor into a struct file* in a user process

Forum: The Linux Kernel Hackers' Guide
Re: Question Passing file descriptors to the kernel (Pradeep Gore)
Keywords: file descriptor userfs pipe module
Date: Wed, 14 Jan 1998 23:07:42 GMT
From: Lorenzo Cavallaro <[email protected]>

Well, I don't know if I can help you and
maybe this'll be a stupid answer, but
about finding a way to transform a file descriptor into
a struct file*, try:

struct file *fdopen(int filedes, char *mode)

Where filedes is your file descriptor (Geeeee :) )
and mode can be either "w" or "r" (write/read mode)

This functin returns upon successfull a struct file*, else
a NULL pointer;

Let you also look on the man page;
This should work in a user process.