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

Diff of /monit/getloadavg.c

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

revision 1.2 by martinp, Wed Sep 17 18:00:52 2003 UTC revision 1.3 by martinp, Wed Sep 17 18:40:21 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
   
       pthread_mutex_lock(&Run.mutex_fd);  
   
963        channel = open ("/dev/kmem", 0);        channel = open ("/dev/kmem", 0);
964        if(channel >= 0) {        if(channel >= 0) {
965          /* Set the channel to close on exec, so it does not          /* Set the channel to close on exec, so it does not
966           * litter any child's descriptor table.  */           * litter any child's descriptor table.  */
967          (void)fcntl(channel, F_SETFD, fcntl(channel, F_GETFD) | FD_CLOEXEC);  #   ifdef FD_SETFD
968          getloadavg_initialized = 1;  #    ifndef FD_CLOEXEC
969    #     define FD_CLOEXEC 1
970    #    endif
971            (void) fcntl (channel, F_SETFD, FD_CLOEXEC);
972    #   endif
973            getloadavg_initialized = 1;
974        }        }
   
       pthread_mutex_unlock(&Run.mutex_fd);  
   
975  #  else /* SUNOS_5 */  #  else /* SUNOS_5 */
976        /* We pass 0 for the kernel, corefile, and swapfile names        /* We pass 0 for the kernel, corefile, and swapfile names
977           to use the currently running kernel.  */           to use the currently running kernel.  */

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

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