[asterisk-commits] tilghman: branch 1.6.2 r265318 - in /branches/1.6.2: ./ main/asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 24 13:30:02 CDT 2010


Author: tilghman
Date: Mon May 24 13:30:00 2010
New Revision: 265318

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=265318
Log:
Merged revisions 265316 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r265316 | tilghman | 2010-05-24 13:19:08 -0500 (Mon, 24 May 2010) | 7 lines
  
  On systems with a LOT of RAM, a signed integer sometimes printed negative.
  
  (closes issue #16837)
   Reported by: jlpedrosa
   Patches: 
         20100504__issue16837.diff.txt uploaded by tilghman (license 14)
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/main/asterisk.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/asterisk.c?view=diff&rev=265318&r1=265317&r2=265318
==============================================================================
--- branches/1.6.2/main/asterisk.c (original)
+++ branches/1.6.2/main/asterisk.c Mon May 24 13:30:00 2010
@@ -560,13 +560,14 @@
 /*! \brief Give an overview of system statistics */
 static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	int64_t physmem, freeram;
-	int totalswap = 0, freeswap = 0, nprocs = 0;
+	uint64_t physmem, freeram;
+	uint64_t totalswap = 0, freeswap = 0;
+	int nprocs = 0;
 	long uptime = 0;
 #if defined(HAVE_SYSINFO)
 	struct sysinfo sys_info;
 	sysinfo(&sys_info);
-	uptime = sys_info.uptime/3600;
+	uptime = sys_info.uptime / 3600;
 	physmem = sys_info.totalram * sys_info.mem_unit;
 	freeram = (sys_info.freeram * sys_info.mem_unit) / 1024;
 	totalswap = (sys_info.totalswap * sys_info.mem_unit) / 1024;
@@ -615,7 +616,7 @@
 	sysctl(mib, 2, &vmtotal, &len, NULL, 0);
 	freeram = (vmtotal.t_free << pageshift);
 	/* generate swap usage and totals */
-	swapmode(&usedswap, &totalswap); 
+	swapmode(&usedswap, &totalswap);
 	freeswap = (totalswap - usedswap);
 	/* grab number of processes */
 #if defined(__OpenBSD__)
@@ -639,14 +640,14 @@
 
 	ast_cli(a->fd, "\nSystem Statistics\n");
 	ast_cli(a->fd, "-----------------\n");
-	ast_cli(a->fd, "  System Uptime:             %ld hours\n", uptime);
-	ast_cli(a->fd, "  Total RAM:                 %ld KiB\n", (long)physmem/1024);
-	ast_cli(a->fd, "  Free RAM:                  %ld KiB\n", (long)freeram);
+	ast_cli(a->fd, "  System Uptime:             %lu hours\n", uptime);
+	ast_cli(a->fd, "  Total RAM:                 %" PRIu64 " KiB\n", physmem / 1024);
+	ast_cli(a->fd, "  Free RAM:                  %" PRIu64 " KiB\n", freeram);
 #if defined(HAVE_SYSINFO)
-	ast_cli(a->fd, "  Buffer RAM:                %ld KiB\n", (sys_info.bufferram * sys_info.mem_unit)/1024);
+	ast_cli(a->fd, "  Buffer RAM:                %" PRIu64 " KiB\n", ((uint64_t) sys_info.bufferram * sys_info.mem_unit) / 1024);
 #endif
-	ast_cli(a->fd, "  Total Swap Space:          %ld KiB\n", (long)totalswap);
-	ast_cli(a->fd, "  Free Swap Space:           %ld KiB\n\n", (long)freeswap);
+	ast_cli(a->fd, "  Total Swap Space:          %" PRIu64 " KiB\n", totalswap);
+	ast_cli(a->fd, "  Free Swap Space:           %" PRIu64 " KiB\n\n", freeswap);
 	ast_cli(a->fd, "  Number of Processes:       %d \n\n", nprocs);
 	return CLI_SUCCESS;
 }




More information about the asterisk-commits mailing list