Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Feb 2015 21:52:42 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r278822 - user/dchagin/lemul/sys/compat/linprocfs
Message-ID:  <201502152152.t1FLqgXS079810@svn.freebsd.org>

index | next in thread | raw e-mail

Author: dchagin
Date: Sun Feb 15 21:52:41 2015
New Revision: 278822
URL: https://svnweb.freebsd.org/changeset/base/278822

Log:
  Add aupport for /proc/<pid>/auxv.

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 Feb 15 21:50:08 2015	(r278821)
+++ user/dchagin/lemul/sys/compat/linprocfs/linprocfs.c	Sun Feb 15 21:52:41 2015	(r278822)
@@ -1397,6 +1397,38 @@ linprocfs_douuid(PFS_FILL_ARGS)
 	return(0);
 }
 
+/*
+ * Filler function for proc/pid/auxv
+ */
+static int
+linprocfs_doauxv(PFS_FILL_ARGS)
+{
+	int ret;
+
+	PROC_LOCK(p);
+	if ((ret = p_candebug(td, p)) != 0) {
+		PROC_UNLOCK(p);
+		return (ret);
+	}
+
+	/*
+	 * Mimic linux behavior and pass only processes with usermode
+	 * address space as valid.  Return zero silently otherwize.
+	 */
+	if (p->p_vmspace == &vmspace0) {
+		PROC_UNLOCK(p);
+		return (0);
+	}
+
+	if ((p->p_flag & P_SYSTEM) != 0) {
+		PROC_UNLOCK(p);
+		return (0);
+	}
+
+	PROC_UNLOCK(p);
+
+	return (proc_getauxv(td, p, sb));
+}
 
 /*
  * Constructor
@@ -1472,6 +1504,8 @@ linprocfs_init(PFS_INIT_ARGS)
 	    NULL, NULL, NULL, PFS_RD);
 	pfs_create_link(dir, "fd", &linprocfs_dofdescfs,
 	    NULL, NULL, NULL, 0);
+	pfs_create_file(dir, "auxv", &linprocfs_doauxv,
+	    NULL, NULL, NULL, PFS_RD);
 
 	/* /proc/scsi/... */
 	dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0);


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502152152.t1FLqgXS079810>