svn commit: r250279 - user/dchagin/lemul/sys/compat/linprocfs

Dmitry Chagin dchagin at FreeBSD.org
Sun May 5 17:25:40 UTC 2013


Author: dchagin
Date: Sun May  5 17:25:39 2013
New Revision: 250279
URL: http://svnweb.freebsd.org/changeset/base/250279

Log:
  Get ready to commit x86_64 Linux emulation.
  Print out proper procmap entry for 64 bit binaries.

Modified:
  user/dchagin/lemul/sys/compat/linprocfs/linprocfs.c

Modified: user/dchagin/lemul/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linprocfs/linprocfs.c	Sun May  5 16:44:03 2013	(r250278)
+++ user/dchagin/lemul/sys/compat/linprocfs/linprocfs.c	Sun May  5 17:25:39 2013	(r250279)
@@ -984,6 +984,9 @@ linprocfs_doprocenviron(PFS_FILL_ARGS)
 	return (ret);
 }
 
+static char l32_map_str[] = "%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n";
+static char l64_map_str[] = "%016lx-%016lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n";
+
 /*
  * Filler function for proc/pid/maps
  */
@@ -999,6 +1002,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 	vm_prot_t e_prot;
 	unsigned int last_timestamp;
 	char *name = "", *freename = NULL;
+	const char *l_map_str;
 	ino_t ino;
 	int ref_count, shadow_count, flags;
 	int error;
@@ -1071,8 +1075,11 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 		 * format:
 		 *  start, end, access, offset, major, minor, inode, name.
 		 */
-		error = sbuf_printf(sb,
-		    "%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n",
+		if (SV_CURPROC_FLAG(SV_LP64))
+			l_map_str = l64_map_str;
+		else
+			l_map_str = l32_map_str;
+		error = sbuf_printf(sb, l_map_str,
 		    (u_long)e_start, (u_long)e_end,
 		    (e_prot & VM_PROT_READ)?"r":"-",
 		    (e_prot & VM_PROT_WRITE)?"w":"-",


More information about the svn-src-user mailing list