Changeset 91b1c8e in rtems


Ignore:
Timestamp:
Dec 7, 1998, 5:42:52 PM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
2ffe30d
Parents:
e203c04b
Message:

Patch from Ian Lance Taylor <ian@…>:

RTEMS permits using the SO_SNDTIMEO and SO_RCVTIMEO socket options to
set a timeout for most socket I/O operations. However, in RTEMS
4.0.0, those options do not affect connect or accept. I don't know of
any way to put a timeout on those calls in RTEMS 4.0.0; can anybody
point to one.

Since it is frequently useful to have a timeout on accept, and
sometimes useful to have a timeout on connect shorter than the BSD
system default of 75 seconds, the following patch causes SO_RCVTIMEO
to affect connect and accept.

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libnetworking/rtems/rtems_bsdnet_internal.h

    re203c04b r91b1c8e  
    4242 */
    4343struct socket;
    44 extern void soconnsleep (struct socket *so);
     44extern int soconnsleep (struct socket *so);
    4545extern void soconnwakeup (struct socket *so);
    4646#define splnet()        0
  • c/src/exec/libnetworking/rtems/rtems_glue.c

    re203c04b r91b1c8e  
    381381 * Wait for a connection/disconnection event.
    382382 */
    383 void
     383int
    384384soconnsleep (struct socket *so)
    385385{
    386386        rtems_event_set events;
    387387        rtems_id tid;
     388        rtems_status_code sc;
    388389
    389390        /*
     
    405406         * Wait for the wakeup event.
    406407         */
    407         rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events);
     408        sc = rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, so->so_rcv.sb_timeo, &events);
    408409
    409410        /*
     
    411412         */
    412413        so->so_pgid = 0;
     414
     415        switch (sc) {
     416        case RTEMS_SUCCESSFUL:  return 0;
     417        case RTEMS_TIMEOUT:     return EWOULDBLOCK;
     418        default:                return ENXIO;
     419        }
    413420}
    414421
  • c/src/exec/libnetworking/rtems/rtems_syscall.c

    re203c04b r91b1c8e  
    212212        }
    213213        while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
    214                 soconnsleep (so);
     214                so->so_error = soconnsleep (so);
    215215        }
    216216        if (error == 0) {
     
    272272                        break;
    273273                }
    274                 soconnsleep (head);
     274                head->so_error = soconnsleep (head);
    275275        }
    276276        if (head->so_error) {
  • c/src/lib/libnetworking/rtems/rtems_bsdnet_internal.h

    re203c04b r91b1c8e  
    4242 */
    4343struct socket;
    44 extern void soconnsleep (struct socket *so);
     44extern int soconnsleep (struct socket *so);
    4545extern void soconnwakeup (struct socket *so);
    4646#define splnet()        0
  • c/src/lib/libnetworking/rtems/rtems_glue.c

    re203c04b r91b1c8e  
    381381 * Wait for a connection/disconnection event.
    382382 */
    383 void
     383int
    384384soconnsleep (struct socket *so)
    385385{
    386386        rtems_event_set events;
    387387        rtems_id tid;
     388        rtems_status_code sc;
    388389
    389390        /*
     
    405406         * Wait for the wakeup event.
    406407         */
    407         rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events);
     408        sc = rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, so->so_rcv.sb_timeo, &events);
    408409
    409410        /*
     
    411412         */
    412413        so->so_pgid = 0;
     414
     415        switch (sc) {
     416        case RTEMS_SUCCESSFUL:  return 0;
     417        case RTEMS_TIMEOUT:     return EWOULDBLOCK;
     418        default:                return ENXIO;
     419        }
    413420}
    414421
  • c/src/lib/libnetworking/rtems/rtems_syscall.c

    re203c04b r91b1c8e  
    212212        }
    213213        while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
    214                 soconnsleep (so);
     214                so->so_error = soconnsleep (so);
    215215        }
    216216        if (error == 0) {
     
    272272                        break;
    273273                }
    274                 soconnsleep (head);
     274                head->so_error = soconnsleep (head);
    275275        }
    276276        if (head->so_error) {
  • c/src/libnetworking/rtems/rtems_bsdnet_internal.h

    re203c04b r91b1c8e  
    4242 */
    4343struct socket;
    44 extern void soconnsleep (struct socket *so);
     44extern int soconnsleep (struct socket *so);
    4545extern void soconnwakeup (struct socket *so);
    4646#define splnet()        0
  • c/src/libnetworking/rtems/rtems_glue.c

    re203c04b r91b1c8e  
    381381 * Wait for a connection/disconnection event.
    382382 */
    383 void
     383int
    384384soconnsleep (struct socket *so)
    385385{
    386386        rtems_event_set events;
    387387        rtems_id tid;
     388        rtems_status_code sc;
    388389
    389390        /*
     
    405406         * Wait for the wakeup event.
    406407         */
    407         rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events);
     408        sc = rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, so->so_rcv.sb_timeo, &events);
    408409
    409410        /*
     
    411412         */
    412413        so->so_pgid = 0;
     414
     415        switch (sc) {
     416        case RTEMS_SUCCESSFUL:  return 0;
     417        case RTEMS_TIMEOUT:     return EWOULDBLOCK;
     418        default:                return ENXIO;
     419        }
    413420}
    414421
  • c/src/libnetworking/rtems/rtems_syscall.c

    re203c04b r91b1c8e  
    212212        }
    213213        while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
    214                 soconnsleep (so);
     214                so->so_error = soconnsleep (so);
    215215        }
    216216        if (error == 0) {
     
    272272                        break;
    273273                }
    274                 soconnsleep (head);
     274                head->so_error = soconnsleep (head);
    275275        }
    276276        if (head->so_error) {
  • cpukit/libnetworking/rtems/rtems_bsdnet_internal.h

    re203c04b r91b1c8e  
    4242 */
    4343struct socket;
    44 extern void soconnsleep (struct socket *so);
     44extern int soconnsleep (struct socket *so);
    4545extern void soconnwakeup (struct socket *so);
    4646#define splnet()        0
  • cpukit/libnetworking/rtems/rtems_glue.c

    re203c04b r91b1c8e  
    381381 * Wait for a connection/disconnection event.
    382382 */
    383 void
     383int
    384384soconnsleep (struct socket *so)
    385385{
    386386        rtems_event_set events;
    387387        rtems_id tid;
     388        rtems_status_code sc;
    388389
    389390        /*
     
    405406         * Wait for the wakeup event.
    406407         */
    407         rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events);
     408        sc = rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, so->so_rcv.sb_timeo, &events);
    408409
    409410        /*
     
    411412         */
    412413        so->so_pgid = 0;
     414
     415        switch (sc) {
     416        case RTEMS_SUCCESSFUL:  return 0;
     417        case RTEMS_TIMEOUT:     return EWOULDBLOCK;
     418        default:                return ENXIO;
     419        }
    413420}
    414421
  • cpukit/libnetworking/rtems/rtems_syscall.c

    re203c04b r91b1c8e  
    212212        }
    213213        while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
    214                 soconnsleep (so);
     214                so->so_error = soconnsleep (so);
    215215        }
    216216        if (error == 0) {
     
    272272                        break;
    273273                }
    274                 soconnsleep (head);
     274                head->so_error = soconnsleep (head);
    275275        }
    276276        if (head->so_error) {
Note: See TracChangeset for help on using the changeset viewer.