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

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