diff options
author | peter <peter@FreeBSD.org> | 1999-01-05 03:53:06 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-01-05 03:53:06 +0000 |
commit | 1c3fe295c360349e2c0808a8cd47b73b7efea47f (patch) | |
tree | 02ab72410e1093a6b29c725147252d1ac89815d6 /sys/miscfs/procfs/procfs_status.c | |
parent | 4a468ee66d9a1d18b3fd1d262dedbc71ec64015e (diff) | |
download | FreeBSD-src-1c3fe295c360349e2c0808a8cd47b73b7efea47f.zip FreeBSD-src-1c3fe295c360349e2c0808a8cd47b73b7efea47f.tar.gz |
A partial implementation of the procfs cmdline pseudo-file. This
is enough to satisfy things like StarOffice. This is a hack, but doing
it properly would be a LOT of work, and would require extensive grovelling
around in the user address space to find the argv[].
Obtained from: Mostly from Andrzej Bialecki <abial@nask.pl>.
Diffstat (limited to 'sys/miscfs/procfs/procfs_status.c')
-rw-r--r-- | sys/miscfs/procfs/procfs_status.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/sys/miscfs/procfs/procfs_status.c b/sys/miscfs/procfs/procfs_status.c index 3f1cccf..3176a64 100644 --- a/sys/miscfs/procfs/procfs_status.c +++ b/sys/miscfs/procfs/procfs_status.c @@ -37,7 +37,7 @@ * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 * * From: - * $Id: procfs_status.c,v 1.10 1997/08/02 14:32:17 bde Exp $ + * $Id: procfs_status.c,v 1.11 1998/07/11 07:45:45 bde Exp $ */ #include <sys/param.h> @@ -147,3 +147,40 @@ procfs_dostatus(curp, p, pfs, uio) return (error); } + +int +procfs_docmdline(curp, p, pfs, uio) + struct proc *curp; + struct proc *p; + struct pfsnode *pfs; + struct uio *uio; +{ + char *ps; + int xlen; + int error; + char psbuf[256]; + + if (uio->uio_rw != UIO_READ) + return (EOPNOTSUPP); + + /* + * For now, this is a hack. To implement this fully would require + * groping around in the process address space to follow argv etc. + */ + ps = psbuf; + bcopy(p->p_comm, ps, MAXCOMLEN); + ps[MAXCOMLEN] = '\0'; + ps += strlen(ps); + + ps += sprintf(ps, "\n"); + + xlen = ps - psbuf; + xlen -= uio->uio_offset; + ps = psbuf + uio->uio_offset; + xlen = min(xlen, uio->uio_resid); + if (xlen <= 0) + error = 0; + else + error = uiomove(ps, xlen, uio); + return (error); +} |