Go to the FreeLists Home Page Home Signup Help Login
 



[openbeosnetteam] || [Date Prev] [04-2002 Date Index] [Date Next] || [Thread Prev] [04-2002 Thread Index] [Thread Next]

[openbeosnetteam] Re: Ping & timers...

  • From: "David Reid" <dreid@xxxxxxxxxxxx>
  • To: <openbeosnetteam@xxxxxxxxxxxxx>
  • Date: Tue, 2 Apr 2002 17:49:07 +0100
OK, I'm going to try adding this now.

Thanks :)

david
----- Original Message ----- 
From: <philippe.houdoin@xxxxxxx>
To: <openbeosnetteam@xxxxxxxxxxxxx>
Sent: Tuesday, April 02, 2002 3:01 PM
Subject: [openbeosnetteam] Re: Ping & timers...


> > Any progress on how we use the variables passed into select yet?
> 
> Oh, sorry for not answering this point more quicker.
> 
> Yes, the solution is to call the BeOS kernel notify_select_event(), 
> with the corresponding selectsync and ref.
> Those are the ones passed by kernel to /dev/net/socket 
> net_socket_[de]select() hooks.
> 
> I should have commit this fix long ago already, but can't find 
> both time and where I could store the selectsync / ref for each 
> select event (read, write, exception).
> The best way /me think is to add:
> 
>   struct {
>     selectsync * sync;
>     uint32       ref;
>   } selectinfo[3];
> 
> in struct socket definition.
> But this imply that socket structure will be no more an opaque thing 
> for the socket driver, which is bad (tm).
> 
> Anyway, in driver/socket.c:
> 
> static status_t net_socket_select
>   (
>   void *       cookie, 
>   uint8        event,
>   uint32       ref,
>   selectsync * sync
>   )
> {
>   struct socket * so = (struct socket *) cookie;
> 
>   so->selectinfo[event].sync = sync;
>   so->selectinfo[event].ref  = ref;
>   return B_OK;
> }
> 
> 
> static status_t net_socket_deselect
>   (
>   void *       cookie, 
>   uint8        event,
>   selectsync * sync
>   )
> {
>   struct socket * so = (struct socket *) cookie;
> 
>   so->selectinfo[event].sync = NULL;
>   so->selectinfo[event].ref  = 0;
>   return B_OK;
> }
> 
> And, last but not least, *somewhere*, you will need to 
> call notify_select_event() when a select event raise on the socket:
> 
> // these are missing from KernelExport.h ...
> #define  B_SELECT_READ       1
> #define  B_SELECT_WRITE      2
> #define  B_SELECT_EXCEPTION  3
> extern void notify_select_event(selectsync *sync, uint32 ref);
> 
> if (so->selectinfo[event].sync)
>   notify_select_event(so->selectinfo[event].sync, 
>                       so->selectinfo[event].ref);
> 
> Problem is "where"?
> 
> I must confess I'm lost in the current higher level of socket layer.
> Should the notify take place in sowakeup()?
> Who wait on the read/write sockbuf sb_pop semaphore?
> Is there is already some "exception" handling somewhere, where 
> a B_SELECT_EXCEPTION should be notified too?
> 
> -Philippe, lost in no_more_than_six_letters_struct_fields_names land ;-)
> 
> 






[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.