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

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