implemented enough of getmountid to make commands using IRIX Universal Name

Service happy. Code in libc attempts to open files in the ns filesystem, and
then uses getmountid on failure to ensure that the ns filesystem is really
mounted. We don't emulate the ns filesystem yet, but getmountid now correctly
reports that ns is not present.
Note: It seems that the mountid of the ns filesystem should always be
00000005 00000000 00000000 7fff3000
This commit is contained in:
manu 2001-12-22 14:43:43 +00:00
parent 59c47ef767
commit aa8fce41ef
8 changed files with 137 additions and 17 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.irix,v 1.8 2001/12/08 18:08:04 manu Exp $
# $NetBSD: files.irix,v 1.9 2001/12/22 14:43:43 manu Exp $
#
file arch/mips/mips/irix_syscall.c compat_irix
@ -6,6 +6,7 @@ file arch/mips/mips/irix_syscall.c compat_irix
file compat/irix/irix_errno.c compat_irix
file compat/irix/irix_exec.c compat_irix
file compat/irix/irix_exec_elf32.c compat_irix & exec_elf32
file compat/irix/irix_mount.c compat_irix
file compat/irix/irix_prctl.c compat_irix
file compat/irix/irix_signal.c compat_irix
file compat/irix/irix_stat.c compat_irix

View File

@ -0,0 +1,104 @@
/* $NetBSD: irix_mount.c,v 1.1 2001/12/22 14:43:44 manu Exp $ */
/*-
* Copyright (c) 2001 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.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_mount.c,v 1.1 2001/12/22 14:43:44 manu Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/systm.h>
#include <sys/vnode.h>
#include <sys/vnode_if.h>
#include <compat/common/compat_util.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_syscall.h>
#include <compat/irix/irix_syscallargs.h>
int
irix_sys_getmountid(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
struct irix_sys_getmountid_args /* {
syscallarg(const char *) path;
syscallarg(irix_mountid_t *) buf;
} */ *uap = v;
caddr_t sg = stackgap_init(p->p_emul);
struct ucred *cred = crget();
struct vnode *vp;
int error = 0;
struct nameidata nd;
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
(void)memcpy(cred, p->p_ucred, sizeof(*cred));
cred->cr_ref = 1;
cred->cr_uid = p->p_cred->p_ruid;
cred->cr_gid = p->p_cred->p_rgid;
/* Get the vnode for the requested path */
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
SCARG(uap, path), p);
nd.ni_cnd.cn_cred = cred;
if ((error = namei(&nd)) != 0)
goto out;
vp = nd.ni_vp;
/* Check for accessibility */
if ((error = VOP_ACCESS(vp, VREAD | VEXEC, cred, p)) != 0)
goto bad;
/*
* Return the address of the mount structure
* as the unique ID for the filesystem
*/
error = copyout(&vp->v_mount, SCARG(uap, buf), sizeof(irix_mountid_t));
bad:
vput(vp);
out:
crfree(cred);
return (error);
}

View File

@ -1,10 +1,10 @@
/* $NetBSD: irix_syscall.h,v 1.10 2001/12/22 12:09:20 manu Exp $ */
/* $NetBSD: irix_syscall.h,v 1.11 2001/12/22 14:43:44 manu Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.8 2001/12/08 18:08:04 manu Exp
* created from NetBSD: syscalls.master,v 1.9 2001/12/22 12:09:21 manu Exp
*/
/* syscall: "syscall" ret: "int" args: */
@ -206,5 +206,8 @@
/* syscall: "sigsuspend" ret: "int" args: "const svr4_sigset_t *" */
#define IRIX_SYS_sigsuspend 165
/* syscall: "getmountid" ret: "int" args: "const char *" "irix_mountid_t *" */
#define IRIX_SYS_getmountid 203
#define IRIX_SYS_MAXSYSCALL 226
#define IRIX_SYS_NSYSENT 226

View File

@ -1,10 +1,10 @@
/* $NetBSD: irix_syscallargs.h,v 1.10 2001/12/22 12:09:21 manu Exp $ */
/* $NetBSD: irix_syscallargs.h,v 1.11 2001/12/22 14:43:44 manu Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.8 2001/12/08 18:08:04 manu Exp
* created from NetBSD: syscalls.master,v 1.9 2001/12/22 12:09:21 manu Exp
*/
#ifndef _IRIX_SYS__SYSCALLARGS_H_
@ -236,6 +236,11 @@ struct svr4_sys_sigsuspend_args {
syscallarg(const svr4_sigset_t *) set;
};
struct irix_sys_getmountid_args {
syscallarg(const char *) path;
syscallarg(irix_mountid_t *) buf;
};
/*
* System call prototypes.
*/
@ -311,4 +316,5 @@ int svr4_sys_sigaction(struct proc *, void *, register_t *);
int svr4_sys_sigpending(struct proc *, void *, register_t *);
int svr4_sys_sigprocmask(struct proc *, void *, register_t *);
int svr4_sys_sigsuspend(struct proc *, void *, register_t *);
int irix_sys_getmountid(struct proc *, void *, register_t *);
#endif /* _IRIX_SYS__SYSCALLARGS_H_ */

View File

@ -1,14 +1,14 @@
/* $NetBSD: irix_syscalls.c,v 1.10 2001/12/22 12:09:21 manu Exp $ */
/* $NetBSD: irix_syscalls.c,v 1.11 2001/12/22 14:43:44 manu Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.8 2001/12/08 18:08:04 manu Exp
* created from NetBSD: syscalls.master,v 1.9 2001/12/22 12:09:21 manu Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.10 2001/12/22 12:09:21 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.11 2001/12/22 14:43:44 manu Exp $");
#if defined(_KERNEL_OPT)
#if defined(_KERNEL_OPT)
@ -243,7 +243,7 @@ const char *const irix_syscallnames[] = {
"#200 (unimplemented attr_multif)", /* 200 = unimplemented attr_multif */
"#201 (unimplemented statvfs64)", /* 201 = unimplemented statvfs64 */
"#202 (unimplemented fstatvfs64)", /* 202 = unimplemented fstatvfs64 */
"#203 (unimplemented getmountid)", /* 203 = unimplemented getmountid */
"getmountid", /* 203 = getmountid */
"#204 (unimplemented nsproc)", /* 204 = unimplemented nsproc */
"#205 (unimplemented getdents64)", /* 205 = unimplemented getdents64 */
"#206 (unimplemented dfs_XXX)", /* 206 = unimplemented dfs_XXX */

View File

@ -1,14 +1,14 @@
/* $NetBSD: irix_sysent.c,v 1.10 2001/12/22 12:09:21 manu Exp $ */
/* $NetBSD: irix_sysent.c,v 1.11 2001/12/22 14:43:45 manu Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.8 2001/12/08 18:08:04 manu Exp
* created from NetBSD: syscalls.master,v 1.9 2001/12/22 12:09:21 manu Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.10 2001/12/22 12:09:21 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.11 2001/12/22 14:43:45 manu Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@ -449,8 +449,8 @@ struct sysent irix_sysent[] = {
sys_nosys }, /* 201 = unimplemented statvfs64 */
{ 0, 0, 0,
sys_nosys }, /* 202 = unimplemented fstatvfs64 */
{ 0, 0, 0,
sys_nosys }, /* 203 = unimplemented getmountid */
{ 2, s(struct irix_sys_getmountid_args), 0,
irix_sys_getmountid }, /* 203 = getmountid */
{ 0, 0, 0,
sys_nosys }, /* 204 = unimplemented nsproc */
{ 0, 0, 0,

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_types.h,v 1.5 2001/12/22 12:09:21 manu Exp $ */
/* $NetBSD: irix_types.h,v 1.6 2001/12/22 14:43:45 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -144,4 +144,9 @@ struct irix_stat64 {
long ist_pad4[7];
};
/* From IRIX's <sys/mount.h> */
typedef struct irix_mountid {
unsigned int ival[4];
} irix_mountid_t;
#endif /* _IRIX_TYPES_H_ */

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.9 2001/12/22 12:09:21 manu Exp $
$NetBSD: syscalls.master,v 1.10 2001/12/22 14:43:45 manu Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -293,7 +293,8 @@
200 UNIMPL attr_multif
201 UNIMPL statvfs64
202 UNIMPL fstatvfs64
203 UNIMPL getmountid
203 STD { int irix_sys_getmountid(const char *path, \
irix_mountid_t *buf); }
204 UNIMPL nsproc
205 UNIMPL getdents64
206 UNIMPL dfs_XXX