From 34c4da73d1c06c2b4bc3e2903e46b16b0b0a5986 Mon Sep 17 00:00:00 2001 From: albert <> Date: Thu, 15 Jul 2004 05:29:56 +0000 Subject: [PATCH] tolerate IA-64 headers w/o PAGE_SIZE --- NEWS | 1 + proc/devname.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 56a0e2f7..068a4b34 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ procps-3.2.1 --> procps-3.2.2 move striping from install command to CFLAGS now using gcc -fweb and -frename-registers options avoid warning about -lncurses when not linking -- thanks FLWM +tolerate IA-64 headers without PAGE_SIZE watch: allow sub-second intervals -- thanks Thomas Stewart sysctl: -q option sysctl: better error handling of failed writes diff --git a/proc/devname.c b/proc/devname.c index e5defd46..13412fc4 100644 --- a/proc/devname.c +++ b/proc/devname.c @@ -19,10 +19,10 @@ #include "version.h" #include "devname.h" -#include -#ifndef PAGE_SIZE -#define PAGE_SIZE (sizeof(long)*1024) -#endif +// This is the buffer size for a tty name. Any path is legal, +// which makes PAGE_SIZE appropriate (see kernel source), but +// that is only 99% portable and utmp only holds 32 anyway. +#define NAME_SIZE 128 /* Who uses what: * @@ -216,7 +216,7 @@ static int link_name(char *restrict const buf, unsigned maj, unsigned min, int p char path[32]; int count; sprintf(path, "/proc/%d/%s", pid, name); /* often permission denied */ - count = readlink(path,buf,PAGE_SIZE-1); + count = readlink(path,buf,NAME_SIZE-1); if(count == -1) return 0; buf[count] = '\0'; if(stat(buf, &sbuf) < 0) return 0; @@ -227,7 +227,7 @@ static int link_name(char *restrict const buf, unsigned maj, unsigned min, int p /* number --> name */ unsigned dev_to_tty(char *restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags) { - static char buf[PAGE_SIZE]; + static char buf[NAME_SIZE]; char *restrict tmp = buf; unsigned dev = dev_t_dev; unsigned i = 0;