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. */ |