View
@@ -4,12 +4,12 @@
* Copyright (c) 2012-2015 Red Hat.
* Copyright (c) 2009 Aconex. All Rights Reserved.
* Copyright (c) 1995-2002,2004 Silicon Graphics, Inc. All Rights Reserved.
- *
+ *
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
@@ -27,7 +27,7 @@
*/
#include <stdarg.h>
-#include <sys/stat.h>
+#include <sys/stat.h>
#include <inttypes.h>
#include <limits.h>
#include <ctype.h>
@@ -41,7 +41,7 @@
#include <sys/times.h>
#endif
#if defined(HAVE_SYS_MMAN_H)
-#include <sys/mman.h>
+#include <sys/mman.h>
#endif
#if defined(HAVE_IEEEFP_H)
#include <ieeefp.h>
@@ -506,7 +506,7 @@ __pmStringListAdd(char *item, int numElements, char ***list)
}
/*
- * Now allocate a new buffer for the expanded list.
+ * Now allocate a new buffer for the expanded list.
* We need room for a new pointer and for the new item.
*/
newSize = ptrSize + sizeof(**list) + dataSize + strlen(item) + 1;
@@ -639,9 +639,9 @@ dump_valueset(FILE *f, pmValueSet *vsp)
pmPrintValue(f, vsp->valfmt, desc.type, vp, 1);
else {
if (vsp->valfmt == PM_VAL_INSITU)
- pmPrintValue(f, vsp->valfmt, PM_TYPE_UNKNOWN, vp, 1);
+ pmPrintValue(f, vsp->valfmt, PM_TYPE_UNKNOWN, vp, 1);
else
- pmPrintValue(f, vsp->valfmt, (int)vp->value.pval->vtype, vp, 1);
+ pmPrintValue(f, vsp->valfmt, (int)vp->value.pval->vtype, vp, 1);
}
fputc('\n', f);
}
@@ -1452,7 +1452,7 @@ pmflush(void)
while ((len = (int)read(fileno(fptr), outbuf, MSGBUFLEN)) > 0) {
sts = write(fileno(stderr), outbuf, len);
if (sts != len) {
- fprintf(stderr, "pmflush: write() failed: %s\n",
+ fprintf(stderr, "pmflush: write() failed: %s\n",
osstrerror_r(errmsg, sizeof(errmsg)));
}
sts = 0;
@@ -1480,7 +1480,7 @@ pmflush(void)
while ((len = (int)read(fileno(fptr), outbuf, MSGBUFLEN)) > 0) {
sts = write(fileno(eptr), outbuf, len);
if (sts != len) {
- fprintf(stderr, "pmflush: write() failed: %s\n",
+ fprintf(stderr, "pmflush: write() failed: %s\n",
osstrerror_r(errmsg, sizeof(errmsg)));
}
sts = 0;
@@ -1550,7 +1550,7 @@ __pmSetClientId(const char *id)
/* Did we get a name? */
if (servInfoName == NULL) {
char errmsg[PM_MAXERRMSGLEN];
- fprintf(stderr, "__pmSetClientId: __pmGetNameInfo() failed: %s\n",
+ fprintf(stderr, "__pmSetClientId: __pmGetNameInfo() failed: %s\n",
osstrerror_r(errmsg, sizeof(errmsg)));
}
else {
@@ -1566,7 +1566,7 @@ __pmSetClientId(const char *id)
__pmSockAddrFree(addr);
if (ipaddr == NULL) {
char errmsg[PM_MAXERRMSGLEN];
- fprintf(stderr, "__pmSetClientId: __pmSockAddrToString() failed: %s\n",
+ fprintf(stderr, "__pmSetClientId: __pmSockAddrToString() failed: %s\n",
osstrerror_r(errmsg, sizeof(errmsg)));
}
else
@@ -1788,7 +1788,7 @@ scandir(const char *dirname, struct dirent ***namelist,
return n;
}
-/*
+/*
* Alphabetical sort for default use
*/
int
@@ -1808,7 +1808,7 @@ alphasort(const_dirent **p, const_dirent **q)
* Copyright (C) 2003 by Sun Microsystems, Inc. All rights reserved.
*
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -1842,7 +1842,7 @@ bozo!
* 1. Compute and return log2(x) in two pieces:
* log2(x) = w1 + w2,
* where w1 has 53-24 = 29 bit trailing zeros.
- * 2. Perform y*log2(x) = n+y' by simulating muti-precision
+ * 2. Perform y*log2(x) = n+y' by simulating muti-precision
* arithmetic, where |y'|<=0.5.
* 3. Return x**y = 2**n*exp(y'*log2)
*
@@ -1870,17 +1870,17 @@ bozo!
* Accuracy:
* pow(x,y) returns x**y nearly rounded. In particular
* pow(integer,integer)
- * always returns the correct integer provided it is
+ * always returns the correct integer provided it is
* representable.
*
* Constants :
- * The hexadecimal values are the intended ones for the following
- * constants. The decimal values may be used, provided that the
- * compiler will convert from decimal to binary accurately enough
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
-static const double
+static const double
bp[] = {1.0, 1.5,},
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
@@ -1927,20 +1927,20 @@ pow(double x, double y)
ix = hx&0x7fffffff; iy = hy&0x7fffffff;
/* y==zero: x**0 = 1 */
- if((iy|ly)==0) return one;
+ if((iy|ly)==0) return one;
/* +-NaN return x+y */
if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
- iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
- return x+y;
+ iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
+ return x+y;
/* determine if y is an odd int when x < 0
* yisint = 0 ... y is not an integer
* yisint = 1 ... y is an odd int
* yisint = 2 ... y is an even int
*/
yisint = 0;
- if(hx<0) {
+ if(hx<0) {
if(iy>=0x43400000) yisint = 2; /* even integer y */
else if(iy>=0x3ff00000) {
k = (iy>>20)-0x3ff; /* exponent */
@@ -1951,26 +1951,26 @@ pow(double x, double y)
j = iy>>(20-k);
if((j<<(20-k))==iy) yisint = 2-(j&1);
}
- }
- }
+ }
+ }
/* special value of y */
- if(ly==0) {
+ if(ly==0) {
if (iy==0x7ff00000) { /* y is +-inf */
if(((ix-0x3ff00000)|lx)==0)
return y - y; /* inf**+-1 is NaN */
else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */
return (hy>=0)? y: zero;
else /* (|x|<1)**-,+inf = inf,0 */
return (hy<0)?-y: zero;
- }
+ }
if(iy==0x3ff00000) { /* y is +-1 */
if(hy<0) return one/x; else return x;
}
if(hy==0x40000000) return x*x; /* y is 2 */
if(hy==0x3fe00000) { /* y is 0.5 */
if(hx>=0) /* x >= +0 */
- return sqrt(x);
+ return sqrt(x);
}
}
@@ -1983,13 +1983,13 @@ pow(double x, double y)
if(hx<0) {
if(((ix-0x3ff00000)|yisint)==0) {
z = (z-z)/(z-z); /* (-1)**non-int is NaN */
- } else if(yisint==1)
+ } else if(yisint==1)
z = -z; /* (x<0)**odd = -(|x|**odd) */
}
return z;
}
}
-
+
n = (hx>>31)+1;
/* (x<0)**(non-int) is NaN */
@@ -2007,7 +2007,7 @@ pow(double x, double y)
/* over/underflow if x is not close to one */
if(ix<0x3fefffff) return (hy<0)? s*huge*huge:s*tiny*tiny;
if(ix>0x3ff00000) return (hy>0)? s*huge*huge:s*tiny*tiny;
- /* now |1-x| is tiny <= 2**-20, suffice to compute
+ /* now |1-x| is tiny <= 2**-20, suffice to compute
log(x) by x-x^2/2+x^3/3-x^4/4 */
t = ax-one; /* t has 20 trailing zeros */
w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
@@ -2039,7 +2039,7 @@ pow(double x, double y)
__LO(s_h) = 0;
/* t_h=ax+bp[k] High */
t_h = zero;
- __HI(t_h)=((ix>>1)|0x20000000)+0x00080000+(k<<18);
+ __HI(t_h)=((ix>>1)|0x20000000)+0x00080000+(k<<18);
t_l = ax - (t_h-bp[k]);
s_l = v*((u-s_h*t_h)-s_h*t_l);
/* compute log(ax) */
@@ -2101,7 +2101,7 @@ pow(double x, double y)
n = ((n&0x000fffff)|0x00100000)>>(20-k);
if(j<0) n = -n;
p_h -= t;
- }
+ }
t = p_l+p_h;
__LO(t) = 0;
u = t*lg2_h;
@@ -2138,8 +2138,8 @@ __pmProcessExists(pid_t pid)
return 0;
return (len > 0);
}
-#elif defined(IS_FREEBSD)
-int
+#elif defined(IS_FREEBSD) || defined(IS_OPENBSD)
+int
__pmProcessExists(pid_t pid)
{
/*
@@ -2153,7 +2153,7 @@ __pmProcessExists(pid_t pid)
#elif defined(HAVE_PROCFS)
#define PROCFS "/proc"
#define PROCFS_PATH_SIZE (sizeof(PROCFS)+PROCFS_ENTRY_SIZE)
-int
+int
__pmProcessExists(pid_t pid)
{
char proc_buf[PROCFS_PATH_SIZE];