crazy Debian GNU/kFreeBSD guy wanted this

This commit is contained in:
albert
2005-01-27 04:08:10 +00:00
parent 6e183316de
commit f9d99085e7
5 changed files with 16 additions and 12 deletions

View File

@@ -13,8 +13,8 @@
#define PROCPS_PS_H
#include "../proc/procps.h"
#include "../proc/escape.h"
#include "../proc/readproc.h"
#include <asm/page.h> /* looks safe for glibc, we need PAGE_SIZE */
#if 0
#define trace(args...) printf(## args)
@@ -60,15 +60,17 @@
* Try not to overflow the output buffer:
* 32 pages for env+cmd
* 64 kB pages on IA-64
* 4 chars for "\377"
* 4 chars for "\377", or 1 when mangling to '?' (ESC_STRETCH)
* plus some slack for other stuff
* That is about 8.5 MB on IA-64, or 0.6 MB on i386
*
* Sadly, current kernels only supply one page of env/command data.
* The buffer is now protected with a guard page, and via other means
* to avoid hitting the guard page.
*/
/* maximum escape expansion is 4, for \377 */
#define ESC_STRETCH 4
/* output buffer size */
#define OUTBUF_SIZE (32*PAGE_SIZE*ESC_STRETCH + 8*PAGE_SIZE)
#define OUTBUF_SIZE (2 * 64*1024 * ESC_STRETCH)
/******************* PS DEFINE *******************/

View File

@@ -479,10 +479,10 @@ void self_info(void){
fprintf(stderr,
"personality=0x%08x (from \"%s\")\n"
"EUID=%d TTY=%d,%d Hertz=%Ld PAGE_SIZE=%d page_size=%d\n",
"EUID=%d TTY=%d,%d Hertz=%Ld page_size=%d\n",
personality, saved_personality_text,
cached_euid, (int)major(cached_tty), (int)minor(cached_tty), Hertz,
(int)(PAGE_SIZE), (int)(page_size)
(int)(page_size)
);
fprintf(stderr,

View File

@@ -696,7 +696,7 @@ static int pr_tty4(char *restrict const outbuf, const proc_t *restrict const pp)
/* Unix98: format is unspecified, but must match that used by who(1). */
static int pr_tty8(char *restrict const outbuf, const proc_t *restrict const pp){
/* snprintf(outbuf, COLWID, "%02x:%02x", pp->tty>>8, pp->tty&0xff); */
return dev_to_tty(outbuf, PAGE_SIZE-1, pp->tty, pp->XXXID, ABBREV_DEV);
return dev_to_tty(outbuf, COLWID, pp->tty, pp->XXXID, ABBREV_DEV);
}
#if 0
@@ -804,7 +804,7 @@ static int pr_alarm(char *restrict const outbuf, const proc_t *restrict const pp
/* HP-UX puts this in pages and uses "vsz" for kB */
static int pr_sz(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%lu", (pp->vm_size)/(PAGE_SIZE/1024));
return snprintf(outbuf, COLWID, "%lu", (pp->vm_size)/(page_size/1024));
}