History

20090930-0258

forsyth committed 17 years ago

Commit 20fe41c1 parent 182ddd48 files · +32 −118Browse files

Unified · Split

8 files
  1. CHANGES +2 −0
  2. emu/FreeBSD/ipif.c +3 −21
  3. emu/NetBSD/ipif.c +3 −21
  4. emu/Nt/ipif.c +3 −21
  5. emu/OpenBSD/ipif.c +3 −21
  6. emu/port/devip.c +14 −12
  7. emu/port/ipif-posix.c +3 −21
  8. include/version.h +1 −1
CHANGES+2−0
@@ -1,3 +1,5 @@
1+20090930
2+ emu/*/ipif*.c make "hangup" act as in native Inferno; also delete unused so_setsockopt
13 20090928
24 update import(4) to remove the restriction to Plan 9 (can use Inferno's own factotum)
35 (emu os)^/port/devmnt.c fix from plan 9 (don't access vanished data)
emu/FreeBSD/ipif.c+3−21
@@ -253,24 +253,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 252 unmodified lines
253253 oserror();
254254 }
255255
256−void
257−so_setsockopt(int fd, int opt, int value)
258−{
259− int r;
260− struct linger l;
261−
262− if(opt == SO_LINGER){
263− l.l_onoff = 1;
264− l.l_linger = (short) value;
265− osenter();
266− r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
267− osleave();
268− }else
269− error(Ebadctl);
270− if(r < 0)
271− oserror();
272−}
273−
274256 int
275257 so_gethostbyname(char *host, char**hostv, int n)
276258 {
@@ -334,13 +316,13 @@ so_getservbyname(char *service, char *net, char *port) · 57 unmodified lines
334316 }
335317
336318 int
337−so_hangup(int fd, int linger)
319+so_hangup(int fd, int nolinger)
338320 {
339321 int r;
340− static struct linger l = {1, 1000};
322+ static struct linger l = {1, 0};
341323
342324 osenter();
343− if(linger)
325+ if(nolinger)
344326 setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
345327 r = shutdown(fd, 2);
346328 if(r >= 0)
emu/NetBSD/ipif.c+3−21
@@ -253,24 +253,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 252 unmodified lines
253253 oserror();
254254 }
255255
256−void
257−so_setsockopt(int fd, int opt, int value)
258−{
259− int r;
260− struct linger l;
261−
262− if(opt == SO_LINGER){
263− l.l_onoff = 1;
264− l.l_linger = (short) value;
265− osenter();
266− r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
267− osleave();
268− }else
269− error(Ebadctl);
270− if(r < 0)
271− oserror();
272−}
273−
274256 int
275257 so_gethostbyname(char *host, char**hostv, int n)
276258 {
@@ -334,13 +316,13 @@ so_getservbyname(char *service, char *net, char *port) · 57 unmodified lines
334316 }
335317
336318 int
337−so_hangup(int fd, int linger)
319+so_hangup(int fd, int nolinger)
338320 {
339321 int r;
340− static struct linger l = {1, 1000};
322+ static struct linger l = {1, 0};
341323
342324 osenter();
343− if(linger)
325+ if(nolinger)
344326 setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
345327 r = shutdown(fd, 2);
346328 if(r >= 0)
emu/Nt/ipif.c+3−21
@@ -290,24 +290,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 289 unmodified lines
290290 oserror();
291291 }
292292
293−void
294−so_setsockopt(int fd, int opt, int value)
295−{
296− int r;
297− struct linger l;
298−
299− if(opt == SO_LINGER){
300− l.l_onoff = 1;
301− l.l_linger = (short) value;
302− osenter();
303− r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
304− osleave();
305− }else
306− error(Ebadctl);
307− if(r < 0)
308− oserror();
309−}
310−
311293 int
312294 so_gethostbyname(char *host, char**hostv, int n)
313295 {
@@ -370,13 +352,13 @@ so_getservbyname(char *service, char *net, char *port) · 56 unmodified lines
370352 }
371353
372354 int
373−so_hangup(int fd, int linger)
355+so_hangup(int fd, int nolinger)
374356 {
375357 int r;
376− static struct linger l = {1, 1000};
358+ static struct linger l = {1, 0};
377359
378360 osenter();
379− if(linger)
361+ if(nolinger)
380362 setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
381363 r = closesocket(fd);
382364 osleave();
emu/OpenBSD/ipif.c+3−21
@@ -253,24 +253,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 252 unmodified lines
253253 oserror();
254254 }
255255
256−void
257−so_setsockopt(int fd, int opt, int value)
258−{
259− int r;
260− struct linger l;
261−
262− if(opt == SO_LINGER){
263− l.l_onoff = 1;
264− l.l_linger = (short) value;
265− osenter();
266− r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
267− osleave();
268− }else
269− error(Ebadctl);
270− if(r < 0)
271− oserror();
272−}
273−
274256 int
275257 so_gethostbyname(char *host, char**hostv, int n)
276258 {
@@ -334,13 +316,13 @@ so_getservbyname(char *service, char *net, char *port) · 57 unmodified lines
334316 }
335317
336318 int
337−so_hangup(int fd, int linger)
319+so_hangup(int fd, int nolinger)
338320 {
339321 int r;
340− static struct linger l = {1, 1000};
322+ static struct linger l = {1, 0};
341323
342324 osenter();
343− if(linger)
325+ if(nolinger)
344326 setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
345327 r = shutdown(fd, 2);
346328 if(r >= 0)
emu/port/devip.c+14−12
@@ -148,7 +148,7 @@ ip3gen(Chan *c, int i, Dir *dp) · 147 unmodified lines
148148 Conv *cv;
149149 char *p;
150150
151− cv = ipfs[c->dev]->p[PROTO(c->qid)]->conv[CONV(c->qid)];
151+ cv = ipfs[c->devno]->p[PROTO(c->qid)]->conv[CONV(c->qid)];
152152 if(cv->owner == nil)
153153 kstrdup(&cv->owner, eve);
154154 mkqid(&q, QID(PROTO(c->qid), CONV(c->qid), i), 0, QTFILE);
@@ -207,7 +207,7 @@ ip1gen(Chan *c, int i, Dir *dp) · 52 unmodified lines
207207 Fs *f;
208208 extern ulong kerndate;
209209
210− f = ipfs[c->dev];
210+ f = ipfs[c->devno];
211211
212212 prot = 0664;
213213 mkqid(&q, QID(0, 0, i), 0, QTFILE);
@@ -219,7 +219,7 @@ ip1gen(Chan *c, int i, Dir *dp) · 5 unmodified lines
219219 break;
220220 case Qndb:
221221 p = "ndb";
222− len = strlen(ipfs[c->dev]->ndb);
222+ len = strlen(ipfs[c->devno]->ndb);
223223 break;
224224 /* case Qiproute:
225225 p = "iproute";
@@ -252,13 +252,13 @@ ipgen(Chan *c, char *name, Dirtab *tab, int x, int s, Dir *dp) · 26 unmodified lines
252252 USED(name);
253253 USED(tab);
254254 USED(x);
255− f = ipfs[c->dev];
255+ f = ipfs[c->devno];
256256
257257 switch(TYPE(c->qid)) {
258258 case Qtopdir:
259259 if(s == DEVDOTDOT){
260260 mkqid(&q, QID(0, 0, Qtopdir), 0, QTDIR);
261− sprint(up->genbuf, "#I%lud", c->dev);
261+ sprint(up->genbuf, "#I%ud", c->devno);
262262 devdir(c, q, up->genbuf, 0, network, 0555, dp);
263263 return 1;
264264 }
@@ -280,7 +280,7 @@ ipgen(Chan *c, char *name, Dirtab *tab, int x, int s, Dir *dp) · 15 unmodified lines
280280 case Qprotodir:
281281 if(s == DEVDOTDOT){
282282 mkqid(&q, QID(0, 0, Qtopdir), 0, QTDIR);
283− sprint(up->genbuf, "#I%lud", c->dev);
283+ sprint(up->genbuf, "#I%ud", c->devno);
284284 devdir(c, q, up->genbuf, 0, network, 0555, dp);
285285 return 1;
286286 }
@@ -356,7 +356,7 @@ ipattach(char *spec) · 69 unmodified lines
356356
357357 c = devattach('I', spec);
358358 mkqid(&c->qid, QID(0, 0, Qtopdir), 0, QTDIR);
359− c->dev = 0;
359+ c->devno = 0;
360360
361361 return c;
362362 }
@@ -391,7 +391,7 @@ ipopen(Chan *c, int omode) · 28 unmodified lines
391391
392392 perm = m2p[omode&3];
393393
394− f = ipfs[c->dev];
394+ f = ipfs[c->devno];
395395
396396 switch(TYPE(c->qid)) {
397397 default:
@@ -526,7 +526,7 @@ ipclose(Chan *c) · 128 unmodified lines
526526 {
527527 Fs *f;
528528
529− f = ipfs[c->dev];
529+ f = ipfs[c->devno];
530530 switch(TYPE(c->qid)) {
531531 case Qdata:
532532 case Qctl:
@@ -546,7 +546,7 @@ ipread(Chan *ch, void *a, long n, vlong off) · 13 unmodified lines
546546 Fs *f;
547547 ulong offset = off;
548548
549− f = ipfs[ch->dev];
549+ f = ipfs[ch->devno];
550550
551551 p = a;
552552 switch(TYPE(ch->qid)) {
@@ -816,7 +816,7 @@ ipwrite(Chan *ch, void *a, long n, vlong off) · 263 unmodified lines
816816 Cmdbuf *cb;
817817 Fs *f;
818818
819− f = ipfs[ch->dev];
819+ f = ipfs[ch->devno];
820820
821821 switch(TYPE(ch->qid)) {
822822 default:
@@ -932,7 +932,7 @@ ipwstat(Chan *c, uchar *dp, int n) · 109 unmodified lines
932932 Proto *p;
933933 Fs *f;
934934
935− f = ipfs[c->dev];
935+ f = ipfs[c->devno];
936936 switch(TYPE(c->qid)) {
937937 default:
938938 error(Eperm);
@@ -1071,7 +1071,9 @@ Dev ipdevtab = { · 132 unmodified lines
10711071 'I',
10721072 "ip",
10731073
1074+ devreset,
10741075 ipinit,
1076+ devshutdown,
10751077 ipattach,
10761078 ipwalk,
10771079 ipstat,
emu/port/ipif-posix.c+3−21
@@ -261,24 +261,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 260 unmodified lines
261261 oserror();
262262 }
263263
264−void
265−so_setsockopt(int fd, int opt, int value)
266−{
267− int r;
268− struct linger l;
269−
270− if(opt == SO_LINGER){
271− l.l_onoff = 1;
272− l.l_linger = (short) value;
273− osenter();
274− r = setsockopt(fd, SOL_SOCKET, opt, (char *)&l, sizeof(l));
275− osleave();
276− }else
277− error(Ebadctl);
278− if(r < 0)
279− oserror();
280−}
281−
282264 int
283265 so_gethostbyname(char *host, char**hostv, int n)
284266 {
@@ -341,13 +323,13 @@ so_getservbyname(char *service, char *net, char *port) · 56 unmodified lines
341323 }
342324
343325 int
344−so_hangup(int fd, int linger)
326+so_hangup(int fd, int nolinger)
345327 {
346328 int r;
347− static struct linger l = {1, 1000};
329+ static struct linger l = {1, 0};
348330
349331 osenter();
350− if(linger)
332+ if(nolinger)
351333 setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l));
352334 r = shutdown(fd, 2);
353335 if(r >= 0)
include/version.h+1−1
@@ -1 +1 @@
1−#define VERSION "Fourth Edition (20090928)"
1+#define VERSION "Fourth Edition (20090930)"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t