summaryrefslogtreecommitdiffstats
path: root/sys/i386/ibcs2/ibcs2_fcntl.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-02-07 22:02:18 +0000
committerjhb <jhb@FreeBSD.org>2005-02-07 22:02:18 +0000
commit4a479b242427dd7291f1456f605ae37513c1ceaf (patch)
tree5d16fdc572b765e011ca89f203e7653f1ba5a0a8 /sys/i386/ibcs2/ibcs2_fcntl.c
parentb03a8bb21b2ea1fa1d440565c2ee55a7391e1c18 (diff)
downloadFreeBSD-src-4a479b242427dd7291f1456f605ae37513c1ceaf.zip
FreeBSD-src-4a479b242427dd7291f1456f605ae37513c1ceaf.tar.gz
- Implement ibcs2_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel pointer rather than a user space pointer. This required changing the arguments to the CHECKALT*() macros some and changing the various system calls that used pathnames to use the kern_foo() functions that can accept kernel space filename pointers instead of calling the system call directly. - Use kern_open(), kern_access(), kern_execve(), kern_mkfifo(), kern_mknod(), kern_setitimer(), kern_getrusage(), kern_utimes(), kern_unlink(), kern_chdir(), kern_chmod(), kern_chown(), kern_symlink(), kern_readlink(), kern_select(), kern_statfs(), kern_fstatfs(), kern_stat(), kern_lstat(), kern_fstat(). - Drop the unused 'uap' argument from spx_open(). - Replace a stale duplication of vn_access() in xenix_access() lacking recent additions such as MAC checks, etc. with a call to kern_access().
Diffstat (limited to 'sys/i386/ibcs2/ibcs2_fcntl.c')
-rw-r--r--sys/i386/ibcs2/ibcs2_fcntl.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/sys/i386/ibcs2/ibcs2_fcntl.c b/sys/i386/ibcs2/ibcs2_fcntl.c
index 1b02fbc..fcdc714 100644
--- a/sys/i386/ibcs2/ibcs2_fcntl.c
+++ b/sys/i386/ibcs2/ibcs2_fcntl.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
@@ -175,24 +176,27 @@ ibcs2_open(td, uap)
struct thread *td;
struct ibcs2_open_args *uap;
{
- struct proc *p = td->td_proc;
- int noctty = uap->flags & IBCS2_O_NOCTTY;
- int ret;
- caddr_t sg = stackgap_init();
+ struct proc *p;
+ char *path;
+ int flags, noctty, ret;
- uap->flags = cvt_o_flags(uap->flags);
+ p = td->td_proc;
+ noctty = uap->flags & IBCS2_O_NOCTTY;
+ flags = cvt_o_flags(uap->flags);
if (uap->flags & O_CREAT)
- CHECKALTCREAT(td, &sg, uap->path);
+ CHECKALTCREAT(td, uap->path, &path);
else
- CHECKALTEXIST(td, &sg, uap->path);
- ret = open(td, (struct open_args *)uap);
+ CHECKALTEXIST(td, uap->path, &path);
+ ret = kern_open(td, path, UIO_SYSSPACE, flags, uap->mode);
#ifdef SPX_HACK
if (ret == ENXIO) {
- if (!strcmp(uap->path, "/compat/ibcs2/dev/spx"))
- ret = spx_open(td, uap);
+ if (!strcmp(path, "/compat/ibcs2/dev/spx"))
+ ret = spx_open(td);
+ free(path, M_TEMP);
} else
#endif /* SPX_HACK */
+ free(path, M_TEMP);
PROC_LOCK(p);
if (!ret && !noctty && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
struct file *fp;
@@ -217,15 +221,15 @@ int
ibcs2_creat(td, uap)
struct thread *td;
struct ibcs2_creat_args *uap;
-{
- struct open_args cup;
- caddr_t sg = stackgap_init();
+{
+ char *path;
+ int error;
- CHECKALTCREAT(td, &sg, uap->path);
- cup.path = uap->path;
- cup.mode = uap->mode;
- cup.flags = O_WRONLY | O_CREAT | O_TRUNC;
- return open(td, &cup);
+ CHECKALTCREAT(td, uap->path, &path);
+ error = kern_open(td, path, UIO_SYSSPACE, O_WRONLY | O_CREAT | O_TRUNC,
+ uap->mode);
+ free(path, M_TEMP);
+ return (error);
}
int
@@ -233,13 +237,13 @@ ibcs2_access(td, uap)
struct thread *td;
struct ibcs2_access_args *uap;
{
- struct access_args cup;
- caddr_t sg = stackgap_init();
+ char *path;
+ int error;
- CHECKALTEXIST(td, &sg, uap->path);
- cup.path = uap->path;
- cup.flags = uap->flags;
- return access(td, &cup);
+ CHECKALTEXIST(td, uap->path, &path);
+ error = kern_access(td, path, UIO_SYSSPACE, uap->flags);
+ free(path, M_TEMP);
+ return (error);
}
int
OpenPOWER on IntegriCloud