Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F165119458
D15386.id42388.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D15386.id42388.diff
View Options
Index: sys/kern/uipc_socket.c
===================================================================
--- sys/kern/uipc_socket.c
+++ sys/kern/uipc_socket.c
@@ -3971,12 +3971,12 @@
{
xso->xso_len = sizeof *xso;
- xso->xso_so = so;
+ xso->xso_so = (int64_t)so;
xso->so_type = so->so_type;
xso->so_options = so->so_options;
xso->so_linger = so->so_linger;
xso->so_state = so->so_state;
- xso->so_pcb = so->so_pcb;
+ xso->so_pcb = (uint64_t)so->so_pcb;
xso->xso_protocol = so->so_proto->pr_protocol;
xso->xso_family = so->so_proto->pr_domain->dom_family;
xso->so_timeo = so->so_timeo;
Index: sys/kern/uipc_usrreq.c
===================================================================
--- sys/kern/uipc_usrreq.c
+++ sys/kern/uipc_usrreq.c
@@ -1640,7 +1640,7 @@
unp->unp_refcount--;
if (unp->unp_refcount != 0 && unp->unp_gencnt <= gencnt) {
xu->xu_len = sizeof *xu;
- xu->xu_unpp = unp;
+ xu->xu_unpp = (int64_t)unp;
/*
* XXX - need more locking here to protect against
* connect/disconnect races for SMP.
@@ -1657,10 +1657,10 @@
unp->unp_conn->unp_addr->sun_len);
else
bzero(&xu->xu_caddr, sizeof(xu->xu_caddr));
- xu->unp_vnode = unp->unp_vnode;
- xu->unp_conn = unp->unp_conn;
- xu->xu_firstref = LIST_FIRST(&unp->unp_refs);
- xu->xu_nextref = LIST_NEXT(unp, unp_reflink);
+ xu->unp_vnode = (int64_t)unp->unp_vnode;
+ xu->unp_conn = (int64_t)unp->unp_conn;
+ xu->xu_firstref = (int64_t)LIST_FIRST(&unp->unp_refs);
+ xu->xu_nextref = (int64_t)LIST_NEXT(unp, unp_reflink);
xu->unp_gencnt = unp->unp_gencnt;
sotoxsocket(unp->unp_socket, &xu->xu_socket);
UNP_PCB_UNLOCK(unp);
Index: sys/netinet/in_pcb.h
===================================================================
--- sys/netinet/in_pcb.h
+++ sys/netinet/in_pcb.h
@@ -363,12 +363,12 @@
*/
#ifdef _SYS_SOCKETVAR_H_
struct xinpcb {
- size_t xi_len; /* length of this structure */
+ uint64_t xi_len; /* length of this structure */
struct xsocket xi_socket; /* (s,p) */
struct in_conninfo inp_inc; /* (s,p) */
uint64_t inp_gencnt; /* (s,p) */
union {
- void *inp_ppcb; /* (s) netstat(1) */
+ int64_t inp_ppcb; /* (s) netstat(1) */
int64_t ph_ppcb;
};
int64_t inp_spare64[4];
Index: sys/netinet/in_pcb.c
===================================================================
--- sys/netinet/in_pcb.c
+++ sys/netinet/in_pcb.c
@@ -2563,7 +2563,7 @@
bzero(&xi->xi_socket, sizeof(struct xsocket));
bcopy(&inp->inp_inc, &xi->inp_inc, sizeof(struct in_conninfo));
xi->inp_gencnt = inp->inp_gencnt;
- xi->inp_ppcb = inp->inp_ppcb;
+ xi->inp_ppcb = (int64_t)inp->inp_ppcb;
xi->inp_flow = inp->inp_flow;
xi->inp_flowid = inp->inp_flowid;
xi->inp_flowtype = inp->inp_flowtype;
Index: sys/netinet/sctp_sysctl.c
===================================================================
--- sys/netinet/sctp_sysctl.c
+++ sys/netinet/sctp_sysctl.c
@@ -409,7 +409,7 @@
xinpcb.total_recvs = inp->total_recvs;
xinpcb.total_nospaces = inp->total_nospaces;
xinpcb.fragmentation_point = inp->sctp_frag_point;
- xinpcb.socket = inp->sctp_socket;
+ xinpcb.socket = (int64_t)inp->sctp_socket;
so = inp->sctp_socket;
if ((so == NULL) ||
(!SCTP_IS_LISTENING(inp)) ||
Index: sys/netinet/sctp_uio.h
===================================================================
--- sys/netinet/sctp_uio.h
+++ sys/netinet/sctp_uio.h
@@ -1175,14 +1175,10 @@
uint16_t local_port;
uint16_t qlen_old;
uint16_t maxqlen_old;
- void *socket;
+ uint64_t socket;
uint32_t qlen;
uint32_t maxqlen;
-#if defined(__LP64__)
uint32_t extra_padding[27]; /* future */
-#else
- uint32_t extra_padding[28]; /* future */
-#endif
};
struct xsctp_tcb {
Index: sys/netinet/tcp_var.h
===================================================================
--- sys/netinet/tcp_var.h
+++ sys/netinet/tcp_var.h
@@ -668,7 +668,7 @@
*/
#if defined(_NETINET_IN_PCB_H_) && defined(_SYS_SOCKETVAR_H_)
struct xtcpcb {
- size_t xt_len; /* length of this structure */
+ uint64_t xt_len; /* length of this structure */
struct xinpcb xt_inp;
char xt_stack[TCP_FUNCTION_NAME_LEN_MAX]; /* (s) */
char xt_logid[TCP_LOG_ID_LEN]; /* (s) */
Index: sys/sys/socketvar.h
===================================================================
--- sys/sys/socketvar.h
+++ sys/sys/socketvar.h
@@ -471,13 +471,13 @@
* Structure to export socket from kernel to utilities, via sysctl(3).
*/
struct xsocket {
- size_t xso_len; /* length of this structure */
+ uint64_t xso_len; /* length of this structure */
union {
- void *xso_so; /* kernel address of struct socket */
+ int64_t xso_so; /* kernel address of struct socket */
int64_t ph_so;
};
union {
- void *so_pcb; /* kernel address of struct inpcb */
+ int64_t so_pcb; /* kernel address of struct inpcb */
int64_t ph_pcb;
};
uint64_t so_oobmark;
Index: sys/sys/unpcb.h
===================================================================
--- sys/sys/unpcb.h
+++ sys/sys/unpcb.h
@@ -136,12 +136,12 @@
*/
#ifdef _SYS_SOCKETVAR_H_
struct xunpcb {
- size_t xu_len; /* length of this structure */
- void *xu_unpp; /* to help netstat, fstat */
- void *unp_vnode; /* (s) */
- void *unp_conn; /* (s) */
- void *xu_firstref; /* (s) */
- void *xu_nextref; /* (s) */
+ uint64_t xu_len; /* length of this structure */
+ int64_t xu_unpp; /* to help netstat, fstat */
+ int64_t unp_vnode; /* (s) */
+ int64_t unp_conn; /* (s) */
+ int64_t xu_firstref; /* (s) */
+ int64_t xu_nextref; /* (s) */
unp_gen_t unp_gencnt; /* (s) */
int64_t xu_spare64[8];
int32_t xu_spare32[8];
@@ -157,7 +157,7 @@
} __aligned(8);
struct xunpgen {
- size_t xug_len;
+ uint64_t xug_len;
u_int xug_count;
unp_gen_t xug_gen;
so_gen_t xug_sogen;
Index: usr.bin/netstat/inet.c
===================================================================
--- usr.bin/netstat/inet.c
+++ usr.bin/netstat/inet.c
@@ -159,12 +159,12 @@
bzero(xso, sizeof *xso);
xso->xso_len = sizeof *xso;
- xso->xso_so = so;
+ xso->xso_so = (uint64_t)so;
xso->so_type = so->so_type;
xso->so_options = so->so_options;
xso->so_linger = so->so_linger;
xso->so_state = so->so_state;
- xso->so_pcb = so->so_pcb;
+ xso->so_pcb = (uint64_t)so->so_pcb;
if (kread((uintptr_t)so->so_proto, &proto, sizeof(proto)) != 0)
return (-1);
xso->xso_protocol = proto.pr_protocol;
Index: usr.bin/netstat/unix.c
===================================================================
--- usr.bin/netstat/unix.c
+++ usr.bin/netstat/unix.c
@@ -153,7 +153,7 @@
xu.xu_len = sizeof xu;
KREAD(head_off, &head, sizeof(head));
LIST_FOREACH(unp, &head, unp_link) {
- xu.xu_unpp = unp;
+ xu.xu_unpp = (int64_t)unp;
KREAD(unp, &unp0, sizeof (*unp));
unp = &unp0;
Index: usr.bin/sockstat/sockstat.c
===================================================================
--- usr.bin/sockstat/sockstat.c
+++ usr.bin/sockstat/sockstat.c
@@ -107,8 +107,8 @@
};
struct sock {
- void *socket;
- void *pcb;
+ int64_t socket;
+ int64_t pcb;
int shown;
int vflag;
int family;
@@ -788,8 +788,8 @@
warnx("struct xunpcb size mismatch");
goto out;
}
- if ((xup->unp_conn == NULL && !opt_l) ||
- (xup->unp_conn != NULL && !opt_c))
+ if ((xup->unp_conn == 0 && !opt_l) ||
+ (xup->unp_conn != 0 && !opt_c))
continue;
if ((sock = calloc(1, sizeof(*sock))) == NULL)
err(1, "malloc()");
@@ -805,8 +805,8 @@
if (xup->xu_addr.sun_family == AF_UNIX)
laddr->address =
*(struct sockaddr_storage *)(void *)&xup->xu_addr;
- else if (xup->unp_conn != NULL)
- *(void **)&(faddr->address) = xup->unp_conn;
+ else if (xup->unp_conn != 0)
+ *(int64_t*)&(faddr->address) = xup->unp_conn;
laddr->next = NULL;
faddr->next = NULL;
sock->laddr = laddr;
@@ -1007,7 +1007,7 @@
static void
displaysock(struct sock *s, int pos)
{
- void *p;
+ int64_t p;
int hash, first, offset;
struct addr *laddr, *faddr;
struct sock *s_tmp;
@@ -1053,8 +1053,8 @@
break;
}
/* client */
- p = *(void **)&(faddr->address);
- if (p == NULL) {
+ p = *(int64_t*)&(faddr->address);
+ if (p == 0) {
pos += xprintf("(not connected)");
offset += opt_w ? 92 : 44;
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 7, 5:31 AM (2 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36148155
Default Alt Text
D15386.id42388.diff (8 KB)
Attached To
Mode
D15386: Improve portability of structs xinpcb and friends.
Attached
Detach File
Event Timeline
Log In to Comment