ref: 230e492a8a564ba24a8575f64d2380504ae6338e
parent: 21b830b1ac2409159dfc3ccea59a6fffab805053
author: Russ Cox <rsc@swtch.com>
date: Thu Dec 29 18:41:14 EST 2005
more irix-inspired fixes
--- /dev/null
+++ b/Make.irix
@@ -1,0 +1,24 @@
+# Unix
+PTHREAD= # for Mac
+#PTHREAD=-pthread
+AR=ar
+AS=as
+ASFLAGS=-c -mips3
+RANLIB=true
+X11=/usr/X11R6
+#CC=gcc
+#CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include -D_THREAD_SAFE $(PTHREAD) -O2
+CC=cc
+CFLAGS=-g -O2 -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include -DIRIX
+O=o
+OS=posix
+GUI=x11
+LDADD=-L$(X11)/lib -lX11 -g -lpthread
+LDFLAGS=$(PTHREAD)
+TARG=drawterm
+MAKE=gmake
+
+all: default
+
+libmachdep.a:
+ (cd posix-mips && $(MAKE))
--- a/Makefile
+++ b/Makefile
@@ -38,34 +38,34 @@
rm -f *.o */*.o */*.a *.a drawterm drawterm.exe
kern/libkern.a:
- (cd kern; make)
+ (cd kern; $(MAKE))
exportfs/libexportfs.a:
- (cd exportfs; make)
+ (cd exportfs; $(MAKE))
libauth/libauth.a:
- (cd libauth; make)
+ (cd libauth; $(MAKE))
libauthsrv/libauthsrv.a:
- (cd libauthsrv; make)
+ (cd libauthsrv; $(MAKE))
libmp/libmp.a:
- (cd libmp; make)
+ (cd libmp; $(MAKE))
libsec/libsec.a:
- (cd libsec; make)
+ (cd libsec; $(MAKE))
libmemdraw/libmemdraw.a:
- (cd libmemdraw; make)
+ (cd libmemdraw; $(MAKE))
libmemlayer/libmemlayer.a:
- (cd libmemlayer; make)
+ (cd libmemlayer; $(MAKE))
libdraw/libdraw.a:
- (cd libdraw; make)
+ (cd libdraw; $(MAKE))
libc/libc.a:
- (cd libc; make)
+ (cd libc; $(MAKE))
gui-$(GUI)/libgui.a:
- (cd gui-$(GUI); make)
+ (cd gui-$(GUI); $(MAKE))
--- a/cpu.c
+++ b/cpu.c
@@ -28,7 +28,7 @@
#define system csystem
static char *system;
static int cflag;
-int dbg;
+extern int dbg;
static char *srvname = "ncpu";
static char *ealgs = "rc4_256 sha1";
@@ -548,7 +548,7 @@
char tbuf[TICKETLEN+TICKETLEN+AUTHENTLEN], trbuf[TICKREQLEN];
char authkey[DESKEYLEN];
Authenticator auth;
- int afd, i, v2, n;
+ int afd, i, v2;
Ticketreq tr;
Ticket t;
AuthInfo *ai;
@@ -556,7 +556,7 @@
if((afd = open("/mnt/factotum/ctl", ORDWR)) >= 0)
return p9anyfactotum(fd, afd);
- if((n = readstr(fd, buf, sizeof buf)) < 0)
+ if(readstr(fd, buf, sizeof buf) < 0)
fatal(1, "cannot read p9any negotiation");
bbuf = buf;
v2 = 0;
@@ -577,7 +577,7 @@
if(write(fd, buf2, strlen(buf2)+1) != strlen(buf2)+1)
fatal(1, "cannot write user/domain choice in p9any");
if(v2){
- if((n = readstr(fd, buf, sizeof buf)) != 3)
+ if(readstr(fd, buf, sizeof buf) != 3)
fatal(1, "cannot read OK in p9any");
if(memcmp(buf, "OK\0", 3) != 0)
fatal(1, "did not get OK in p9any");
--- a/include/dtos.h
+++ b/include/dtos.h
@@ -9,3 +9,7 @@
#else
# error "Define an OS"
#endif
+
+#ifdef IRIX
+typedef int socklen_t;
+#endif
--- a/include/lib.h
+++ b/include/lib.h
@@ -45,8 +45,8 @@
#define uvlong p9_uvlong
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
+#define SET(x) ((x)=0)
#define USED(x) if(x);else
-#define SET(x)
enum
{
--- a/kern/fns.h
+++ b/kern/fns.h
@@ -44,7 +44,7 @@
void confinit(void);
void confinit1(int);
int consactive(void);
-void (*consdebug)(void);
+extern void (*consdebug)(void);
void copen(Chan*);
Block* concatblock(Block*);
Block* copyblock(Block*, int);
@@ -146,7 +146,7 @@
void killbig(void);
int kproc(char*, void(*)(void*), void*);
void kprocchild(Proc*, void (*)(void*), void*);
-void (*kproftimer)(ulong);
+extern void (*kproftimer)(ulong);
void ksetenv(char*, char*, int);
void kstrcpy(char*, char*, int);
void kstrdup(char**, char*);
@@ -294,11 +294,11 @@
void runlock(RWlock*);
Proc* runproc(void);
void savefpregs(FPsave*);
-void (*saveintrts)(void);
+extern void (*saveintrts)(void);
void sched(void);
void scheddump(void);
void schedinit(void);
-void (*screenputs)(char*, int);
+extern void (*screenputs)(char*, int);
long seconds(void);
ulong segattach(Proc*, ulong, char *, ulong, ulong);
void segclock(ulong);