"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xinetd/xgetloadavg.c" between
xinetd-2.3.15.tar.gz and xinetd-2.3.15.4.tar.xz

About: xinetd is a secure replacement for inetd, the internet services daemon (openSUSE fork).

xgetloadavg.c  (xinetd-2.3.15):xgetloadavg.c  (xinetd-2.3.15.4.tar.xz)
skipping to change at line 37 skipping to change at line 37
FILE *fd; FILE *fd;
double ret = 0; double ret = 0;
fd = fopen(LFILE, "r"); fd = fopen(LFILE, "r");
if( fd == NULL ) { if( fd == NULL ) {
return -1; return -1;
} }
if( fscanf(fd, "%lf", &ret) != 1 ) { if( fscanf(fd, "%lf", &ret) != 1 ) {
perror("fscanf"); perror("fscanf");
return -1; ret = -1;
} }
fclose(fd); fclose(fd);
return ret; return ret;
} }
#endif /* linux */ #endif /* linux */
#ifdef solaris #ifdef solaris
#ifdef HAVE_KSTAT_H #ifdef HAVE_KSTAT_H
skipping to change at line 88 skipping to change at line 88
return -1; return -1;
} }
return (double)(kn->value.ui32)/100; return (double)(kn->value.ui32)/100;
} }
kstat_close(kc); kstat_close(kc);
} }
#endif /* HAVE_KSTAT */ #endif /* HAVE_KSTAT */
#endif /* solaris */ #endif /* solaris */
#ifdef __FreeBSD__
#include <stdio.h>
#include <sys/param.h>
#include <sys/fcntl.h>
double xgetloadavg ()
{
double ret[3];
getloadavg (ret, sizeof (ret) / sizeof (ret[0]));
return ret[0];
}
#endif /* __FreeBSD__ */
#if defined(bsdi) || defined(__APPLE__) #if defined(bsdi) || defined(__APPLE__)
#include <stdlib.h> #include <stdlib.h>
double xgetloadavg(void) double xgetloadavg(void)
{ {
double loadavg[3]; double loadavg[3];
if (getloadavg(loadavg, 1) == -1) if (getloadavg(loadavg, 1) == -1)
{ {
 End of changes. 2 change blocks. 
16 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)