[Mit-cadr-cvs] r340 - trunk/emulator/chaos
ggilley at common-lisp.net
ggilley at common-lisp.net
Fri Nov 23 04:50:45 UTC 2012
Author: ggilley
Date: Thu Nov 22 20:50:44 2012
New Revision: 340
Log:
get chaos working on Ubuntu
Modified:
trunk/emulator/chaos/FILE.c
trunk/emulator/chaos/chaos.c
trunk/emulator/chaos/client.c
Modified: trunk/emulator/chaos/FILE.c
==============================================================================
--- trunk/emulator/chaos/FILE.c Thu Nov 22 20:45:27 2012 (r339)
+++ trunk/emulator/chaos/FILE.c Thu Nov 22 20:50:44 2012 (r340)
@@ -78,7 +78,7 @@
/* use utimes instead of "outmoded" utime */
#endif
-#if defined(__NetBSD__) || defined(OSX)
+#if defined(__NetBSD__) || defined(OSX) || defined(linux)
#include <utime.h>
#include <sys/statvfs.h>
#endif
@@ -2462,7 +2462,7 @@
char response[CHMAXDATA];
int errcode = 0;
struct tm *tm;
-
+
#ifndef SELECT
(void)write(ctlpipe[1], (char *)&ax, sizeof(x));
#endif
@@ -2518,7 +2518,7 @@
log(LOG_INFO, "xclose (3b)\n");
-#if defined(OSX) || defined(BSD42)
+#if defined(OSX) || defined(BSD42) || defined(linux)
struct timeval timep[2];
timep[0].tv_sec = (x->x_options&O_PRESERVE ||
@@ -2547,7 +2547,7 @@
log(LOG_INFO, "xclose (3c)\n");
-#if defined(OSX) || defined(BSD42)
+#if defined(OSX) || defined(BSD42) || defined(linux)
if (utimes(x->x_realname, timep)) {
log(LOG_INFO, "error from utimes: errno = %d %s\n", errno, strerror(errno));
}
@@ -2566,14 +2566,14 @@
#endif
if (protocol > 0)
(void)sprintf(response,
- "%02d/%02d/%02d %02d:%02d:%02d %lld%c%s%c",
+ "%02d/%02d/%02d %02d:%02d:%02d %ld%c%s%c",
tm->tm_mon+1, tm->tm_mday, tm->tm_year,
tm->tm_hour, tm->tm_min, tm->tm_sec,
sbuf.st_size, CHNL,
x->x_realname, CHNL);
else
(void)sprintf(response,
- "%d %02d/%02d/%02d %02d:%02d:%02d %lld%c%s%c",
+ "%d %02d/%02d/%02d %02d:%02d:%02d %ld%c%s%c",
-1, tm->tm_mon+1, tm->tm_mday,
tm->tm_year, tm->tm_hour, tm->tm_min,
tm->tm_sec, sbuf.st_size, CHNL,
@@ -3567,7 +3567,7 @@
static char *
xgetbsize(struct stat *s, char *cp)
{
- (void)sprintf(cp, "%lld", (s->st_size + FSBSIZE - 1) / FSBSIZE);
+ (void)sprintf(cp, "%ld", (s->st_size + FSBSIZE - 1) / FSBSIZE);
while (*cp)
cp++;
@@ -3588,7 +3588,7 @@
register struct stat *s;
register char *cp;
{
- (void)sprintf(cp, "%lld", s->st_size);
+ (void)sprintf(cp, "%ld", s->st_size);
while (*cp)
cp++;
return cp;
Modified: trunk/emulator/chaos/chaos.c
==============================================================================
--- trunk/emulator/chaos/chaos.c Thu Nov 22 20:45:27 2012 (r339)
+++ trunk/emulator/chaos/chaos.c Thu Nov 22 20:50:44 2012 (r340)
@@ -249,8 +249,9 @@
void
prpkt(struct packet *pkt, char *str)
{
- debugf(DBG_LOW, "op=%s(%s) len=%d fc=%d; dhost=%o didx=%x; shost=%o sidx=%x\npkn=%d ackn=%d",
- str, pkt->pk_op == 128 ? "DAT" : pkt->pk_op == 129 ? "SYN" : pkt->pk_op == 192 ? "DWD" : opcodetable[pkt->pk_op], PH_LEN(pkt->pk_phead),
+ debugf(DBG_LOW, "op=%s(%s) num=%d len=%d fc=%d; dhost=%o didx=%x; shost=%o sidx=%x\npkn=%d ackn=%d",
+ str, pkt->pk_op == 128 ? "DAT" : pkt->pk_op == 129 ? "SYN" : pkt->pk_op == 192 ? "DWD" : opcodetable[pkt->pk_op],
+ LE_TO_SHORT(pkt->LE_pk_pkn), PH_LEN(pkt->pk_phead),
PH_FC(pkt->pk_phead), pkt->pk_dhost,
CH_INDEX_SHORT(pkt->pk_phead.ph_didx), pkt->pk_shost,
CH_INDEX_SHORT(pkt->pk_phead.ph_sidx),
@@ -690,8 +691,11 @@
{
char *rfcstr = rfcpkt->pk_cdata;
int rfclen;
+ char crfcstr[CHMAXDATA];
- debugf(DBG_LOW, "Rcvrfc: Comparing %s and %s", rfcstr, lsnstr);
+ memcpy(crfcstr, rfcpkt->pk_cdata, PH_LEN(rfcpkt->pk_phead));
+ crfcstr[PH_LEN(rfcpkt->pk_phead)] = '\0';
+ debugf(DBG_LOW, "Rcvrfc: Comparing %s and %s", crfcstr, lsnstr);
debugf(DBG_LOW, "rfcpkt->pk_len = %d lsnlen = %d",
PH_LEN(rfcpkt->pk_phead),
lsnlen);
Modified: trunk/emulator/chaos/client.c
==============================================================================
--- trunk/emulator/chaos/client.c Thu Nov 22 20:45:27 2012 (r339)
+++ trunk/emulator/chaos/client.c Thu Nov 22 20:50:44 2012 (r340)
@@ -47,11 +47,7 @@
UNIX_SOCKET_PATH, UNIX_SOCKET_CLIENT_NAME, getpid());
unix_addr.sun_family = AF_UNIX;
-#if defined(LINUX)
- len = strlen(unix_addr.sun_path) + sizeof unix_addr - sizeof unix_addr.sun_path;
-#else
len = (int)SUN_LEN(&unix_addr);
-#endif
unlink(unix_addr.sun_path);
@@ -71,11 +67,7 @@
sprintf(unix_addr.sun_path, "%s%s",
UNIX_SOCKET_PATH, UNIX_SOCKET_SERVER_NAME);
unix_addr.sun_family = AF_UNIX;
-#if defined(LINUX)
- len = strlen(unix_addr.sun_path) + sizeof(unix_addr.sun_family);
-#else
len = (int)SUN_LEN(&unix_addr);
-#endif
if (connect(fd, (struct sockaddr *)&unix_addr, len) < 0) {
perror("connect(AF_UNIX)");
More information about the mit-cadr-cvs
mailing list