Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jul 1999 13:33:05 +0200
From:      Ollivier Robert <roberto@eurocontrol.fr>
To:        emulation@freebsd.org
Subject:   Star Office 5.1
Message-ID:  <19990723133305.A525@caerdonn.eurocontrol.fr>

next in thread | raw e-mail | index | archive | help
I confirm that you _need_ the procfs patch that was posted a while ago to
run SO 5.1.

Just in case, here it is:
-=-=-
cvs diff: Diffing .
Index: procfs_status.c
===================================================================
RCS file: /home/ncvs/src/sys/miscfs/procfs/procfs_status.c,v
retrieving revision 1.14
diff -u -2 -u -r1.14 procfs_status.c
--- procfs_status.c	1999/05/22 20:10:26	1.14
+++ procfs_status.c	1999/07/19 14:50:12
@@ -49,4 +49,8 @@
 #include <sys/resourcevar.h>
 #include <miscfs/procfs/procfs.h>
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#include <vm/vm_param.h>
+#include <sys/exec.h>
 
 int
@@ -165,13 +169,38 @@
 
 	/*
-	 * For now, this is a hack.  To implement this fully would require
-	 * groping around in the process address space to follow argv etc.
+       * This is a hack: the correct behaviour is only implemented for
+       * the case of the current process enquiring about its own argv
+       * (due to the difficulty of accessing other processes' address space).
+       * For other cases, we cop out and just return argv[0] from p->p_comm.
+       * Note that if the argv is no longer available, we deliberately
+       * don't fall back on p->p_comm or return an error: the authentic
+       * Linux behaviour is to return zero-length in this case.
 	 */
-	ps = psbuf;
-	bcopy(p->p_comm, ps, MAXCOMLEN);
-	ps[MAXCOMLEN] = '\0';
-	ps += strlen(ps);
-
-	ps += sprintf(ps, "\n");
+      if (curproc == p) {
+              struct ps_strings pstr;
+              int i;
+              size_t bytes_left, done;
+
+              error = copyin((void*)PS_STRINGS, &pstr, sizeof(pstr));
+              if (error) return (error);
+              bytes_left = sizeof(psbuf);
+              ps = psbuf;
+              for (i = 0; bytes_left && (i < pstr.ps_nargvstr); i++) {
+                      error = copyinstr(pstr.ps_argvstr[i], ps,
+                               bytes_left, &done);
+                      /* If too long or malformed, just truncate      */
+                      if (error) {
+                              error = 0;
+                              break;
+                      }
+                      ps += done;
+                      bytes_left -= done;
+              }
+      } else {
+              ps = psbuf;
+              bcopy(p->p_comm, ps, MAXCOMLEN);
+              ps[MAXCOMLEN] = '\0';
+              ps += strlen(ps);
+      }
 
 	xlen = ps - psbuf;
-=-=-
-- 
Ollivier ROBERT -=- Eurocontrol EEC/TEC -=- Ollivier.Robert@eurocontrol.fr
The Postman hits! The Postman hits! You have new mail.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message




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