Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Asynchronous File I/O on Linux



On Sat, May 15, 2010 at 5:56 PM, Mark Woodward <markw-FJ05HQ0HCKaWd6l5hS35sQ at public.gmane.org> wrote:
> Bill Bogstad wrote:

>
> OK, so, the methodology is quite similar, fine. Now the question remains, is
> it possible to quickly "clone" an existing file handle so that it will be a
> new and distinct file handle with the same permissions and modes with its
> own distict view of current location, i.e. seek on one does not affect seek
> on the other?

The closest that I can think of involves /proc/self/fd.   It doesn't
do same permissions/modes, but does
give you different seek pointers.  I suspect it only works with
seekable (i.e. disk file) file descriptors...

/* crappy (uncompiled) code follows */
sprintf(bigbuf, "/proc/self/fd/%d", oldfd);
newfd = open(bigbuf, flags);

Bill Bogstad






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org