tolerate IA-64 headers w/o PAGE_SIZE

This commit is contained in:
albert 2004-07-15 05:29:56 +00:00
parent aae2db6f9b
commit 34c4da73d1
2 changed files with 7 additions and 6 deletions

1
NEWS
View File

@ -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

View File

@ -19,10 +19,10 @@
#include "version.h"
#include "devname.h"
#include <asm/page.h>
#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;