OAR

RTEMS 4.5.0 On-Line Library


Socket Options

PREV UP NEXT Bookshelf RTEMS Network Supplement

3.4.3: Socket Options

RTEMS adds two new SOL_SOCKET level options for setsockopt and getsockopt: SO_SNDWAKEUP and SO_RCVWAKEUP. For both, the option value should point to a sockwakeup structure. The sockwakeup structure has the following fields:

  void    (*sw_pfn) (struct socket *, caddr_t);
  caddr_t sw_arg;

These options are used to set a function to be called when there is data available from the socket (SO_RCVWAKEUP) and when there is space available to accept data written to the socket (SO_SNDWAKEUP).

If setsockopt is called with the SO_RCVWAKEUP option, and the sw_pfn field is not zero, then when there is data available to be read from the socket, the function pointed to by the sw_pfn field will be called. A pointer to the socket structure will be passed as the first argument to the function. The sw_arg field set by the SO_RCVWAKEUP call will be passed as the second argument to the function.

If setsockopt is called with the SO_SNDWAKEUP function, and the sw_pfn field is not zero, then when there is space available to accept data written to the socket, the function pointed to by the sw_pfn field will be called. The arguments passed to the function will be as with SO_SNDWAKEUP.

When the function is called, the network semaphore will be locked. The function must be careful not to call any networking functions. It is OK to call an RTEMS function; for example, it is OK to send an RTEMS event.

The purpose of these functions is to permit a more efficient alternative to the select call when dealing with a large number of sockets.


PREV UP NEXT Bookshelf RTEMS Network Supplement

Copyright © 1988-2000 OAR Corporation