Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37860702
en ru br
ALT Linux repositórios
S:2.39.2-alt1
5.0: 2.14.1-alt1
4.1: 2.13-alt8
4.0: 2.12r-alt6
3.0: 2.12q-alt1

Group :: Sistema/Base
RPM: util-linux

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: util-linux-ng-2.13-ipcs-32bit.patch
Download


--- util-linux-2.14.1/sys-utils/ipcs.c.fix8	2009-01-25 19:34:51 +0300
+++ util-linux-2.14.1/sys-utils/ipcs.c	2009-01-25 19:37:54 +0300
@@ -242,8 +242,28 @@ print_perms (int id, struct ipc_perm *ip
 	else
 		printf(" %-10d\n", ipcp->gid);
 }
 
+static unsigned long long
+shminfo_from_proc(const char *name, unsigned long def)
+{
+	char path[256];
+	char buf[64];
+	FILE *f;
+	unsigned long long res = def;
+
+	if (!name)
+		return res;
+
+	snprintf(path, sizeof(path), "/proc/sys/kernel/%s", name);
+
+	if (!(f = fopen(path, "r")))
+		return res;
+	if (fgets(buf, sizeof(buf), f))
+		res = atoll(buf);
+	fclose(f);
+	return res;
+}
 
 void do_shm (char format)
 {
 	int maxid, shmid, id;
@@ -265,14 +285,14 @@ void do_shm (char format)
 		if ((shmctl (0, IPC_INFO, (struct shmid_ds *) (void *) &shminfo)) < 0 )
 			return;
 		/* glibc 2.1.3 and all earlier libc's have ints as fields
 		   of struct shminfo; glibc 2.1.91 has unsigned long; ach */
-		printf (_("max number of segments = %lu\n"),
-			(unsigned long) shminfo.shmmni);
-		printf (_("max seg size (kbytes) = %lu\n"),
-			(unsigned long) (shminfo.shmmax >> 10));
+ 		printf (_("max number of segments = %llu\n"),
+			shminfo_from_proc("shmmni", shminfo.shmmni));
+ 		printf (_("max seg size (kbytes) = %llu\n"),
+ 			(shminfo_from_proc("shmmax", shminfo.shmmax) >> 10));
 		printf (_("max total shared memory (kbytes) = %llu\n"),
-			getpagesize() / 1024 * (unsigned long long) shminfo.shmall);
+ 			sysconf(_SC_PAGESIZE) / 1024 * shminfo_from_proc("shmall", shminfo.shmall));
 		printf (_("min seg size (bytes) = %lu\n"),
 			(unsigned long) shminfo.shmmin);
 		return;
 
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009