From: Benjamin Kaduk Date: Fri, 10 Jan 2014 04:34:30 +0000 (-0500) Subject: Remove some explicit sbrk() usage X-Git-Tag: openafs-stable-1_8_0pre1~828 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=e03b026c4d74912152be71885f09ef50ff8c32db 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 --- diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index f178a96..bfaac8d 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 5376074..b2f3f04 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));