Re: [gccsdk] af_unix socketpair

2020-08-30 Thread Ralph Corderoy
Hi Lee,

> > Does sockets only exist in the current task? If I do
> > "wimp_start_task", can I use my socket in the new task?
>
> No, although the underlining OS socket is I believe system wide,
> Unixlib refers to them by file descriptor and these are allocated
> locally within each task rather than system wide as Linux might do, so
> you can't pass the file descriptors between tasks.

Unix (Linux) allocates file descriptors within a process, that's why
they all start at zero and the lowest unused one within the process is
allocated.  But I think you know that and it's terminology where we
differ.  An FD is an index into the process's FD table and that entry
references an element in the kernel's single file table, FT.

Unix can pass a file descriptor from one process to another.  What's
really being passed is the reference to the kernel's FT entry.  Thus the
FT entry may be referenced by a different FD in the receiving process,
e.g. 42 becomes 314.

> You may be able to pass the underlying OS socket between tasks, but
> Unixlib in the task you pass it to would not be aware of it; I don't
> think Unixlib can adopt an existing OS socket.

So if Unixlib wanted to grow the ability to mimic Unix in this regard,
it would be by supporting the SCM_RIGHTS ancillary message over a Unix
domain socket.  See unix(7) on Linux.

-- 
Cheers, Ralph.

___
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


Re: [gccsdk] af_unix socketpair

2020-08-29 Thread Lee Noar

On 29/08/2020 19:55, Michael Grunditz wrote:

On Sat, 29 Aug 2020 at 20:24, Lee Noar  wrote:


On 29/08/2020 17:23, Michael Grunditz wrote:

Hi

I think that exiting from socketpair on "operation in progress" is a bug.
The pair of sockets is o k , and that message is more informative than error.

Having solved that , I have a follow up question:

Does sockets only exist in the current task? If I do
"wimp_start_task", can I use my socket in the new task?


No, although the underlining OS socket is I believe system wide, Unixlib
refers to them by file descriptor and these are allocated locally within
each task rather than system wide as Linux might do, so you can't
pass the file descriptors between tasks.

You may be able to pass the underlying OS socket between tasks, but
Unixlib in the task you pass it to would not be aware of it; I don't
think Unixlib can adopt an existing OS socket.


Ok, so if I pass the filedescriptor to the second task it will be void?


The second task may already be using that particular file descriptor
for something else and if it isn't then there's no way to bind it
to the OS socket that the first task is using.


Another option would be a mem based protocol.


That's the method I went with, I use a dynamic area to pass messages
between tasks. The dynamic area number is global and can be passed to
the second task on the command line when it starts.

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


Re: [gccsdk] af_unix socketpair

2020-08-29 Thread Lee Noar

On 29/08/2020 17:23, Michael Grunditz wrote:

Hi

I think that exiting from socketpair on "operation in progress" is a bug.
The pair of sockets is o k , and that message is more informative than error.

Having solved that , I have a follow up question:

Does sockets only exist in the current task? If I do
"wimp_start_task", can I use my socket in the new task?


No, although the underlining OS socket is I believe system wide, Unixlib
refers to them by file descriptor and these are allocated locally within
each task rather than system wide as Linux might do, so you can't
pass the file descriptors between tasks.

You may be able to pass the underlying OS socket between tasks, but
Unixlib in the task you pass it to would not be aware of it; I don't
think Unixlib can adopt an existing OS 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


Re: [gccsdk] af_unix socketpair

2020-08-29 Thread Michael Grunditz
On Sat, 29 Aug 2020 at 21:08, Lee Noar  wrote:
>
> On 29/08/2020 19:55, Michael Grunditz wrote:
> > On Sat, 29 Aug 2020 at 20:24, Lee Noar  wrote:
> >>
> >> On 29/08/2020 17:23, Michael Grunditz wrote:
> >>> Hi
> >>>
> >>> I think that exiting from socketpair on "operation in progress" is a bug.
> >>> The pair of sockets is o k , and that message is more informative than 
> >>> error.
> >>>
> >>> Having solved that , I have a follow up question:
> >>>
> >>> Does sockets only exist in the current task? If I do
> >>> "wimp_start_task", can I use my socket in the new task?
> >>
> >> No, although the underlining OS socket is I believe system wide, Unixlib
> >> refers to them by file descriptor and these are allocated locally within
> >> each task rather than system wide as Linux might do, so you can't
> >> pass the file descriptors between tasks.
> >>
> >> You may be able to pass the underlying OS socket between tasks, but
> >> Unixlib in the task you pass it to would not be aware of it; I don't
> >> think Unixlib can adopt an existing OS socket.
> >
> > Ok, so if I pass the filedescriptor to the second task it will be void?
>
> The second task may already be using that particular file descriptor
> for something else and if it isn't then there's no way to bind it
> to the OS socket that the first task is using.
>
> > Another option would be a mem based protocol.
>
> That's the method I went with, I use a dynamic area to pass messages
> between tasks. The dynamic area number is global and can be passed to
> the second task on the command line when it starts.

Thanks for the clarification .. I dont think the TRM on network module
is very helpful,, or my reading skills are bad!

___
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


Re: [gccsdk] af_unix socketpair

2020-08-29 Thread Michael Grunditz
Hi

I think that exiting from socketpair on "operation in progress" is a bug.
The pair of sockets is o k , and that message is more informative than error.

Having solved that , I have a follow up question:

Does sockets only exist in the current task? If I do
"wimp_start_task", can I use my socket in the new task?

On Wed, 26 Aug 2020 at 23:25, Michael Grunditz
 wrote:
>
> Hi
>
> Is unix sockets supported, by unixlib?
> Trying to use socketpair(...)
> I can see a bug report of it , but no reply to that, from what I can see.
>
> Cheers!
>
> Michael

___
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


Re: [gccsdk] af_unix socketpair

2020-08-27 Thread Michael Grunditz
I have studied the sources and it doesn't support it.

On Wed, 26 Aug 2020 at 23:25, Michael Grunditz
 wrote:
>
> Hi
>
> Is unix sockets supported, by unixlib?
> Trying to use socketpair(...)
> I can see a bug report of it , but no reply to that, from what I can see.
>
> Cheers!
>
> Michael

___
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