Date: Tue, 27 Jun 2006 21:39:49 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100175 for review Message-ID: <200606272139.k5RLdnkG007741@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100175 Change 100175 by jhb@jhb_mutex on 2006/06/27 21:39:30 Use kern_bind(). Affected files ... .. //depot/projects/smpng/sys/compat/svr4/svr4_stream.c#28 edit Differences ... ==== //depot/projects/smpng/sys/compat/svr4/svr4_stream.c#28 (text+ko) ==== @@ -989,8 +989,7 @@ struct svr4_strm *st = svr4_stream_get(fp); struct sockaddr_in sain; struct sockaddr_un saun; - caddr_t sg; - void *skp, *sup = NULL; + struct sockaddr *skp; int sasize; struct svr4_strmcmd bnd; struct bind_args ba; @@ -1017,7 +1016,7 @@ sasize = sizeof(sain); if (bnd.offs == 0) - goto reply; + goto error; netaddr_to_sockaddr_in(&sain, &bnd); @@ -1030,12 +1029,12 @@ skp = &saun; sasize = sizeof(saun); if (bnd.offs == 0) - goto reply; + goto error; netaddr_to_sockaddr_un(&saun, &bnd); if (saun.sun_path[0] == '\0') - goto reply; + goto error; DPRINTF(("TI_BIND: fam %d, path %s\n", saun.sun_family, saun.sun_path)); @@ -1052,29 +1051,20 @@ return ENOSYS; } - sg = stackgap_init(); - sup = stackgap_alloc(&sg, sasize); - - if ((error = copyout(skp, sup, sasize)) != 0) - return error; - - ba.s = fd; DPRINTF(("TI_BIND: fileno %d\n", fd)); - ba.name = (void *) sup; - ba.namelen = sasize; - if ((error = bind(td, &ba)) != 0) { + if ((error = kern_bind(td, fd, skp)) != 0) { DPRINTF(("TI_BIND: bind failed %d\n", error)); return error; } + goto reply; + +error: + memset(&bnd, 0, sizeof(bnd)); + bnd.len = sasize + 4; + bnd.offs = 0x10; /* XXX */ reply: - if (sup == NULL) { - memset(&bnd, 0, sizeof(bnd)); - bnd.len = sasize + 4; - bnd.offs = 0x10; /* XXX */ - } - bnd.cmd = SVR4_TI_BIND_REPLY; if ((error = copyout(&bnd, ioc->buf, ioc->len)) != 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606272139.k5RLdnkG007741>