sockstat.c (cd72f2180bfff020d03180e6eba1c3a0e0125468) sockstat.c (48e3128b34dad9618402f1f4095f7655e779843c)
1/*-
2 * Copyright (c) 2002 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 456 unchanged lines hidden (view full) ---

465 void *p;
466 int hash, n, pos;
467
468 printf("%-8s %-10s %-5s %-2s %-6s %-21s %-21s\n",
469 "USER", "COMMAND", "PID", "FD", "PROTO",
470 "LOCAL ADDRESS", "FOREIGN ADDRESS");
471 setpassent(1);
472 for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) {
1/*-
2 * Copyright (c) 2002 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 456 unchanged lines hidden (view full) ---

465 void *p;
466 int hash, n, pos;
467
468 printf("%-8s %-10s %-5s %-2s %-6s %-21s %-21s\n",
469 "USER", "COMMAND", "PID", "FD", "PROTO",
470 "LOCAL ADDRESS", "FOREIGN ADDRESS");
471 setpassent(1);
472 for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) {
473 hash = (int)((uintptr_t)xf->xun_data.generic % HASHSIZE);
473 hash = (int)((uintptr_t)xf->xf_data % HASHSIZE);
474 for (s = sockhash[hash]; s != NULL; s = s->next)
474 for (s = sockhash[hash]; s != NULL; s = s->next)
475 if (s->socket == xf->xun_data.socket)
475 if ((void *)s->socket == xf->xf_data)
476 break;
477 if (s == NULL)
478 continue;
479 pos = 0;
480 if ((pwd = getpwuid(xf->xf_uid)) == NULL)
481 pos += xprintf("%lu", (u_long)xf->xf_uid);
482 else
483 pos += xprintf("%s", pwd->pw_name);

--- 117 unchanged lines hidden ---
476 break;
477 if (s == NULL)
478 continue;
479 pos = 0;
480 if ((pwd = getpwuid(xf->xf_uid)) == NULL)
481 pos += xprintf("%lu", (u_long)xf->xf_uid);
482 else
483 pos += xprintf("%s", pwd->pw_name);

--- 117 unchanged lines hidden ---