


IO_CTRL(3)      PEKS 0.8.13 Programming Interface      IO_CTRL(3)


NNAAMMEE
       io_thtrp  -  set  a  trap function to cope with io threads
       table overfrow

SSYYNNOOPPSSIISS
       ##iinncclluuddee <<ppeekkss..hh>>

       iinntt iioo__tthhttrrpp ((uunnssiiggnneedd _f_d,,
                     iinntt((**))((vvooiidd**,,uunnssiiggnneedd lloonngg)) _t_r_a_p,, vvooiidd **_d_a_t_a_,
                     iinntt _u_s_e___p_i_d))_;

DDEESSCCRRIIPPTTIIOONN
       This function installs  a  trap  on  the  server  that  is
       invoked  when the client detects an io threads table over-
       flow. This typically happens when a series of server child
       functions   die  unexpectedly  before  destroying  the  io
       threads on the receiving client.

       On the client, the trap feature  is  activated  while  the
       second function argument is -1 or 1.

       The  trap  function gets a thread id (or a process id) and
       checks, whether the server part of the io thread is  still
       alive.  If so, the trap function returns a non-zero value,
       otherwise the value 0.

       In the latter case, the client is informed  to  purge  the
       corresponding  thread (see IIOO__PPUURRGGEE__TTHHRREEAADD in iioo__ccttrrll((33)).)

       If the second argument _t_r_a_p is NULL, the trap is  removed.
       If  the argument is 1, or -1, a receiver trap is installed
       on the receiver but  no  user  defined  function  will  be
       invoked.

       Example (receiver):

         int n = io_ctrl (socket, IO_MAX_THREADS, 0, 0) ;
         /* set the high water mark on 2/3rd of the total of channels */
         io_ctrl (socket, IO_HWMBL_THREADS, (n /= 3, &n), 0);
         io_thtrp (socket, (int(*)(void*,unsigned long))-1, 0, 1);
         ...

       Example (sender):

         int verify_io_process
             (void      *unused,
              unsigned long pid)
         {
           /* this function is reliable as super user, only */
           return (kill (pid, 0) >= 0 : 1 : 0) ;
         }
         ...

         /* install process tracker */



PEKS CIPHER LAYER          Jul 10, 2000                         1





IO_CTRL(3)      PEKS 0.8.13 Programming Interface      IO_CTRL(3)


         io_thtrp (socket, verify_io_process, 0, 1);


SSEEEE AALLSSOO
       iioossttrreeaamm(3), iioo__ccttrrll(3), iioo__ppuusshh(3), iioo__sseenndd(3), ffoorrkk(2),

AAUUTTHHOORR
       The ppeekkss package where these functions belong to was writ-
       ten by Jordan Hrycaj <jordan@teddy-net.com>, originally to
       support the nneessssuuss security scanner.















































PEKS CIPHER LAYER          Jul 10, 2000                         2


