FreeBSD Bugzilla – Attachment 9554 Details for
Bug 19535
procfs_rlimit tidyup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.79 KB, created by
Adrian Chadd
on 2000-06-26 22:20:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Adrian Chadd
Created:
2000-06-26 22:20:01 UTC
Size:
1.79 KB
patch
obsolete
>Index: procfs_rlimit.c >=================================================================== >RCS file: /home/ncvs/src/sys/miscfs/procfs/procfs_rlimit.c,v >retrieving revision 1.5 >diff -u -r1.5 procfs_rlimit.c >--- procfs_rlimit.c 1999/12/08 08:59:37 1.5 >+++ procfs_rlimit.c 2000/06/26 21:10:33 >@@ -52,6 +52,7 @@ > #include <sys/resourcevar.h> > #include <sys/resource.h> > #include <sys/types.h> >+#include <sys/malloc.h> > #include <miscfs/procfs/procfs.h> > > >@@ -66,41 +67,25 @@ > int i; > int xlen; > int error; >- char psbuf[512]; /* XXX - conservative */ >+ char *psbuf; > > if (uio->uio_rw != UIO_READ) > return (EOPNOTSUPP); >- >- >+ psbuf = (char *)malloc(512 * sizeof(char), M_TEMP, M_WAITOK); >+ /* XXX conservative, but potentially overflowable */ > ps = psbuf; >- > for (i = 0; i < RLIM_NLIMITS; i++) { >- >- /* >- * Add the rlimit ident >- */ >- >+ /* Add the rlimit ident */ > ps += sprintf(ps, "%s ", rlimit_ident[i]); >- >- /* >- * Replace RLIM_INFINITY with -1 in the string >- */ >- >- /* >- * current limit >- */ >- >+ /* Replace RLIM_INFINITY with -1 in the string */ >+ /* current limit */ > if (p->p_rlimit[i].rlim_cur == RLIM_INFINITY) { > ps += sprintf(ps, "-1 "); > } else { > ps += sprintf(ps, "%llu ", > (unsigned long long)p->p_rlimit[i].rlim_cur); > } >- >- /* >- * maximum limit >- */ >- >+ /* maximum limit */ > if (p->p_rlimit[i].rlim_max == RLIM_INFINITY) { > ps += sprintf(ps, "-1\n"); > } else { >@@ -108,12 +93,10 @@ > (unsigned long long)p->p_rlimit[i].rlim_max); > } > } >- > /* > * This logic is rather tasty - but its from procfs_status.c, so > * I guess I'll use it here. > */ >- > xlen = ps - psbuf; > xlen -= uio->uio_offset; > ps = psbuf + uio->uio_offset; >@@ -122,7 +105,7 @@ > error = 0; > else > error = uiomove(ps, xlen, uio); >- >+ free(psbuf, M_TEMP); > return (error); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 19535
: 9554