This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fmemopen


Hi,

I've been futzing with the thing and it would be "really convenient"
to be able to either get the cookie with some call or other or else
to be able to have it be able to handle a variation on an IOCTL.
Neither of these are, alas, possible without doing some ugly games
with global variables.  Ick.

My first attempt was to sneak in an fseek using a non-standard
direction code.  Unfortunately, the fseek call goes to a generic
procedure that validates the direction code before calling through
to the underlying ``_IO_cookie_seek (fp, offset, dir)'' code.
My next attempt was to try to create a new function, "fcookie" that
would map a cookie FILE* pointer into the original cookie.  This
way, my private ``fmem_ioctl()'' function could start with:

   int fmem_ioctl( FILE* fp, int cmd, void* ptr ) {
      void* cookie = fcookie( fp );
      if (cookie == NULL) {
          errno = EINVAL;
          return -1;
      }

Unfortunately, I found it too hard to do.  There was too much name remapping
going on to wind my way through how it was happening and it wouldn't build
anyway.  So, it devolves to an RFE for you all, if you would please be so kind.  :)

Thank you.

Regards, Bruce


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]