summaryrefslogtreecommitdiffstats
path: root/sys/dev/streams
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-02-07 18:22:20 +0000
committerjhb <jhb@FreeBSD.org>2005-02-07 18:22:20 +0000
commit96fc58f2b29aba17286a254011aa314e647abfa4 (patch)
treeb927f758f78297ea2aa11bda4b09295f70e21648 /sys/dev/streams
parent685dd13b54edac88c20ac81591b99b1af9111e06 (diff)
downloadFreeBSD-src-96fc58f2b29aba17286a254011aa314e647abfa4.zip
FreeBSD-src-96fc58f2b29aba17286a254011aa314e647abfa4.tar.gz
Use kern_open() directly rather than a stackgap detour via open().
Diffstat (limited to 'sys/dev/streams')
-rw-r--r--sys/dev/streams/streams.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c
index 0a15c86..65fd83a 100644
--- a/sys/dev/streams/streams.c
+++ b/sys/dev/streams/streams.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/socket.h>
#include <sys/protosw.h>
#include <sys/socketvar.h>
+#include <sys/syscallsubr.h>
#include <sys/un.h>
#include <sys/domain.h>
#include <net/if.h>
@@ -289,7 +290,6 @@ static int
svr4_ptm_alloc(td)
struct thread *td;
{
- struct proc *p = td->td_proc;
/*
* XXX this is very, very ugly. But I can't find a better
* way that won't duplicate a big amount of code from
@@ -306,25 +306,20 @@ svr4_ptm_alloc(td)
static char ptyname[] = "/dev/ptyXX";
static char ttyletters[] = "pqrstuwxyzPQRST";
static char ttynumbers[] = "0123456789abcdef";
- caddr_t sg = stackgap_init();
- char *path = stackgap_alloc(&sg, sizeof(ptyname));
- struct open_args oa;
- int l = 0, n = 0;
- register_t fd = -1;
- int error;
-
- oa.path = path;
- oa.flags = O_RDWR;
- oa.mode = 0;
+ struct proc *p;
+ register_t fd;
+ int error, l, n;
+ fd = -1;
+ n = 0;
+ l = 0;
+ p = td->td_proc;
while (fd == -1) {
ptyname[8] = ttyletters[l];
ptyname[9] = ttynumbers[n];
- if ((error = copyout(ptyname, path, sizeof(ptyname))) != 0)
- return error;
-
- switch (error = open(td, &oa)) {
+ error = kern_open(td, ptyname, UIO_SYSSPACE, O_RDWR, 0);
+ switch (error) {
case ENOENT:
case ENXIO:
return error;
OpenPOWER on IntegriCloud