SCCS-vsn: usr.bin/w/w.c 4.10
SCCS-vsn: sbin/routed/startup.c 4.3
-static char sccsid[] = "@(#)startup.c 4.2 %G%";
+static char sccsid[] = "@(#)startup.c 4.3 %G%";
struct netent *np = getnetbyname(name);
int n;
struct netent *np = getnetbyname(name);
int n;
- if (np->n_addrtype != AF_INET)
- return (0);
if (np == 0)
n = inet_network(name);
if (np == 0)
n = inet_network(name);
+ else {
+ if (np->n_addrtype != AF_INET)
+ return (0);
sin->sin_family = AF_INET;
sin->sin_addr = inet_makeaddr(n, INADDR_ANY);
return (1);
sin->sin_family = AF_INET;
sin->sin_addr = inet_makeaddr(n, INADDR_ANY);
return (1);
if (strcmp(type, "host") == 0) {
struct hostent *hp = gethostbyname(name);
if (strcmp(type, "host") == 0) {
struct hostent *hp = gethostbyname(name);
- if (hp->h_addrtype != AF_INET)
- return (0);
if (hp == 0)
sin->sin_addr.s_addr = inet_addr(name);
if (hp == 0)
sin->sin_addr.s_addr = inet_addr(name);
+ else {
+ if (hp->h_addrtype != AF_INET)
+ return (0);
bcopy(hp->h_addr, &sin->sin_addr, hp->h_length);
bcopy(hp->h_addr, &sin->sin_addr, hp->h_length);
sin->sin_family = AF_INET;
return (1);
}
sin->sin_family = AF_INET;
return (1);
}
-static char *sccsid = "@(#)w.c 4.9 (Berkeley) %G%";
+static char *sccsid = "@(#)w.c 4.10 (Berkeley) %G%";
/*
* w - print system status (who and what)
*
/*
* w - print system status (who and what)
*
#define X_BOOTTIME 6
{ "_nproc" },
#define X_NPROC 7
#define X_BOOTTIME 6
{ "_nproc" },
#define X_NPROC 7
int np; /* number of processes currently active */
struct utmp utmp;
struct proc mproc;
int np; /* number of processes currently active */
struct utmp utmp;
struct proc mproc;
-struct user up;
-char fill[512];
+union {
+ struct user U_up;
+ char pad[NBPG][UPAGES];
+} Up;
+#define up Up.U_up
main(argc, argv)
char **argv;
main(argc, argv)
char **argv;
if (lflag) {
/* print CPU time for all processes & children */
if (lflag) {
/* print CPU time for all processes & children */
+ prttime(DIV60(jobtime)," ");
/* print cpu time for interesting process */
/* print cpu time for interesting process */
+ prttime(DIV60(proctime)," ");
}
/* what user is doing, either command tail or args */
}
/* what user is doing, either command tail or args */
/* find & read in the user structure */
if ((mproc.p_flag & SLOAD) == 0) {
/* not in memory - get from swap device */
/* find & read in the user structure */
if ((mproc.p_flag & SLOAD) == 0) {
/* not in memory - get from swap device */
- addr = mproc.p_swaddr<<9;
+ addr = dtob(mproc.p_swaddr);
lseek(swap, (long)addr, 0);
if (read(swap, &up, sizeof(up)) != sizeof(up)) {
continue;
lseek(swap, (long)addr, 0);
if (read(swap, &up, sizeof(up)) != sizeof(up)) {
continue;
pr[np].w_seekaddr = ctob(apte.pg_pfnum);
}
vstodb(0, CLSIZE, &up.u_smap, &db, 1);
pr[np].w_seekaddr = ctob(apte.pg_pfnum);
}
vstodb(0, CLSIZE, &up.u_smap, &db, 1);
- pr[np].w_lastpg = ctob(db.db_base);
+ pr[np].w_lastpg = dtob(db.db_base);
if (up.u_ttyp == NULL)
continue;
if (up.u_ttyp == NULL)
continue;
pr[np].w_pid = mproc.p_pid;
pr[np].w_flag = mproc.p_flag;
pr[np].w_size = mproc.p_dsize + mproc.p_ssize;
pr[np].w_pid = mproc.p_pid;
pr[np].w_flag = mproc.p_flag;
pr[np].w_size = mproc.p_dsize + mproc.p_ssize;
- pr[np].w_igintr = (((int)up.u_signal[2]==1) + 2*((int)up.u_signal[2]>1) + 3*((int)up.u_signal[3]==1)) + 6*((int)up.u_signal[3]>1);
+ pr[np].w_igintr = (((int)up.u_signal[2]==1) +
+ 2*((int)up.u_signal[2]>1) + 3*((int)up.u_signal[3]==1)) +
+ 6*((int)up.u_signal[3]>1);
pr[np].w_time =
up.u_ru.ru_utime.tv_sec + up.u_ru.ru_stime.tv_sec;
pr[np].w_ctime =
pr[np].w_time =
up.u_ru.ru_utime.tv_sec + up.u_ru.ru_stime.tv_sec;
pr[np].w_ctime =
register int blk = DMMIN;
register swblk_t *ip = dmp->dm_map;
register int blk = DMMIN;
register swblk_t *ip = dmp->dm_map;
+ vsbase = ctod(vsbase);
+ vssize = ctod(vssize);
if (vsbase < 0 || vsbase + vssize > dmp->dm_size)
panic("vstodb");
while (vsbase >= blk) {
if (vsbase < 0 || vsbase + vssize > dmp->dm_size)
panic("vstodb");
while (vsbase >= blk) {