Unified · Split
| @@ -1,3 +1,5 @@ | ||
| 1 | +20090930 | |
| 2 | + emu/*/ipif*.c make "hangup" act as in native Inferno; also delete unused so_setsockopt | |
| 1 | 3 | 20090928 |
| 2 | 4 | update import(4) to remove the restriction to Plan 9 (can use Inferno's own factotum) |
| 3 | 5 | (emu os)^/port/devmnt.c fix from plan 9 (don't access vanished data) |
| @@ -253,24 +253,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 252 unmodified lines | ||
| 253 | 253 | oserror(); |
| 254 | 254 | } |
| 255 | 255 | |
| 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 | − | |
| 274 | 256 | int |
| 275 | 257 | so_gethostbyname(char *host, char**hostv, int n) |
| 276 | 258 | { |
| @@ -334,13 +316,13 @@ so_getservbyname(char *service, char *net, char *port) · 57 unmodified lines | ||
| 334 | 316 | } |
| 335 | 317 | |
| 336 | 318 | int |
| 337 | −so_hangup(int fd, int linger) | |
| 319 | +so_hangup(int fd, int nolinger) | |
| 338 | 320 | { |
| 339 | 321 | int r; |
| 340 | − static struct linger l = {1, 1000}; | |
| 322 | + static struct linger l = {1, 0}; | |
| 341 | 323 | |
| 342 | 324 | osenter(); |
| 343 | − if(linger) | |
| 325 | + if(nolinger) | |
| 344 | 326 | setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l)); |
| 345 | 327 | r = shutdown(fd, 2); |
| 346 | 328 | if(r >= 0) |
| @@ -253,24 +253,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 252 unmodified lines | ||
| 253 | 253 | oserror(); |
| 254 | 254 | } |
| 255 | 255 | |
| 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 | − | |
| 274 | 256 | int |
| 275 | 257 | so_gethostbyname(char *host, char**hostv, int n) |
| 276 | 258 | { |
| @@ -334,13 +316,13 @@ so_getservbyname(char *service, char *net, char *port) · 57 unmodified lines | ||
| 334 | 316 | } |
| 335 | 317 | |
| 336 | 318 | int |
| 337 | −so_hangup(int fd, int linger) | |
| 319 | +so_hangup(int fd, int nolinger) | |
| 338 | 320 | { |
| 339 | 321 | int r; |
| 340 | − static struct linger l = {1, 1000}; | |
| 322 | + static struct linger l = {1, 0}; | |
| 341 | 323 | |
| 342 | 324 | osenter(); |
| 343 | − if(linger) | |
| 325 | + if(nolinger) | |
| 344 | 326 | setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l)); |
| 345 | 327 | r = shutdown(fd, 2); |
| 346 | 328 | if(r >= 0) |
| @@ -290,24 +290,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 289 unmodified lines | ||
| 290 | 290 | oserror(); |
| 291 | 291 | } |
| 292 | 292 | |
| 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 | − | |
| 311 | 293 | int |
| 312 | 294 | so_gethostbyname(char *host, char**hostv, int n) |
| 313 | 295 | { |
| @@ -370,13 +352,13 @@ so_getservbyname(char *service, char *net, char *port) · 56 unmodified lines | ||
| 370 | 352 | } |
| 371 | 353 | |
| 372 | 354 | int |
| 373 | −so_hangup(int fd, int linger) | |
| 355 | +so_hangup(int fd, int nolinger) | |
| 374 | 356 | { |
| 375 | 357 | int r; |
| 376 | − static struct linger l = {1, 1000}; | |
| 358 | + static struct linger l = {1, 0}; | |
| 377 | 359 | |
| 378 | 360 | osenter(); |
| 379 | − if(linger) | |
| 361 | + if(nolinger) | |
| 380 | 362 | setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l)); |
| 381 | 363 | r = closesocket(fd); |
| 382 | 364 | osleave(); |
| @@ -253,24 +253,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 252 unmodified lines | ||
| 253 | 253 | oserror(); |
| 254 | 254 | } |
| 255 | 255 | |
| 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 | − | |
| 274 | 256 | int |
| 275 | 257 | so_gethostbyname(char *host, char**hostv, int n) |
| 276 | 258 | { |
| @@ -334,13 +316,13 @@ so_getservbyname(char *service, char *net, char *port) · 57 unmodified lines | ||
| 334 | 316 | } |
| 335 | 317 | |
| 336 | 318 | int |
| 337 | −so_hangup(int fd, int linger) | |
| 319 | +so_hangup(int fd, int nolinger) | |
| 338 | 320 | { |
| 339 | 321 | int r; |
| 340 | − static struct linger l = {1, 1000}; | |
| 322 | + static struct linger l = {1, 0}; | |
| 341 | 323 | |
| 342 | 324 | osenter(); |
| 343 | − if(linger) | |
| 325 | + if(nolinger) | |
| 344 | 326 | setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l)); |
| 345 | 327 | r = shutdown(fd, 2); |
| 346 | 328 | if(r >= 0) |
| @@ -148,7 +148,7 @@ ip3gen(Chan *c, int i, Dir *dp) · 147 unmodified lines | ||
| 148 | 148 | Conv *cv; |
| 149 | 149 | char *p; |
| 150 | 150 | |
| 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)]; | |
| 152 | 152 | if(cv->owner == nil) |
| 153 | 153 | kstrdup(&cv->owner, eve); |
| 154 | 154 | 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 | ||
| 207 | 207 | Fs *f; |
| 208 | 208 | extern ulong kerndate; |
| 209 | 209 | |
| 210 | − f = ipfs[c->dev]; | |
| 210 | + f = ipfs[c->devno]; | |
| 211 | 211 | |
| 212 | 212 | prot = 0664; |
| 213 | 213 | mkqid(&q, QID(0, 0, i), 0, QTFILE); |
| @@ -219,7 +219,7 @@ ip1gen(Chan *c, int i, Dir *dp) · 5 unmodified lines | ||
| 219 | 219 | break; |
| 220 | 220 | case Qndb: |
| 221 | 221 | p = "ndb"; |
| 222 | − len = strlen(ipfs[c->dev]->ndb); | |
| 222 | + len = strlen(ipfs[c->devno]->ndb); | |
| 223 | 223 | break; |
| 224 | 224 | /* case Qiproute: |
| 225 | 225 | p = "iproute"; |
| @@ -252,13 +252,13 @@ ipgen(Chan *c, char *name, Dirtab *tab, int x, int s, Dir *dp) · 26 unmodified lines | ||
| 252 | 252 | USED(name); |
| 253 | 253 | USED(tab); |
| 254 | 254 | USED(x); |
| 255 | − f = ipfs[c->dev]; | |
| 255 | + f = ipfs[c->devno]; | |
| 256 | 256 | |
| 257 | 257 | switch(TYPE(c->qid)) { |
| 258 | 258 | case Qtopdir: |
| 259 | 259 | if(s == DEVDOTDOT){ |
| 260 | 260 | mkqid(&q, QID(0, 0, Qtopdir), 0, QTDIR); |
| 261 | − sprint(up->genbuf, "#I%lud", c->dev); | |
| 261 | + sprint(up->genbuf, "#I%ud", c->devno); | |
| 262 | 262 | devdir(c, q, up->genbuf, 0, network, 0555, dp); |
| 263 | 263 | return 1; |
| 264 | 264 | } |
| @@ -280,7 +280,7 @@ ipgen(Chan *c, char *name, Dirtab *tab, int x, int s, Dir *dp) · 15 unmodified lines | ||
| 280 | 280 | case Qprotodir: |
| 281 | 281 | if(s == DEVDOTDOT){ |
| 282 | 282 | mkqid(&q, QID(0, 0, Qtopdir), 0, QTDIR); |
| 283 | − sprint(up->genbuf, "#I%lud", c->dev); | |
| 283 | + sprint(up->genbuf, "#I%ud", c->devno); | |
| 284 | 284 | devdir(c, q, up->genbuf, 0, network, 0555, dp); |
| 285 | 285 | return 1; |
| 286 | 286 | } |
| @@ -356,7 +356,7 @@ ipattach(char *spec) · 69 unmodified lines | ||
| 356 | 356 | |
| 357 | 357 | c = devattach('I', spec); |
| 358 | 358 | mkqid(&c->qid, QID(0, 0, Qtopdir), 0, QTDIR); |
| 359 | − c->dev = 0; | |
| 359 | + c->devno = 0; | |
| 360 | 360 | |
| 361 | 361 | return c; |
| 362 | 362 | } |
| @@ -391,7 +391,7 @@ ipopen(Chan *c, int omode) · 28 unmodified lines | ||
| 391 | 391 | |
| 392 | 392 | perm = m2p[omode&3]; |
| 393 | 393 | |
| 394 | − f = ipfs[c->dev]; | |
| 394 | + f = ipfs[c->devno]; | |
| 395 | 395 | |
| 396 | 396 | switch(TYPE(c->qid)) { |
| 397 | 397 | default: |
| @@ -526,7 +526,7 @@ ipclose(Chan *c) · 128 unmodified lines | ||
| 526 | 526 | { |
| 527 | 527 | Fs *f; |
| 528 | 528 | |
| 529 | − f = ipfs[c->dev]; | |
| 529 | + f = ipfs[c->devno]; | |
| 530 | 530 | switch(TYPE(c->qid)) { |
| 531 | 531 | case Qdata: |
| 532 | 532 | case Qctl: |
| @@ -546,7 +546,7 @@ ipread(Chan *ch, void *a, long n, vlong off) · 13 unmodified lines | ||
| 546 | 546 | Fs *f; |
| 547 | 547 | ulong offset = off; |
| 548 | 548 | |
| 549 | − f = ipfs[ch->dev]; | |
| 549 | + f = ipfs[ch->devno]; | |
| 550 | 550 | |
| 551 | 551 | p = a; |
| 552 | 552 | switch(TYPE(ch->qid)) { |
| @@ -816,7 +816,7 @@ ipwrite(Chan *ch, void *a, long n, vlong off) · 263 unmodified lines | ||
| 816 | 816 | Cmdbuf *cb; |
| 817 | 817 | Fs *f; |
| 818 | 818 | |
| 819 | − f = ipfs[ch->dev]; | |
| 819 | + f = ipfs[ch->devno]; | |
| 820 | 820 | |
| 821 | 821 | switch(TYPE(ch->qid)) { |
| 822 | 822 | default: |
| @@ -932,7 +932,7 @@ ipwstat(Chan *c, uchar *dp, int n) · 109 unmodified lines | ||
| 932 | 932 | Proto *p; |
| 933 | 933 | Fs *f; |
| 934 | 934 | |
| 935 | − f = ipfs[c->dev]; | |
| 935 | + f = ipfs[c->devno]; | |
| 936 | 936 | switch(TYPE(c->qid)) { |
| 937 | 937 | default: |
| 938 | 938 | error(Eperm); |
| @@ -1071,7 +1071,9 @@ Dev ipdevtab = { · 132 unmodified lines | ||
| 1071 | 1071 | 'I', |
| 1072 | 1072 | "ip", |
| 1073 | 1073 | |
| 1074 | + devreset, | |
| 1074 | 1075 | ipinit, |
| 1076 | + devshutdown, | |
| 1075 | 1077 | ipattach, |
| 1076 | 1078 | ipwalk, |
| 1077 | 1079 | ipstat, |
| @@ -261,24 +261,6 @@ so_bind(int fd, int su, unsigned long addr, unsigned short port) · 260 unmodified lines | ||
| 261 | 261 | oserror(); |
| 262 | 262 | } |
| 263 | 263 | |
| 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 | − | |
| 282 | 264 | int |
| 283 | 265 | so_gethostbyname(char *host, char**hostv, int n) |
| 284 | 266 | { |
| @@ -341,13 +323,13 @@ so_getservbyname(char *service, char *net, char *port) · 56 unmodified lines | ||
| 341 | 323 | } |
| 342 | 324 | |
| 343 | 325 | int |
| 344 | −so_hangup(int fd, int linger) | |
| 326 | +so_hangup(int fd, int nolinger) | |
| 345 | 327 | { |
| 346 | 328 | int r; |
| 347 | − static struct linger l = {1, 1000}; | |
| 329 | + static struct linger l = {1, 0}; | |
| 348 | 330 | |
| 349 | 331 | osenter(); |
| 350 | − if(linger) | |
| 332 | + if(nolinger) | |
| 351 | 333 | setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l)); |
| 352 | 334 | r = shutdown(fd, 2); |
| 353 | 335 | if(r >= 0) |
| @@ -1 +1 @@ | ||
| 1 | −#define VERSION "Fourth Edition (20090928)" | |
| 1 | +#define VERSION "Fourth Edition (20090930)" | |