Date: Wed, 5 Jul 2006 18:10:31 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100645 for review Message-ID: <200607051810.k65IAVuo036456@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100645 Change 100645 by jhb@jhb_mutex on 2006/07/05 18:10:29 Use kern_connect() and axe stackgap usage. Affected files ... .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_other.c#8 edit Differences ... ==== //depot/projects/smpng/sys/i386/ibcs2/ibcs2_other.c#8 (text+ko) ==== @@ -35,7 +35,9 @@ #include <sys/systm.h> #include <sys/lock.h> #include <sys/mutex.h> +#include <sys/syscallsubr.h> #include <sys/sysproto.h> +#include <sys/un.h> #include <i386/ibcs2/ibcs2_types.h> #include <i386/ibcs2/ibcs2_signal.h> @@ -85,10 +87,8 @@ spx_open(struct thread *td) { struct socket_args sock; - struct connect_args conn; - struct sockaddr_un *Xaddr; + struct sockaddr_un sun; int fd, error; - caddr_t sg = stackgap_init(); /* obtain a socket. */ DPRINTF(("SPX: open socket\n")); @@ -98,19 +98,16 @@ error = socket(td, &sock); if (error) return error; + fd = td->td_retval[0]; /* connect the socket to standard X socket */ DPRINTF(("SPX: connect to /tmp/X11-unix/X0\n")); - Xaddr = stackgap_alloc(&sg, sizeof(struct sockaddr_un)); - Xaddr->sun_family = AF_UNIX; - Xaddr->sun_len = sizeof(struct sockaddr_un) - sizeof(Xaddr->sun_path) + - strlen(Xaddr->sun_path) + 1; - copyout("/tmp/.X11-unix/X0", Xaddr->sun_path, 18); + sun.sun_family = AF_UNIX; + strcpy(sun.sun_path, "/tmp/.X11-unix/X0"); + sun.sun_len = sizeof(struct sockaddr_un) - sizeof(sun.sun_path) + + strlen(sun.sun_path) + 1; - conn.s = fd = td->td_retval[0]; - conn.name = (caddr_t)Xaddr; - conn.namelen = sizeof(struct sockaddr_un); - error = connect(td, &conn); + error = kern_connect(td, fd, (struct sockaddr *)&sun); if (error) { struct close_args cl; cl.fd = fd;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607051810.k65IAVuo036456>