top(1): set max username length based on system constant
This changes previous behavior of calculating it at startup based on the current max username length. This is done because: - it is in theory possible for the max length to change at run-time (e.g., a new user is added after top starts running) - on machines with many users this delays startup significantly PR: 20799 PR: 89762 Reported by: ob@e-Gitt.NET Reported by: wkwu@Kavalan.csie.NCTU.edu.tw Reported on: 2000-08-23 and 2005-11-30
This commit is contained in:
parent
a665699823
commit
4b9ca404c5
@ -314,7 +314,7 @@ update_layout(void)
|
||||
}
|
||||
|
||||
int
|
||||
machine_init(struct statics *statics, char do_unames)
|
||||
machine_init(struct statics *statics)
|
||||
{
|
||||
int i, j, empty, pagesize;
|
||||
uint64_t arc_size;
|
||||
@ -340,12 +340,7 @@ machine_init(struct statics *statics, char do_unames)
|
||||
NULL, 0) == 0 && carc_en == 1)
|
||||
carc_enabled = 1;
|
||||
|
||||
if (do_unames) {
|
||||
while ((pw = getpwent()) != NULL) {
|
||||
if (strlen(pw->pw_name) > namelength)
|
||||
namelength = strlen(pw->pw_name);
|
||||
}
|
||||
}
|
||||
namelength = MAXLOGNAME;
|
||||
if (smpmode && namelength > SMPUNAMELEN)
|
||||
namelength = SMPUNAMELEN;
|
||||
else if (namelength > UPUNAMELEN)
|
||||
|
@ -85,7 +85,7 @@ char *format_next_process(caddr_t handle, char *(*get_userid)(int),
|
||||
int flags);
|
||||
void toggle_pcpustats(void);
|
||||
void get_system_info(struct system_info *si);
|
||||
int machine_init(struct statics *statics, char do_unames);
|
||||
int machine_init(struct statics *statics);
|
||||
int proc_owner(int pid);
|
||||
|
||||
/* non-int routines typically used by the machine dependent module */
|
||||
|
@ -548,7 +548,7 @@ char *argv[];
|
||||
}
|
||||
|
||||
/* initialize the kernel memory interface */
|
||||
if (machine_init(&statics, do_unames) == -1)
|
||||
if (machine_init(&statics) == -1)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
@ -573,14 +573,6 @@ char *argv[];
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef no_initialization_needed
|
||||
/* initialize the hashing stuff */
|
||||
if (do_unames)
|
||||
{
|
||||
init_hash();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* initialize termcap */
|
||||
init_termcap(interactive);
|
||||
|
||||
|
@ -60,17 +60,6 @@ struct hash_el {
|
||||
struct hash_el hash_table[Table_size];
|
||||
|
||||
|
||||
void
|
||||
init_hash()
|
||||
|
||||
{
|
||||
/*
|
||||
* There used to be some steps we had to take to initialize things.
|
||||
* We don't need to do that anymore, but we will leave this stub in
|
||||
* just in case future changes require initialization steps.
|
||||
*/
|
||||
}
|
||||
|
||||
char *username(uid)
|
||||
|
||||
int uid;
|
||||
|
Loading…
Reference in New Issue
Block a user