bug for bug emulation of IRIX: on some device, including
/dev/usemaclone, fchmod returns 0 on faillure, and libc depends on that behavior.
This commit is contained in:
parent
a9e34d1ccf
commit
83c4aab4e2
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: irix_fcntl.c,v 1.6 2002/04/20 20:38:21 manu Exp $ */
|
||||
/* $NetBSD: irix_fcntl.c,v 1.7 2002/05/04 07:45:07 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
|
||||
@ -37,13 +37,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: irix_fcntl.c,v 1.6 2002/04/20 20:38:21 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: irix_fcntl.c,v 1.7 2002/05/04 07:45:07 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/filedesc.h>
|
||||
@ -51,9 +52,12 @@ __KERNEL_RCSID(0, "$NetBSD: irix_fcntl.c,v 1.6 2002/04/20 20:38:21 manu Exp $");
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
#include <compat/irix/irix_types.h>
|
||||
#include <compat/irix/irix_signal.h>
|
||||
#include <compat/irix/irix_fcntl.h>
|
||||
#include <compat/irix/irix_usema.h>
|
||||
#include <compat/irix/irix_syscallargs.h>
|
||||
|
||||
#include <compat/svr4/svr4_types.h>
|
||||
@ -252,3 +256,46 @@ fd_truncate(p, fd, whence, start, retval)
|
||||
SCARG(&ft, fd) = fd;
|
||||
return sys_ftruncate(p, &ft, retval);
|
||||
}
|
||||
|
||||
int
|
||||
irix_sys_fchmod(p, v, retval)
|
||||
struct proc *p;
|
||||
void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
struct irix_sys_fchmod_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(int) mode;
|
||||
} */ *uap = v;
|
||||
struct sys_fchmod_args cup;
|
||||
struct file *fp;
|
||||
int error;
|
||||
int major, minor;
|
||||
struct vnode *vp;
|
||||
|
||||
SCARG(&cup, fd) = SCARG(uap, fd);
|
||||
SCARG(&cup, mode) = SCARG(uap, mode);
|
||||
error = sys_fchmod(p, &cup, retval);
|
||||
|
||||
/* getvnode() will use the descriptor for us */
|
||||
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
|
||||
return (error);
|
||||
|
||||
/*
|
||||
* bug for bug emulation of IRIX: on some device, including
|
||||
* /dev/usemaclone, fchmod returns 0 on faillure, and libc
|
||||
* depends on that behavior.
|
||||
*/
|
||||
vp = (struct vnode *)(fp->f_data);
|
||||
if (vp->v_type == VCHR) {
|
||||
major = major(vp->v_specinfo->si_rdev);
|
||||
minor = minor(vp->v_specinfo->si_rdev);
|
||||
/* XXX is there a better way to identify a given driver ? */
|
||||
if (cdevsw[major].d_open == *irix_usemaopen &&
|
||||
minor == IRIX_USEMACLNDEV_MINOR)
|
||||
error = 0;
|
||||
}
|
||||
|
||||
FILE_UNUSE(fp, p);
|
||||
return (error);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* $NetBSD: irix_syscall.h,v 1.42 2002/04/29 14:40:23 manu Exp $ */
|
||||
/* $NetBSD: irix_syscall.h,v 1.43 2002/05/04 07:45:06 manu Exp $ */
|
||||
|
||||
/*
|
||||
* System call numbers.
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* created from NetBSD: syscalls.master,v 1.40 2002/04/28 20:23:22 manu Exp
|
||||
* created from NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp
|
||||
*/
|
||||
|
||||
/* syscall: "syscall" ret: "int" args: */
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* $NetBSD: irix_syscallargs.h,v 1.42 2002/04/29 14:40:23 manu Exp $ */
|
||||
/* $NetBSD: irix_syscallargs.h,v 1.43 2002/05/04 07:45:07 manu Exp $ */
|
||||
|
||||
/*
|
||||
* System call argument lists.
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* created from NetBSD: syscalls.master,v 1.40 2002/04/28 20:23:22 manu Exp
|
||||
* created from NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp
|
||||
*/
|
||||
|
||||
#ifndef _IRIX_SYS__SYSCALLARGS_H_
|
||||
@ -115,6 +115,11 @@ struct irix_sys_setpgrp_args {
|
||||
syscallarg(int) pgid;
|
||||
};
|
||||
|
||||
struct irix_sys_fchmod_args {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(int) mode;
|
||||
};
|
||||
|
||||
struct irix_sys_systeminfo_args {
|
||||
syscallarg(int) what;
|
||||
syscallarg(char *) buf;
|
||||
@ -336,7 +341,7 @@ int irix_sys_setpgrp(struct proc *, void *, register_t *);
|
||||
int sys_fsync(struct proc *, void *, register_t *);
|
||||
int sys_fchdir(struct proc *, void *, register_t *);
|
||||
int sys___posix_fchown(struct proc *, void *, register_t *);
|
||||
int sys_fchmod(struct proc *, void *, register_t *);
|
||||
int irix_sys_fchmod(struct proc *, void *, register_t *);
|
||||
int irix_sys_systeminfo(struct proc *, void *, register_t *);
|
||||
int irix_sys_xstat(struct proc *, void *, register_t *);
|
||||
int irix_sys_lxstat(struct proc *, void *, register_t *);
|
||||
|
@ -1,14 +1,14 @@
|
||||
/* $NetBSD: irix_syscalls.c,v 1.42 2002/04/29 14:40:23 manu Exp $ */
|
||||
/* $NetBSD: irix_syscalls.c,v 1.43 2002/05/04 07:45:06 manu Exp $ */
|
||||
|
||||
/*
|
||||
* System call names.
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* created from NetBSD: syscalls.master,v 1.40 2002/04/28 20:23:22 manu Exp
|
||||
* created from NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.42 2002/04/29 14:40:23 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.43 2002/05/04 07:45:06 manu Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#if defined(_KERNEL_OPT)
|
||||
|
@ -1,14 +1,14 @@
|
||||
/* $NetBSD: irix_sysent.c,v 1.42 2002/04/29 14:40:23 manu Exp $ */
|
||||
/* $NetBSD: irix_sysent.c,v 1.43 2002/05/04 07:45:07 manu Exp $ */
|
||||
|
||||
/*
|
||||
* System call switch table.
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* created from NetBSD: syscalls.master,v 1.40 2002/04/28 20:23:22 manu Exp
|
||||
* created from NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.42 2002/04/29 14:40:23 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.43 2002/05/04 07:45:07 manu Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ntp.h"
|
||||
@ -356,8 +356,8 @@ struct sysent irix_sysent[] = {
|
||||
sys_nosys }, /* 151 = unimplemented cachectl */
|
||||
{ 3, s(struct sys___posix_fchown_args), 0,
|
||||
sys___posix_fchown }, /* 152 = fchown */
|
||||
{ 2, s(struct sys_fchmod_args), 0,
|
||||
sys_fchmod }, /* 153 = fchmod */
|
||||
{ 2, s(struct irix_sys_fchmod_args), 0,
|
||||
irix_sys_fchmod }, /* 153 = fchmod */
|
||||
{ 0, 0, 0,
|
||||
sys_nosys }, /* 154 = unimplemented wait3 */
|
||||
{ 0, 0, 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
$NetBSD: syscalls.master,v 1.41 2002/04/29 14:40:23 manu Exp $
|
||||
$NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp $
|
||||
|
||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||
|
||||
@ -275,7 +275,7 @@
|
||||
151 UNIMPL cachectl
|
||||
152 NOARGS { int sys___posix_fchown(int fd, int uid, int gid); } \
|
||||
fchown
|
||||
153 NOARGS { int sys_fchmod(int fd, int mode); }
|
||||
153 STD { int irix_sys_fchmod(int fd, int mode); }
|
||||
154 UNIMPL wait3
|
||||
155 UNIMPL socketpair
|
||||
156 STD { long irix_sys_systeminfo(int what, char *buf, \
|
||||
|
Loading…
Reference in New Issue
Block a user