mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 08:52:46 +00:00
Widen struct sockbuf's sb_timeo member to int from short. With
non-default but reasonable values of hz this member overflowed, breaking NFS over UDP. Also, as long as I'm plowing up struct sockbuf ... Change certain members from u_long/long to u_int/int in order to reduce wasted space on 64-bit machines. This change was requested by Andrew Gallatin. Netstat and systat need to be rebuilt. I am incrementing __FreeBSD_version in case any ports need to change.
This commit is contained in:
parent
be1826c354
commit
f824b5187e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100591
@ -991,8 +991,8 @@ chgproccnt(uip, diff, max)
|
||||
int
|
||||
chgsbsize(uip, hiwat, to, max)
|
||||
struct uidinfo *uip;
|
||||
u_long *hiwat;
|
||||
u_long to;
|
||||
u_int *hiwat;
|
||||
u_int to;
|
||||
rlim_t max;
|
||||
{
|
||||
rlim_t new;
|
||||
|
@ -55,7 +55,7 @@
|
||||
* doc/en_US.ISO8859-1/books/porters-handbook/book.sgml
|
||||
*/
|
||||
#undef __FreeBSD_version
|
||||
#define __FreeBSD_version 500037 /* Master, propagated to newvers */
|
||||
#define __FreeBSD_version 500038 /* Master, propagated to newvers */
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
|
@ -111,7 +111,7 @@ void addupc_task(struct kse *ke, uintptr_t pc, u_int ticks);
|
||||
void calcru(struct proc *p, struct timeval *up, struct timeval *sp,
|
||||
struct timeval *ip);
|
||||
int chgproccnt(struct uidinfo *uip, int diff, int max);
|
||||
int chgsbsize(struct uidinfo *uip, u_long *hiwat, u_long to,
|
||||
int chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to,
|
||||
rlim_t max);
|
||||
int fuswintr(void *base);
|
||||
struct plimit
|
||||
|
@ -98,15 +98,15 @@ struct socket {
|
||||
* Variables for socket buffering.
|
||||
*/
|
||||
struct sockbuf {
|
||||
u_long sb_cc; /* actual chars in buffer */
|
||||
u_long sb_hiwat; /* max actual char count */
|
||||
u_long sb_mbcnt; /* chars of mbufs used */
|
||||
u_long sb_mbmax; /* max chars of mbufs to use */
|
||||
long sb_lowat; /* low water mark */
|
||||
struct mbuf *sb_mb; /* the mbuf chain */
|
||||
struct selinfo sb_sel; /* process selecting read/write */
|
||||
struct mbuf *sb_mb; /* the mbuf chain */
|
||||
u_int sb_cc; /* actual chars in buffer */
|
||||
u_int sb_hiwat; /* max actual char count */
|
||||
u_int sb_mbcnt; /* chars of mbufs used */
|
||||
u_int sb_mbmax; /* max chars of mbufs to use */
|
||||
int sb_lowat; /* low water mark */
|
||||
int sb_timeo; /* timeout for read/write */
|
||||
short sb_flags; /* flags, see below */
|
||||
short sb_timeo; /* timeout for read/write */
|
||||
} so_rcv, so_snd;
|
||||
#define SB_MAX (256*1024) /* default for max chars in sockbuf */
|
||||
#define SB_LOCK 0x01 /* lock on data queue */
|
||||
@ -172,13 +172,13 @@ struct xsocket {
|
||||
pid_t so_pgid;
|
||||
u_long so_oobmark;
|
||||
struct xsockbuf {
|
||||
u_long sb_cc;
|
||||
u_long sb_hiwat;
|
||||
u_long sb_mbcnt;
|
||||
u_long sb_mbmax;
|
||||
long sb_lowat;
|
||||
u_int sb_cc;
|
||||
u_int sb_hiwat;
|
||||
u_int sb_mbcnt;
|
||||
u_int sb_mbmax;
|
||||
int sb_lowat;
|
||||
int sb_timeo;
|
||||
short sb_flags;
|
||||
short sb_timeo;
|
||||
} so_rcv, so_snd;
|
||||
uid_t so_uid; /* XXX */
|
||||
};
|
||||
|
@ -246,7 +246,7 @@ atalkprotopr(u_long off __unused, char *name, int af __unused)
|
||||
}
|
||||
if (Aflag)
|
||||
printf("%8lx ", (u_long) this);
|
||||
printf("%-5.5s %6lu %6lu ", name, sockb.so_rcv.sb_cc,
|
||||
printf("%-5.5s %6u %6u ", name, sockb.so_rcv.sb_cc,
|
||||
sockb.so_snd.sb_cc);
|
||||
printf(Aflag?" %-18.18s":" %-22.22s", atalk_print(
|
||||
(struct sockaddr *)&ddpcb.ddp_lsat,7));
|
||||
|
@ -250,7 +250,7 @@ protopr(u_long proto, /* for sysctl version we pass proto # */
|
||||
so->so_incqlen, so->so_qlimit);
|
||||
printf("%-14.14s ", buf);
|
||||
} else {
|
||||
printf("%6ld %6ld ",
|
||||
printf("%6u %6u ",
|
||||
so->so_rcv.sb_cc,
|
||||
so->so_snd.sb_cc);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ ipxprotopr(u_long off, char *name, int af __unused)
|
||||
}
|
||||
if (Aflag)
|
||||
printf("%8lx ", ppcb);
|
||||
printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc,
|
||||
printf("%-5.5s %6u %6u ", name, sockb.so_rcv.sb_cc,
|
||||
sockb.so_snd.sb_cc);
|
||||
printf(Aflag?" %-18.18s":" %-22.22s", ipx_prpr(&ipxpcb.ipxp_laddr));
|
||||
printf(Aflag?" %-18.18s":" %-22.22s", ipx_prpr(&ipxpcb.ipxp_faddr));
|
||||
|
@ -263,7 +263,7 @@ iso_protopr1(u_long kern_addr, int istp)
|
||||
if (Aflag)
|
||||
printf("%8x ",
|
||||
(sockb.so_pcb ? (void *)sockb.so_pcb : (void *)kern_addr));
|
||||
printf("%-5.5s %6d %6d ", "tp", sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
|
||||
printf("%-5.5s %6u %6u ", "tp", sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
|
||||
if (istp && tpcb.tp_lsuffixlen) {
|
||||
hexprint(tpcb.tp_lsuffixlen, tpcb.tp_lsuffix, "()");
|
||||
printf("\t");
|
||||
@ -345,7 +345,7 @@ tp_inproto(u_long pcb)
|
||||
return;
|
||||
if (Aflag)
|
||||
printf("%8x ", pcb);
|
||||
printf("%-5.5s %6d %6d ", "tpip",
|
||||
printf("%-5.5s %6u %6u ", "tpip",
|
||||
sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
|
||||
inetprint(&inpcb.inp_laddr, inpcb.inp_lport, "tp");
|
||||
inetprint(&inpcb.inp_faddr, inpcb.inp_fport, "tp");
|
||||
@ -494,7 +494,7 @@ x25_protopr(u_long off, char *name, int af __unused)
|
||||
"Local Address", "Foreign Address", "(state)");
|
||||
first = 0;
|
||||
}
|
||||
printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc,
|
||||
printf("%-5.5s %6u %6u ", name, sockb.so_rcv.sb_cc,
|
||||
sockb.so_snd.sb_cc);
|
||||
isonetprint(&xpcb.x_laddr.siso_addr, &xpcb.x_lport,
|
||||
sizeof(xpcb.x_lport), 1);
|
||||
|
@ -159,7 +159,7 @@ netgraphprotopr(u_long off, char *name, int af __unused)
|
||||
/* Show socket */
|
||||
if (Aflag)
|
||||
printf("%8lx ", (u_long) this);
|
||||
printf("%-5.5s %6lu %6lu ",
|
||||
printf("%-5.5s %6u %6u ",
|
||||
name, sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
|
||||
|
||||
/* Get ngsock structure */
|
||||
|
@ -136,7 +136,7 @@ nsprotopr(u_long off, char *name, int af __unused)
|
||||
}
|
||||
if (Aflag)
|
||||
printf("%8x ", ppcb);
|
||||
printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc,
|
||||
printf("%-5.5s %6u %6u ", name, sockb.so_rcv.sb_cc,
|
||||
sockb.so_snd.sb_cc);
|
||||
printf(" %-22.22s", ns_prpr(&nspcb.nsp_laddr));
|
||||
printf(" %-22.22s", ns_prpr(&nspcb.nsp_faddr));
|
||||
|
@ -146,7 +146,7 @@ unixdomainpr(struct xunpcb *xunp, struct xsocket *so)
|
||||
"Inode", "Conn", "Refs", "Nextref");
|
||||
first = 0;
|
||||
}
|
||||
printf("%8lx %-6.6s %6ld %6ld %8lx %8lx %8lx %8lx",
|
||||
printf("%8lx %-6.6s %6u %6u %8lx %8lx %8lx %8lx",
|
||||
(long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc,
|
||||
so->so_snd.sb_cc,
|
||||
(long)unp->unp_vnode, (long)unp->unp_conn,
|
||||
|
@ -110,8 +110,8 @@ struct netinfo {
|
||||
long ni_lport; /* local port */
|
||||
struct in_addr ni_faddr; /* foreign address */
|
||||
long ni_fport; /* foreign port */
|
||||
long ni_rcvcc; /* rcv buffer character count */
|
||||
long ni_sndcc; /* snd buffer character count */
|
||||
u_int ni_rcvcc; /* rcv buffer character count */
|
||||
u_int ni_sndcc; /* snd buffer character count */
|
||||
};
|
||||
|
||||
TAILQ_HEAD(netinfohead, netinfo) netcb = TAILQ_HEAD_INITIALIZER(netcb);
|
||||
@ -450,8 +450,8 @@ shownetstat()
|
||||
p->ni_flags &= ~NIF_FACHG;
|
||||
}
|
||||
mvwaddstr(wnd, p->ni_line, PROTO, p->ni_proto);
|
||||
mvwprintw(wnd, p->ni_line, RCVCC, "%6d", p->ni_rcvcc);
|
||||
mvwprintw(wnd, p->ni_line, SNDCC, "%6d", p->ni_sndcc);
|
||||
mvwprintw(wnd, p->ni_line, RCVCC, "%6u", p->ni_rcvcc);
|
||||
mvwprintw(wnd, p->ni_line, SNDCC, "%6u", p->ni_sndcc);
|
||||
if (streq(p->ni_proto, "tcp")) {
|
||||
if (p->ni_state < 0 || p->ni_state >= TCP_NSTATES)
|
||||
mvwprintw(wnd, p->ni_line, STATE, "%d",
|
||||
|
Loading…
Reference in New Issue
Block a user