Saturday, 9 January 2021

Re: [gccsdk] Is there a file handle equivalent of __ro_socket?

On 05/01/2021 12:05, Chris Johns wrote:
> Hello
>
> Is there a way to convert from a unixlib fd to a RISC OS file handle?
> It's actually the name of file I want but I can use OS_Args to get that
> from the risc os file handle.

Not exactly no, but the code for __get_ro_socket is:

return (int)getfd (sockfd)->devicehandle->handle;

It doesn't check that it actually has a socket fd, so it seems likely
that if you gave it a file fd you would get the RISC OS file handle
back. If we were to implement a __get_ro_file, I suspect it would
probably be the exact same code. If it does work, then perhaps

#define __get_ro_file __get_ro_socket

would be useful in your code to indicate that you're expecting a file
and not a socket.

Lee.

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

No comments:

Post a Comment