document #C to P change

This commit is contained in:
albert 2005-01-06 00:49:09 +00:00
parent 39b6574fb3
commit 33721d7e57
2 changed files with 8 additions and 2 deletions

2
top.1
View File

@ -357,7 +357,7 @@ Zero in this field simply means priority will not be adjusted in determining a
task's dispatchability. task's dispatchability.
.TP 3 .TP 3
j:\fB #C\fR \*(EM Last used \*(PU (SMP) j:\fB P\fR \*(EM Last used \*(PU (SMP)
A number representing the last used processor. A number representing the last used processor.
In a true SMP environment this will likely change frequently since the kernel In a true SMP environment this will likely change frequently since the kernel
intentionally uses weak affinity. intentionally uses weak affinity.

8
top.c
View File

@ -3269,6 +3269,7 @@ int main (int dont_care_argc, char *argv[])
select(0, NULL, NULL, NULL, &tv); // ought to loop until done select(0, NULL, NULL, NULL, &tv); // ought to loop until done
} else { } else {
long file_flags; long file_flags;
int rc;
char c; char c;
fd_set fs; fd_set fs;
FD_ZERO(&fs); FD_ZERO(&fs);
@ -3276,8 +3277,13 @@ int main (int dont_care_argc, char *argv[])
file_flags = fcntl(STDIN_FILENO, F_GETFL); file_flags = fcntl(STDIN_FILENO, F_GETFL);
if(file_flags==-1) file_flags=0; if(file_flags==-1) file_flags=0;
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags); fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags);
// check 1st, in case tv zeroed (by sig handler) before it got set // check 1st, in case tv zeroed (by sig handler) before it got set
if (chin(0, &c, 1) <= 0) { rc = chin(0, &c, 1);
if (rc <= 0) {
// EOF is pretty much a "can't happen" except for a kernel bug.
// We should quickly die via SIGHUP, and thus not spin here.
// if (rc == 0) end_pgm(0); /* EOF from terminal */
fcntl(STDIN_FILENO, F_SETFL, file_flags); fcntl(STDIN_FILENO, F_SETFL, file_flags);
select(1, &fs, NULL, NULL, &tv); select(1, &fs, NULL, NULL, &tv);
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags); fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags);