Print this page
arcstat


  85                          * (so we have never been suspended).  In this
  86                          * case, we'll try to stay to the desired
  87                          * cadence, and we will pause for 1/2 the normal
  88                          * interval this time.
  89                          */
  90                         pause = interval / 2;
  91                         *wakeup += interval;
  92                 }
  93         else
  94                 *wakeup += interval;
  95         if (pause < 1000)
  96                 /* Near enough */
  97                 return;
  98 
  99         /* Now do the actual sleep */
 100         pause_left = pause;
 101         do {
 102                 pause_tv.tv_sec = pause_left / NANOSEC;
 103                 pause_tv.tv_nsec = pause_left % NANOSEC;
 104                 status = nanosleep(&pause_tv, (struct timespec *)NULL);
 105                 if (status < 0)
 106                         if (errno == EINTR) {
 107                                 now = gethrtime();
 108                                 pause_left = *wakeup - now;
 109                                 if (pause_left < 1000)
 110                                         /* Near enough */
 111                                         return;
 112                         } else {
 113                                 fail(1, "nanosleep failed");
 114                         }

 115         } while (status != 0);
 116 }
 117 
 118 /*
 119  * Signal handler - so we can be aware of SIGCONT
 120  */
 121 void
 122 cont_handler(int sig_number)
 123 {
 124         /* Re-set the signal handler */
 125         (void) signal(sig_number, cont_handler);
 126         caught_cont = 1;
 127 }


  85                          * (so we have never been suspended).  In this
  86                          * case, we'll try to stay to the desired
  87                          * cadence, and we will pause for 1/2 the normal
  88                          * interval this time.
  89                          */
  90                         pause = interval / 2;
  91                         *wakeup += interval;
  92                 }
  93         else
  94                 *wakeup += interval;
  95         if (pause < 1000)
  96                 /* Near enough */
  97                 return;
  98 
  99         /* Now do the actual sleep */
 100         pause_left = pause;
 101         do {
 102                 pause_tv.tv_sec = pause_left / NANOSEC;
 103                 pause_tv.tv_nsec = pause_left % NANOSEC;
 104                 status = nanosleep(&pause_tv, (struct timespec *)NULL);
 105                 if (status < 0) {
 106                         if (errno == EINTR) {
 107                                 now = gethrtime();
 108                                 pause_left = *wakeup - now;
 109                                 if (pause_left < 1000)
 110                                         /* Near enough */
 111                                         return;
 112                         } else {
 113                                 fail(1, "nanosleep failed");
 114                         }
 115                 }
 116         } while (status != 0);
 117 }
 118 
 119 /*
 120  * Signal handler - so we can be aware of SIGCONT
 121  */
 122 void
 123 cont_handler(int sig_number)
 124 {
 125         /* Re-set the signal handler */
 126         (void) signal(sig_number, cont_handler);
 127         caught_cont = 1;
 128 }