summaryrefslogtreecommitdiff
path: root/emu
diff options
context:
space:
mode:
Diffstat (limited to 'emu')
-rw-r--r--emu/FreeBSD/ipif.c24
-rw-r--r--emu/NetBSD/ipif.c24
-rw-r--r--emu/Nt/ipif.c24
-rw-r--r--emu/OpenBSD/ipif.c24
-rw-r--r--emu/port/devip.c26
-rw-r--r--emu/port/ipif-posix.c24
6 files changed, 29 insertions, 117 deletions
diff --git a/emu/FreeBSD/ipif.c b/emu/FreeBSD/ipif.c
index f6c621e8..62e87aee 100644
--- a/emu/FreeBSD/ipif.c
+++ b/emu/FreeBSD/ipif.c
@@ -253,24 +253,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port)
oserror();
}
-void
-so_setsockopt(int fd, int opt, int value)
-{
- int r;
- struct linger l;
-
- if(opt == SO_LINGER){
- l.l_onoff = 1;
- l.l_linger = (short) value;
- osenter();
- r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
- osleave();
- }else
- error(Ebadctl);
- if(r < 0)
- oserror();
-}
-
int
so_gethostbyname(char *host, char**hostv, int n)
{
@@ -334,13 +316,13 @@ so_getservbyname(char *service, char *net, char *port)
}
int
-so_hangup(int fd, int linger)
+so_hangup(int fd, int nolinger)
{
int r;
- static struct linger l = {1, 1000};
+ static struct linger l = {1, 0};
osenter();
- if(linger)
+ if(nolinger)
setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
r = shutdown(fd, 2);
if(r >= 0)
diff --git a/emu/NetBSD/ipif.c b/emu/NetBSD/ipif.c
index f6c621e8..62e87aee 100644
--- a/emu/NetBSD/ipif.c
+++ b/emu/NetBSD/ipif.c
@@ -253,24 +253,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port)
oserror();
}
-void
-so_setsockopt(int fd, int opt, int value)
-{
- int r;
- struct linger l;
-
- if(opt == SO_LINGER){
- l.l_onoff = 1;
- l.l_linger = (short) value;
- osenter();
- r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
- osleave();
- }else
- error(Ebadctl);
- if(r < 0)
- oserror();
-}
-
int
so_gethostbyname(char *host, char**hostv, int n)
{
@@ -334,13 +316,13 @@ so_getservbyname(char *service, char *net, char *port)
}
int
-so_hangup(int fd, int linger)
+so_hangup(int fd, int nolinger)
{
int r;
- static struct linger l = {1, 1000};
+ static struct linger l = {1, 0};
osenter();
- if(linger)
+ if(nolinger)
setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
r = shutdown(fd, 2);
if(r >= 0)
diff --git a/emu/Nt/ipif.c b/emu/Nt/ipif.c
index 4e3dba23..327d5471 100644
--- a/emu/Nt/ipif.c
+++ b/emu/Nt/ipif.c
@@ -290,24 +290,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port)
oserror();
}
-void
-so_setsockopt(int fd, int opt, int value)
-{
- int r;
- struct linger l;
-
- if(opt == SO_LINGER){
- l.l_onoff = 1;
- l.l_linger = (short) value;
- osenter();
- r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
- osleave();
- }else
- error(Ebadctl);
- if(r < 0)
- oserror();
-}
-
int
so_gethostbyname(char *host, char**hostv, int n)
{
@@ -370,13 +352,13 @@ so_getservbyname(char *service, char *net, char *port)
}
int
-so_hangup(int fd, int linger)
+so_hangup(int fd, int nolinger)
{
int r;
- static struct linger l = {1, 1000};
+ static struct linger l = {1, 0};
osenter();
- if(linger)
+ if(nolinger)
setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
r = closesocket(fd);
osleave();
diff --git a/emu/OpenBSD/ipif.c b/emu/OpenBSD/ipif.c
index f6c621e8..62e87aee 100644
--- a/emu/OpenBSD/ipif.c
+++ b/emu/OpenBSD/ipif.c
@@ -253,24 +253,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port)
oserror();
}
-void
-so_setsockopt(int fd, int opt, int value)
-{
- int r;
- struct linger l;
-
- if(opt == SO_LINGER){
- l.l_onoff = 1;
- l.l_linger = (short) value;
- osenter();
- r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
- osleave();
- }else
- error(Ebadctl);
- if(r < 0)
- oserror();
-}
-
int
so_gethostbyname(char *host, char**hostv, int n)
{
@@ -334,13 +316,13 @@ so_getservbyname(char *service, char *net, char *port)
}
int
-so_hangup(int fd, int linger)
+so_hangup(int fd, int nolinger)
{
int r;
- static struct linger l = {1, 1000};
+ static struct linger l = {1, 0};
osenter();
- if(linger)
+ if(nolinger)
setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
r = shutdown(fd, 2);
if(r >= 0)
diff --git a/emu/port/devip.c b/emu/port/devip.c
index e70d7dc3..d68cf172 100644
--- a/emu/port/devip.c
+++ b/emu/port/devip.c
@@ -148,7 +148,7 @@ ip3gen(Chan *c, int i, Dir *dp)
Conv *cv;
char *p;
- cv = ipfs[c->dev]->p[PROTO(c->qid)]->conv[CONV(c->qid)];
+ cv = ipfs[c->devno]->p[PROTO(c->qid)]->conv[CONV(c->qid)];
if(cv->owner == nil)
kstrdup(&cv->owner, eve);
mkqid(&q, QID(PROTO(c->qid), CONV(c->qid), i), 0, QTFILE);
@@ -207,7 +207,7 @@ ip1gen(Chan *c, int i, Dir *dp)
Fs *f;
extern ulong kerndate;
- f = ipfs[c->dev];
+ f = ipfs[c->devno];
prot = 0664;
mkqid(&q, QID(0, 0, i), 0, QTFILE);
@@ -219,7 +219,7 @@ ip1gen(Chan *c, int i, Dir *dp)
break;
case Qndb:
p = "ndb";
- len = strlen(ipfs[c->dev]->ndb);
+ len = strlen(ipfs[c->devno]->ndb);
break;
/* case Qiproute:
p = "iproute";
@@ -252,13 +252,13 @@ ipgen(Chan *c, char *name, Dirtab *tab, int x, int s, Dir *dp)
USED(name);
USED(tab);
USED(x);
- f = ipfs[c->dev];
+ f = ipfs[c->devno];
switch(TYPE(c->qid)) {
case Qtopdir:
if(s == DEVDOTDOT){
mkqid(&q, QID(0, 0, Qtopdir), 0, QTDIR);
- sprint(up->genbuf, "#I%lud", c->dev);
+ sprint(up->genbuf, "#I%ud", c->devno);
devdir(c, q, up->genbuf, 0, network, 0555, dp);
return 1;
}
@@ -280,7 +280,7 @@ ipgen(Chan *c, char *name, Dirtab *tab, int x, int s, Dir *dp)
case Qprotodir:
if(s == DEVDOTDOT){
mkqid(&q, QID(0, 0, Qtopdir), 0, QTDIR);
- sprint(up->genbuf, "#I%lud", c->dev);
+ sprint(up->genbuf, "#I%ud", c->devno);
devdir(c, q, up->genbuf, 0, network, 0555, dp);
return 1;
}
@@ -356,7 +356,7 @@ ipattach(char *spec)
c = devattach('I', spec);
mkqid(&c->qid, QID(0, 0, Qtopdir), 0, QTDIR);
- c->dev = 0;
+ c->devno = 0;
return c;
}
@@ -391,7 +391,7 @@ ipopen(Chan *c, int omode)
perm = m2p[omode&3];
- f = ipfs[c->dev];
+ f = ipfs[c->devno];
switch(TYPE(c->qid)) {
default:
@@ -526,7 +526,7 @@ ipclose(Chan *c)
{
Fs *f;
- f = ipfs[c->dev];
+ f = ipfs[c->devno];
switch(TYPE(c->qid)) {
case Qdata:
case Qctl:
@@ -546,7 +546,7 @@ ipread(Chan *ch, void *a, long n, vlong off)
Fs *f;
ulong offset = off;
- f = ipfs[ch->dev];
+ f = ipfs[ch->devno];
p = a;
switch(TYPE(ch->qid)) {
@@ -816,7 +816,7 @@ ipwrite(Chan *ch, void *a, long n, vlong off)
Cmdbuf *cb;
Fs *f;
- f = ipfs[ch->dev];
+ f = ipfs[ch->devno];
switch(TYPE(ch->qid)) {
default:
@@ -932,7 +932,7 @@ ipwstat(Chan *c, uchar *dp, int n)
Proto *p;
Fs *f;
- f = ipfs[c->dev];
+ f = ipfs[c->devno];
switch(TYPE(c->qid)) {
default:
error(Eperm);
@@ -1071,7 +1071,9 @@ Dev ipdevtab = {
'I',
"ip",
+ devreset,
ipinit,
+ devshutdown,
ipattach,
ipwalk,
ipstat,
diff --git a/emu/port/ipif-posix.c b/emu/port/ipif-posix.c
index 5af79f50..77b5f85d 100644
--- a/emu/port/ipif-posix.c
+++ b/emu/port/ipif-posix.c
@@ -261,24 +261,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port)
oserror();
}
-void
-so_setsockopt(int fd, int opt, int value)
-{
- int r;
- struct linger l;
-
- if(opt == SO_LINGER){
- l.l_onoff = 1;
- l.l_linger = (short) value;
- osenter();
- r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
- osleave();
- }else
- error(Ebadctl);
- if(r < 0)
- oserror();
-}
-
int
so_gethostbyname(char *host, char**hostv, int n)
{
@@ -341,13 +323,13 @@ so_getservbyname(char *service, char *net, char *port)
}
int
-so_hangup(int fd, int linger)
+so_hangup(int fd, int nolinger)
{
int r;
- static struct linger l = {1, 1000};
+ static struct linger l = {1, 0};
osenter();
- if(linger)
+ if(nolinger)
setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
r = shutdown(fd, 2);
if(r >= 0)