Convert dev_t for mknod
This commit is contained in:
parent
08fc9c3284
commit
bfc0bb09ef
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: darwin_stat.c,v 1.1 2003/09/06 11:18:03 manu Exp $ */
|
||||
/* $NetBSD: darwin_stat.c,v 1.2 2003/09/06 11:50:00 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_stat.c,v 1.1 2003/09/06 11:18:03 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_stat.c,v 1.2 2003/09/06 11:50:00 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -53,10 +53,9 @@ __KERNEL_RCSID(0, "$NetBSD: darwin_stat.c,v 1.1 2003/09/06 11:18:03 manu Exp $")
|
|||
#include <compat/mach/mach_types.h>
|
||||
#include <compat/mach/mach_vm.h>
|
||||
|
||||
#include <compat/darwin/darwin_types.h>
|
||||
#include <compat/darwin/darwin_syscallargs.h>
|
||||
|
||||
#define native_to_darwin_dev(x) ((dev_t)(((major(x)) << 24) | minor((x))))
|
||||
|
||||
int
|
||||
darwin_sys_stat(l, v, retval)
|
||||
struct lwp *l;
|
||||
|
@ -170,3 +169,26 @@ darwin_sys_lstat(l, v, retval)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
darwin_sys_mknod(l, v, retval)
|
||||
struct lwp *l;
|
||||
void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
struct darwin_sys_mknod_args /* {
|
||||
syscallarg(char) path;
|
||||
syscallarg(mode_t) mode;
|
||||
syscallarg(dev_t) dev:
|
||||
} */ *uap = v;
|
||||
struct sys_mknod_args cup;
|
||||
struct proc *p = l->l_proc;
|
||||
caddr_t sg = stackgap_init(p, 0);
|
||||
|
||||
CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
|
||||
|
||||
SCARG(&cup, path) = SCARG(uap, path);
|
||||
SCARG(&cup, mode) = SCARG(uap, mode);
|
||||
SCARG(&cup, dev) = darwin_to_native_dev(SCARG(uap, dev));
|
||||
|
||||
return sys_mknod(l, &cup, retval);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: darwin_syscall.h,v 1.31 2003/09/06 11:18:51 manu Exp $ */
|
||||
/* $NetBSD: darwin_syscall.h,v 1.32 2003/09/06 11:50:01 manu Exp $ */
|
||||
|
||||
/*
|
||||
* System call numbers.
|
||||
|
@ -31,6 +31,9 @@
|
|||
/* syscall: "fchdir" ret: "int" args: "int" */
|
||||
#define DARWIN_SYS_fchdir 13
|
||||
|
||||
/* syscall: "mknod" ret: "int" args: "const char *" "mode_t" "dev_t" */
|
||||
#define DARWIN_SYS_mknod 14
|
||||
|
||||
/* syscall: "break" ret: "int" args: "char *" */
|
||||
#define DARWIN_SYS_break 17
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: darwin_syscallargs.h,v 1.31 2003/09/06 11:18:51 manu Exp $ */
|
||||
/* $NetBSD: darwin_syscallargs.h,v 1.32 2003/09/06 11:50:01 manu Exp $ */
|
||||
|
||||
/*
|
||||
* System call argument lists.
|
||||
|
@ -51,7 +51,7 @@ struct bsd_sys_chdir_args {
|
|||
syscallarg(const char *) path;
|
||||
};
|
||||
|
||||
struct bsd_sys_mknod_args {
|
||||
struct darwin_sys_mknod_args {
|
||||
syscallarg(const char *) path;
|
||||
syscallarg(mode_t) mode;
|
||||
syscallarg(dev_t) dev;
|
||||
|
@ -281,7 +281,7 @@ int bsd_sys_link(struct lwp *, void *, register_t *);
|
|||
int bsd_sys_unlink(struct lwp *, void *, register_t *);
|
||||
int bsd_sys_chdir(struct lwp *, void *, register_t *);
|
||||
int sys_fchdir(struct lwp *, void *, register_t *);
|
||||
int bsd_sys_mknod(struct lwp *, void *, register_t *);
|
||||
int darwin_sys_mknod(struct lwp *, void *, register_t *);
|
||||
int bsd_sys_chmod(struct lwp *, void *, register_t *);
|
||||
int bsd_sys_chown(struct lwp *, void *, register_t *);
|
||||
int sys_obreak(struct lwp *, void *, register_t *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: darwin_syscalls.c,v 1.31 2003/09/06 11:18:50 manu Exp $ */
|
||||
/* $NetBSD: darwin_syscalls.c,v 1.32 2003/09/06 11:50:01 manu Exp $ */
|
||||
|
||||
/*
|
||||
* System call names.
|
||||
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_syscalls.c,v 1.31 2003/09/06 11:18:50 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_syscalls.c,v 1.32 2003/09/06 11:50:01 manu Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ktrace.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: darwin_sysent.c,v 1.32 2003/09/06 11:18:51 manu Exp $ */
|
||||
/* $NetBSD: darwin_sysent.c,v 1.33 2003/09/06 11:50:01 manu Exp $ */
|
||||
|
||||
/*
|
||||
* System call switch table.
|
||||
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_sysent.c,v 1.32 2003/09/06 11:18:51 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_sysent.c,v 1.33 2003/09/06 11:50:01 manu Exp $");
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
#include "opt_nfsserver.h"
|
||||
|
@ -61,8 +61,8 @@ struct sysent darwin_sysent[] = {
|
|||
bsd_sys_chdir }, /* 12 = chdir */
|
||||
{ 1, s(struct sys_fchdir_args), 0,
|
||||
sys_fchdir }, /* 13 = fchdir */
|
||||
{ 3, s(struct bsd_sys_mknod_args), 0,
|
||||
bsd_sys_mknod }, /* 14 = mknod */
|
||||
{ 3, s(struct darwin_sys_mknod_args), 0,
|
||||
darwin_sys_mknod }, /* 14 = mknod */
|
||||
{ 2, s(struct bsd_sys_chmod_args), 0,
|
||||
bsd_sys_chmod }, /* 15 = chmod */
|
||||
{ 3, s(struct bsd_sys_chown_args), 0,
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* $NetBSD: darwin_types.h,v 1.1 2003/09/06 11:50:00 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Emmanuel Dreyfus
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _DARWIN_TYPES_H_
|
||||
#define _DARWIN_TYPES_H_
|
||||
|
||||
#define darwin_major(x) ((int32_t)(((u_int32_t)(x) >> 24) & 0xff))
|
||||
#define darwin_minor(x) ((int32_t)((x) & 0xffffff))
|
||||
#define darwin_makedev(x,y) ((dev_t)(((x) << 24) | (y)))
|
||||
#define native_to_darwin_dev(x) darwin_makedev(major(x),minor(x))
|
||||
#define darwin_to_native_dev(x) makedev(darwin_major(x),darwin_minor(x))
|
||||
|
||||
#endif /* _DARWIN_TYPES_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: syscalls.master,v 1.16 2003/09/06 11:18:03 manu Exp $
|
||||
$NetBSD: syscalls.master,v 1.17 2003/09/06 11:50:02 manu Exp $
|
||||
|
||||
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
|
||||
|
||||
|
@ -83,7 +83,7 @@
|
|||
11 UNIMPL execv
|
||||
12 NODEF { int bsd_sys_chdir(const char *path); }
|
||||
13 NOARGS { int sys_fchdir(int fd); }
|
||||
14 NODEF { int bsd_sys_mknod(const char *path, \
|
||||
14 STD { int darwin_sys_mknod(const char *path, \
|
||||
mode_t mode, dev_t dev); }
|
||||
15 NODEF { int bsd_sys_chmod(const char *path, mode_t mode); }
|
||||
16 NODEF { int bsd_sys_chown(const char *path, uid_t uid, \
|
||||
|
|
Loading…
Reference in New Issue