From e03b026c4d74912152be71885f09ef50ff8c32db Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Thu, 9 Jan 2014 23:34:30 -0500 Subject: [PATCH] Remove some explicit sbrk() usage Mac OS X 10.9 now considers this function deprecated and warns on its use, causing the buildslave configuration to error out. Use the library routine to get a process's size instead of inlining the call to sbrk (which is unlikely to have worked as intended for quite some time -- most malloc implementations in use do not use sbrk to get their storage). Change-Id: If616e1ebbea7c0aa541fb96c486820e883363df1 Reviewed-on: http://gerrit.openafs.org/10696 Reviewed-by: Derrick Brashear Tested-by: BuildBot --- src/viced/afsfileprocs.c | 14 +++----------- src/viced/viced.c | 7 ++----- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index f178a9620..bfaac8ddc 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -76,6 +76,7 @@ #include #include #include +#include #include #include #include @@ -5039,11 +5040,7 @@ SetAFSStats(struct AFSStatistics *stats) if (seconds <= 0) seconds = 1; stats->StoreDataRate = AFSCallStats.TotalStoredBytes / seconds; -#ifdef AFS_NT40_ENV - stats->ProcessSize = -1; /* TODO: */ -#else - stats->ProcessSize = (afs_int32) ((long)sbrk(0) >> 10); -#endif + stats->ProcessSize = opr_procsize(); FS_UNLOCK; h_GetWorkStats((int *)&(stats->WorkStations), (int *)&(stats->ActiveWorkStations), (int *)0, @@ -5160,12 +5157,7 @@ SRXAFS_GetStatistics64(struct rx_call *acall, afs_int32 statsVersion, ViceStatis seconds = 1; Statistics->ViceStatistics64_val[STATS64_STOREDATARATE] = AFSCallStats.TotalStoredBytes / seconds; -#ifdef AFS_NT40_ENV - Statistics->ViceStatistics64_val[STATS64_PROCESSSIZE] = -1; -#else - Statistics->ViceStatistics64_val[STATS64_PROCESSSIZE] = - (afs_int32) ((long)sbrk(0) >> 10); -#endif + Statistics->ViceStatistics64_val[STATS64_PROCESSSIZE] = opr_procsize(); FS_UNLOCK; h_GetWorkStats64(&(Statistics->ViceStatistics64_val[STATS64_WORKSTATIONS]), &(Statistics->ViceStatistics64_val[STATS64_ACTIVEWORKSTATIONS]), diff --git a/src/viced/viced.c b/src/viced/viced.c index 537607402..b2f3f049b 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -670,11 +671,7 @@ PrintCounters(void) audit_PrintStats(stderr); h_PrintStats(); PrintCallBackStats(); -#ifdef AFS_NT40_ENV - processSize = -1; /* TODO: */ -#else - processSize = (int)((long)sbrk(0) >> 10); -#endif + processSize = opr_procsize(); ViceLog(0, ("There are %d connections, process size %d\n", CurrentConnections, processSize)); -- 2.39.5