/[monit]/monit/getloadavg.c
ViewVC logotype

Diff of /monit/getloadavg.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by chopp, Wed Aug 13 22:18:42 2003 UTC revision 1.2 by martinp, Wed Sep 17 18:00:52 2003 UTC
# Line 960  getloadavg (loadavg, nelem) Line 960  getloadavg (loadavg, nelem)
960    if (!getloadavg_initialized)    if (!getloadavg_initialized)
961      {      {
962  #  ifndef SUNOS_5  #  ifndef SUNOS_5
963    
964          pthread_mutex_lock(&Run.mutex_fd);
965    
966        channel = open ("/dev/kmem", 0);        channel = open ("/dev/kmem", 0);
967        if (channel >= 0)        if(channel >= 0) {
968          {          /* Set the channel to close on exec, so it does not
969            /* Set the channel to close on exec, so it does not           * litter any child's descriptor table.  */
970               litter any child's descriptor table.  */          (void)fcntl(channel, F_SETFD, fcntl(channel, F_GETFD) | FD_CLOEXEC);
971  #   ifdef FD_SETFD          getloadavg_initialized = 1;
972  #    ifndef FD_CLOEXEC        }
973  #     define FD_CLOEXEC 1  
974  #    endif        pthread_mutex_unlock(&Run.mutex_fd);
975            (void) fcntl (channel, F_SETFD, FD_CLOEXEC);  
 #   endif  
           getloadavg_initialized = 1;  
         }  
976  #  else /* SUNOS_5 */  #  else /* SUNOS_5 */
977        /* We pass 0 for the kernel, corefile, and swapfile names        /* We pass 0 for the kernel, corefile, and swapfile names
978           to use the currently running kernel.  */           to use the currently running kernel.  */

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26