ref: cc2017f0b3437191606eb39ec679e2a447670a76
parent: 95d41e8ff4fb5a282e7cf55c4fa82eeb1950eb63
author: cinap_lenrek <[email protected]>
date: Wed Mar 6 09:11:21 EST 2013
aan: fix structure padding for amd64
--- a/sys/src/cmd/aan.c
+++ b/sys/src/cmd/aan.c
@@ -18,6 +18,7 @@
Timer = 0, // Alt channels.
Unsent = 1,
Maxto = 24 * 3600, // A full day to reconnect.
+ Hdrsz = 3*4,
};
typedef struct Endpoints Endpoints;
@@ -199,7 +200,7 @@
PBIT32(hdr.acked, inmsg);
PBIT32(hdr.msg, -1);
- if (writen(netfd, (uchar *)&hdr, sizeof(Hdr)) < 0) {
+ if (writen(netfd, (uchar *)&hdr, Hdrsz) < 0) {
dmessage(2, "main; writen failed; %r\n");
failed = 1;
continue;
@@ -216,7 +217,7 @@
PBIT32(b->hdr.acked, inmsg);
- if (writen(netfd, (uchar *)&b->hdr, sizeof(Hdr)) < 0) {
+ if (writen(netfd, (uchar *)&b->hdr, Hdrsz) < 0) {
dmessage(2, "main; writen failed; %r\n");
failed = 1;
}
@@ -283,7 +284,7 @@
}
// Read the header.
- len = readn(netfd, (uchar *)&b->hdr, sizeof(Hdr));
+ len = readn(netfd, (uchar *)&b->hdr, Hdrsz);
if (len <= 0) {
if (len < 0)
dmessage(1, "fromnet; (hdr) network failure; %r\n");
@@ -413,7 +414,7 @@
tmp = chancreate(sizeof(Buf *), Nbuf);
while ((b = nbrecvp(unacked)) != nil) {
n = GBIT32(b->hdr.nb);
- writen(netfd, (uchar *)&b->hdr, sizeof(Hdr));
+ writen(netfd, (uchar *)&b->hdr, Hdrsz);
writen(netfd, b->buf, n);
sendp(tmp, b);
}