Blame SOURCES/procps-ng-3.3.10-free-mem-petabytes-segfault.patch

6909f1
diff -up ./free.1.orig ./free.1
6909f1
--- ./free.1.orig	2018-01-16 16:11:35.609874589 +0100
6909f1
+++ ./free.1	2018-01-17 14:33:04.625716399 +0100
6909f1
@@ -62,6 +62,9 @@ Display the amount of memory in gigabyte
6909f1
 \fB\-\-tera\fR
6909f1
 Display the amount of memory in terabytes.
6909f1
 .TP
6909f1
+\fB\-\-peta\fR
6909f1
+Display the amount of memory in petabytes.
6909f1
+.TP
6909f1
 \fB\-h\fR, \fB\-\-human\fP
6909f1
 Show all output fields automatically scaled to shortest three digit unit and
6909f1
 display the units of print out.  Following units are used.
6909f1
@@ -72,9 +75,10 @@ display the units of print out.  Followi
6909f1
   M = megas
6909f1
   G = gigas
6909f1
   T = teras
6909f1
+  P = petas
6909f1
 .fi
6909f1
 .sp
6909f1
-If unit is missing, and you have petabyte of RAM or swap, the number is in
6909f1
+If unit is missing, and you have exabyte of RAM or swap, the number is in
6909f1
 terabytes and columns might not be aligned with header.
6909f1
 .TP
6909f1
 \fB\-w\fR, \fB\-\-wide\fR
6909f1
diff -up ./free.c.orig ./free.c
6909f1
--- ./free.c.orig	2018-01-16 16:10:27.058158964 +0100
6909f1
+++ ./free.c	2018-01-17 14:58:06.723658091 +0100
6909f1
@@ -78,6 +78,7 @@ static void __attribute__ ((__noreturn__
6909f1
 	fputs(_(" -m, --mega          show output in megabytes\n"), out);
6909f1
 	fputs(_(" -g, --giga          show output in gigabytes\n"), out);
6909f1
 	fputs(_("     --tera          show output in terabytes\n"), out);
6909f1
+	fputs(_("     --peta          show output in petabytes\n"), out);
6909f1
 	fputs(_(" -h, --human         show human-readable output\n"), out);
6909f1
 	fputs(_("     --si            use powers of 1000 not 1024\n"), out);
6909f1
 	fputs(_(" -l, --lohi          show detailed low and high memory statistics\n"), out);
6909f1
@@ -101,7 +102,7 @@ double power(unsigned int base, unsigned
6909f1
 /* idea of this function is copied from top size scaling */
6909f1
 static const char *scale_size(unsigned long size, int flags, struct commandline_arguments args)
6909f1
 {
6909f1
-	static char nextup[] = { 'B', 'K', 'M', 'G', 'T', 0 };
6909f1
+	static char nextup[] = { 'B', 'K', 'M', 'G', 'T', 'P', 0 };
6909f1
 	static char buf[BUFSIZ];
6909f1
 	int i;
6909f1
 	char *up;
6909f1
@@ -163,6 +164,7 @@ static const char *scale_size(unsigned l
6909f1
 		case 3:
6909f1
 		case 4:
6909f1
 		case 5:
6909f1
+		case 6:
6909f1
 			if (4 >=
6909f1
 			    snprintf(buf, sizeof(buf), "%.1f%c",
6909f1
 				     (float)(size / power(base, i - 2)), *up))
6909f1
@@ -172,14 +174,14 @@ static const char *scale_size(unsigned l
6909f1
 				     (long)(size / power(base, i - 2)), *up))
6909f1
 				return buf;
6909f1
 			break;
6909f1
-		case 6:
6909f1
+		case 7:
6909f1
 			break;
6909f1
 		}
6909f1
 	}
6909f1
 	/*
6909f1
-	 * On system where there is more than petabyte of memory or swap the
6909f1
+	 * On system where there is more than exbibyte of memory or swap the
6909f1
 	 * output does not fit to column. For incoming few years this should
6909f1
-	 * not be a big problem (wrote at Apr, 2011).
6909f1
+	 * not be a big problem (wrote at Apr, 2015).
6909f1
 	 */
6909f1
 	return buf;
6909f1
 }
6909f1
@@ -197,6 +199,7 @@ int main(int argc, char **argv)
6909f1
 	enum {
6909f1
 		SI_OPTION = CHAR_MAX + 1,
6909f1
 		TERA_OPTION,
6909f1
+		PETA_OPTION,
6909f1
 		HELP_OPTION
6909f1
 	};
6909f1
 
6909f1
@@ -206,6 +209,7 @@ int main(int argc, char **argv)
6909f1
 		{  "mega",	no_argument,	    NULL,  'm'		},
6909f1
 		{  "giga",	no_argument,	    NULL,  'g'		},
6909f1
 		{  "tera",	no_argument,	    NULL,  TERA_OPTION	},
6909f1
+		{  "peta",	no_argument,	    NULL,  PETA_OPTION	},
6909f1
 		{  "human",	no_argument,	    NULL,  'h'		},
6909f1
 		{  "si",	no_argument,	    NULL,  SI_OPTION	},
6909f1
 		{  "lohi",	no_argument,	    NULL,  'l'		},
6909f1
@@ -248,6 +252,9 @@ int main(int argc, char **argv)
6909f1
 		case TERA_OPTION:
6909f1
 			args.exponent = 5;
6909f1
 			break;
6909f1
+		case PETA_OPTION:
6909f1
+			args.exponent = 6;
6909f1
+			break;
6909f1
 		case 'h':
6909f1
 			flags |= FREE_HUMANREADABLE;
6909f1
 			break;