Deleted Added
full compact
memstat.c (157001) memstat.c (168515)
1/*
1/*
2 * Copyright (c) 2005 Sendmail, Inc. and its suppliers.
2 * Copyright (c) 2005-2007 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 */
9
10#include <sm/gen.h>
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 */
9
10#include <sm/gen.h>
11SM_RCSID("@(#)$Id: memstat.c,v 1.4 2005/12/10 00:38:48 ca Exp $")
11SM_RCSID("@(#)$Id: memstat.c,v 1.6 2007/03/20 23:26:12 ca Exp $")
12
13#include <errno.h>
12
13#include <errno.h>
14#include <sm/misc.h>
14
15#if USESWAPCTL
16#include <sys/stat.h>
17#include <sys/swap.h>
18
19static long sc_page_size;
20
21/*

--- 238 unchanged lines hidden (view full) ---

260 if (resource == NULL)
261 return EINVAL;
262 if (pvalue == NULL)
263 return EINVAL;
264 if (fp == NULL)
265 return -1; /* try to reopen? */
266 rewind(fp);
267 l = strlen(resource);
15
16#if USESWAPCTL
17#include <sys/stat.h>
18#include <sys/swap.h>
19
20static long sc_page_size;
21
22/*

--- 238 unchanged lines hidden (view full) ---

261 if (resource == NULL)
262 return EINVAL;
263 if (pvalue == NULL)
264 return EINVAL;
265 if (fp == NULL)
266 return -1; /* try to reopen? */
267 rewind(fp);
268 l = strlen(resource);
269 if (l >= sizeof(buf))
270 return EINVAL;
268 while (fgets(buf, sizeof(buf), fp) != NULL)
269 {
270 if (strncmp(buf, resource, l) == 0 && buf[l] == ':')
271 {
272 r = sscanf(buf + l + 1, "%ld", pvalue);
273 return (r > 0) ? 0 : -1;
274 }
275 }

--- 58 unchanged lines hidden ---
271 while (fgets(buf, sizeof(buf), fp) != NULL)
272 {
273 if (strncmp(buf, resource, l) == 0 && buf[l] == ':')
274 {
275 r = sscanf(buf + l + 1, "%ld", pvalue);
276 return (r > 0) ? 0 : -1;
277 }
278 }

--- 58 unchanged lines hidden ---