2000-03-25 23:23:05 +03:00
|
|
|
/* $NetBSD: hpux_compat.c,v 1.47 2000/03/25 20:23:05 frueauf Exp $ */
|
1994-10-26 05:45:11 +03:00
|
|
|
|
1993-05-13 17:56:20 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1988 University of Utah.
|
1994-05-23 12:03:32 +04:00
|
|
|
* Copyright (c) 1990, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-05-13 17:56:20 +04:00
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* the Systems Programming Group of the University of Utah Computer
|
|
|
|
* Science Department.
|
|
|
|
*
|
|
|
|
* 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 University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
|
|
|
*
|
1994-05-23 12:03:32 +04:00
|
|
|
* from: Utah $Hdr: hpux_compat.c 1.64 93/08/05$
|
|
|
|
*
|
1994-10-26 05:45:11 +03:00
|
|
|
* @(#)hpux_compat.c 8.4 (Berkeley) 2/13/94
|
1993-05-13 17:56:20 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
1994-05-23 12:03:32 +04:00
|
|
|
* Various HP-UX compatibility routines
|
1993-05-13 17:56:20 +04:00
|
|
|
*/
|
1998-12-10 20:13:06 +03:00
|
|
|
#include "opt_sysv.h"
|
|
|
|
#include "opt_compat_43.h"
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1994-05-23 12:03:32 +04:00
|
|
|
#ifndef COMPAT_43
|
|
|
|
#define COMPAT_43
|
|
|
|
#endif
|
|
|
|
|
1998-10-20 02:31:50 +04:00
|
|
|
|
1994-05-23 12:03:32 +04:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/signalvar.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/filedesc.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/buf.h>
|
|
|
|
#include <sys/wait.h>
|
1996-10-14 10:53:23 +04:00
|
|
|
#include <sys/exec.h>
|
1994-05-23 12:03:32 +04:00
|
|
|
#include <sys/file.h>
|
|
|
|
#include <sys/namei.h>
|
|
|
|
#include <sys/vnode.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/ptrace.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/syslog.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/ipc.h>
|
|
|
|
#include <sys/user.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
|
1997-10-16 22:27:40 +04:00
|
|
|
#include <vm/vm.h>
|
|
|
|
|
1994-05-23 12:03:32 +04:00
|
|
|
#include <machine/cpu.h>
|
|
|
|
#include <machine/reg.h>
|
|
|
|
#include <machine/psl.h>
|
|
|
|
#include <machine/vmparam.h>
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
#include <sys/syscallargs.h>
|
|
|
|
|
|
|
|
#include <compat/hpux/hpux.h>
|
1997-04-01 23:58:58 +04:00
|
|
|
#include <compat/hpux/hpux_sig.h>
|
1995-05-10 20:45:25 +04:00
|
|
|
#include <compat/hpux/hpux_util.h>
|
|
|
|
#include <compat/hpux/hpux_termio.h>
|
|
|
|
#include <compat/hpux/hpux_syscall.h>
|
|
|
|
#include <compat/hpux/hpux_syscallargs.h>
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1996-01-06 15:44:06 +03:00
|
|
|
#include <machine/hpux_machdep.h>
|
|
|
|
|
1993-05-13 17:56:20 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
int unimpresponse = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
extern char sigcode[], esigcode[];
|
1995-04-22 23:48:19 +04:00
|
|
|
extern struct sysent hpux_sysent[];
|
1995-10-07 09:25:19 +03:00
|
|
|
extern char *hpux_syscallnames[];
|
1995-04-22 23:48:19 +04:00
|
|
|
|
1997-04-01 23:58:58 +04:00
|
|
|
int hpuxtobsdioctl __P((u_long));
|
|
|
|
|
|
|
|
static int hpux_scale __P((struct timeval *));
|
1995-04-22 23:48:19 +04:00
|
|
|
|
1994-05-23 12:03:32 +04:00
|
|
|
/*
|
|
|
|
* HP-UX fork and vfork need to map the EAGAIN return value appropriately.
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_fork(p, v, retval)
|
1994-05-23 12:03:32 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1994-05-23 12:03:32 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
/* struct hpux_sys_fork_args *uap = v; */
|
1994-05-23 12:03:32 +04:00
|
|
|
int error;
|
|
|
|
|
1995-12-09 07:05:52 +03:00
|
|
|
error = sys_fork(p, v, retval);
|
1994-05-23 12:03:32 +04:00
|
|
|
if (error == EAGAIN)
|
|
|
|
error = OEAGAIN;
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_vfork(p, v, retval)
|
1994-05-23 12:03:32 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1994-05-23 12:03:32 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
/* struct hpux_sys_vfork_args *uap = v; */
|
1994-05-23 12:03:32 +04:00
|
|
|
int error;
|
|
|
|
|
1995-12-09 07:05:52 +03:00
|
|
|
error = sys_vfork(p, v, retval);
|
1994-05-23 12:03:32 +04:00
|
|
|
if (error == EAGAIN)
|
|
|
|
error = OEAGAIN;
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1993-05-13 17:56:20 +04:00
|
|
|
/*
|
1994-05-23 12:03:32 +04:00
|
|
|
* HP-UX versions of wait and wait3 actually pass the parameters
|
1993-05-13 17:56:20 +04:00
|
|
|
* (status pointer, options, rusage) into the kernel rather than
|
|
|
|
* handling it in the C library stub. We also need to map any
|
1994-05-23 12:03:32 +04:00
|
|
|
* termination signal from BSD to HP-UX.
|
1993-05-13 17:56:20 +04:00
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_wait3(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_wait3_args *uap = v;
|
1995-09-20 02:53:47 +04:00
|
|
|
|
1993-05-13 17:56:20 +04:00
|
|
|
/* rusage pointer must be zero */
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, rusage))
|
1993-05-13 17:56:20 +04:00
|
|
|
return (EINVAL);
|
1995-05-10 20:45:25 +04:00
|
|
|
#if __mc68k__
|
1994-05-05 14:10:21 +04:00
|
|
|
p->p_md.md_regs[PS] = PSL_ALLCC;
|
1994-10-20 07:47:31 +03:00
|
|
|
p->p_md.md_regs[R0] = SCARG(uap, options);
|
|
|
|
p->p_md.md_regs[R1] = SCARG(uap, rusage);
|
1995-05-10 20:45:25 +04:00
|
|
|
#endif
|
1995-10-07 09:25:19 +03:00
|
|
|
|
|
|
|
return (hpux_sys_wait(p, uap, retval));
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_wait(p, v, retval)
|
1997-04-01 23:58:58 +04:00
|
|
|
struct proc *p;
|
1995-10-07 09:25:19 +03:00
|
|
|
void *v;
|
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
struct hpux_sys_wait_args *uap = v;
|
1995-10-07 09:25:19 +03:00
|
|
|
struct sys_wait4_args w4;
|
1995-05-10 20:45:25 +04:00
|
|
|
int error;
|
|
|
|
int sig;
|
|
|
|
size_t sz = sizeof(*SCARG(&w4, status));
|
|
|
|
int status;
|
|
|
|
|
|
|
|
SCARG(&w4, rusage) = NULL;
|
|
|
|
SCARG(&w4, options) = 0;
|
|
|
|
|
|
|
|
if (SCARG(uap, status) == NULL) {
|
1995-06-25 00:17:54 +04:00
|
|
|
caddr_t sg = stackgap_init(p->p_emul);
|
1995-05-10 20:45:25 +04:00
|
|
|
SCARG(&w4, status) = stackgap_alloc(&sg, sz);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SCARG(&w4, status) = SCARG(uap, status);
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
SCARG(&w4, pid) = WAIT_ANY;
|
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
error = sys_wait4(p, &w4, retval);
|
1993-05-13 17:56:20 +04:00
|
|
|
/*
|
|
|
|
* HP-UX wait always returns EINTR when interrupted by a signal
|
|
|
|
* (well, unless its emulating a BSD process, but we don't bother...)
|
|
|
|
*/
|
|
|
|
if (error == ERESTART)
|
|
|
|
error = EINTR;
|
|
|
|
if (error)
|
1995-05-10 20:45:25 +04:00
|
|
|
return error;
|
|
|
|
|
|
|
|
if ((error = copyin(SCARG(&w4, status), &status, sizeof(status))) != 0)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
sig = status & 0xFF;
|
1993-05-13 17:56:20 +04:00
|
|
|
if (sig == WSTOPPED) {
|
1995-05-10 20:45:25 +04:00
|
|
|
sig = (status >> 8) & 0xFF;
|
1993-05-13 17:56:20 +04:00
|
|
|
retval[1] = (bsdtohpuxsig(sig) << 8) | WSTOPPED;
|
|
|
|
} else if (sig)
|
1995-05-10 20:45:25 +04:00
|
|
|
retval[1] = (status & 0xFF00) |
|
1993-05-13 17:56:20 +04:00
|
|
|
bsdtohpuxsig(sig & 0x7F) | (sig & 0x80);
|
1995-05-10 20:45:25 +04:00
|
|
|
|
|
|
|
if (SCARG(uap, status) == NULL)
|
|
|
|
return error;
|
|
|
|
else
|
|
|
|
return copyout(&retval[1],
|
|
|
|
SCARG(uap, status), sizeof(retval[1]));
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_waitpid(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_waitpid_args *uap = v;
|
1994-05-23 12:03:32 +04:00
|
|
|
int rv, sig, xstat, error;
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
SCARG(uap, rusage) = 0;
|
1995-10-07 09:25:19 +03:00
|
|
|
error = sys_wait4(p, uap, retval);
|
1993-05-13 17:56:20 +04:00
|
|
|
/*
|
|
|
|
* HP-UX wait always returns EINTR when interrupted by a signal
|
|
|
|
* (well, unless its emulating a BSD process, but we don't bother...)
|
|
|
|
*/
|
|
|
|
if (error == ERESTART)
|
|
|
|
error = EINTR;
|
|
|
|
if (error)
|
|
|
|
return (error);
|
1995-05-10 20:45:25 +04:00
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, status)) {
|
1994-05-23 12:03:32 +04:00
|
|
|
/*
|
|
|
|
* Wait4 already wrote the status out to user space,
|
|
|
|
* pull it back, change the signal portion, and write
|
|
|
|
* it back out.
|
|
|
|
*/
|
1994-10-20 07:47:31 +03:00
|
|
|
rv = fuword((caddr_t)SCARG(uap, status));
|
1994-05-23 12:03:32 +04:00
|
|
|
if (WIFSTOPPED(rv)) {
|
|
|
|
sig = WSTOPSIG(rv);
|
|
|
|
rv = W_STOPCODE(bsdtohpuxsig(sig));
|
|
|
|
} else if (WIFSIGNALED(rv)) {
|
|
|
|
sig = WTERMSIG(rv);
|
|
|
|
xstat = WEXITSTATUS(rv);
|
|
|
|
rv = W_EXITCODE(xstat, bsdtohpuxsig(sig)) |
|
|
|
|
WCOREDUMP(rv);
|
|
|
|
}
|
1994-10-20 07:47:31 +03:00
|
|
|
(void)suword((caddr_t)SCARG(uap, status), rv);
|
1994-05-23 12:03:32 +04:00
|
|
|
}
|
1993-05-13 17:56:20 +04:00
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1994-05-23 12:03:32 +04:00
|
|
|
* Read and write calls. Same as BSD except for non-blocking behavior.
|
|
|
|
* There are three types of non-blocking reads/writes in HP-UX checked
|
|
|
|
* in the following order:
|
1993-05-13 17:56:20 +04:00
|
|
|
*
|
1994-05-23 12:03:32 +04:00
|
|
|
* O_NONBLOCK: return -1 and errno == EAGAIN
|
|
|
|
* O_NDELAY: return 0
|
|
|
|
* FIOSNBIO: return -1 and errno == EWOULDBLOCK
|
1993-05-13 17:56:20 +04:00
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_read(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_read_args *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
int error;
|
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
error = sys_read(p, (struct sys_read_args *) uap, retval);
|
1994-05-23 12:03:32 +04:00
|
|
|
if (error == EWOULDBLOCK) {
|
1994-10-20 07:47:31 +03:00
|
|
|
char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)];
|
1994-05-23 12:03:32 +04:00
|
|
|
|
1995-12-08 10:54:43 +03:00
|
|
|
if (*fp & HPUX_UF_NONBLOCK_ON) {
|
1994-05-23 12:03:32 +04:00
|
|
|
*retval = -1;
|
|
|
|
error = OEAGAIN;
|
1995-12-08 10:54:43 +03:00
|
|
|
} else if (*fp & HPUX_UF_FNDELAY_ON) {
|
1994-05-23 12:03:32 +04:00
|
|
|
*retval = 0;
|
|
|
|
error = 0;
|
|
|
|
}
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_write(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_write_args *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
int error;
|
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
error = sys_write(p, (struct sys_write_args *) uap, retval);
|
1994-05-23 12:03:32 +04:00
|
|
|
if (error == EWOULDBLOCK) {
|
1994-10-20 07:47:31 +03:00
|
|
|
char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)];
|
1994-05-23 12:03:32 +04:00
|
|
|
|
1995-12-08 10:54:43 +03:00
|
|
|
if (*fp & HPUX_UF_NONBLOCK_ON) {
|
1994-05-23 12:03:32 +04:00
|
|
|
*retval = -1;
|
|
|
|
error = OEAGAIN;
|
1995-12-08 10:54:43 +03:00
|
|
|
} else if (*fp & HPUX_UF_FNDELAY_ON) {
|
1994-05-23 12:03:32 +04:00
|
|
|
*retval = 0;
|
|
|
|
error = 0;
|
|
|
|
}
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_readv(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_readv_args *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
int error;
|
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
error = sys_readv(p, (struct sys_readv_args *) uap, retval);
|
1994-05-23 12:03:32 +04:00
|
|
|
if (error == EWOULDBLOCK) {
|
1994-10-20 07:47:31 +03:00
|
|
|
char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)];
|
1994-05-23 12:03:32 +04:00
|
|
|
|
1995-12-08 10:54:43 +03:00
|
|
|
if (*fp & HPUX_UF_NONBLOCK_ON) {
|
1994-05-23 12:03:32 +04:00
|
|
|
*retval = -1;
|
|
|
|
error = OEAGAIN;
|
1995-12-08 10:54:43 +03:00
|
|
|
} else if (*fp & HPUX_UF_FNDELAY_ON) {
|
1994-05-23 12:03:32 +04:00
|
|
|
*retval = 0;
|
|
|
|
error = 0;
|
|
|
|
}
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_writev(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_writev_args *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
int error;
|
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
error = sys_writev(p, (struct sys_writev_args *) uap, retval);
|
1994-05-23 12:03:32 +04:00
|
|
|
if (error == EWOULDBLOCK) {
|
1994-10-20 07:47:31 +03:00
|
|
|
char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)];
|
1994-05-23 12:03:32 +04:00
|
|
|
|
1995-12-08 10:54:43 +03:00
|
|
|
if (*fp & HPUX_UF_NONBLOCK_ON) {
|
1994-05-23 12:03:32 +04:00
|
|
|
*retval = -1;
|
|
|
|
error = OEAGAIN;
|
1995-12-08 10:54:43 +03:00
|
|
|
} else if (*fp & HPUX_UF_FNDELAY_ON) {
|
1994-05-23 12:03:32 +04:00
|
|
|
*retval = 0;
|
|
|
|
error = 0;
|
|
|
|
}
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 4.3bsd dup allows dup2 to come in on the same syscall entry
|
1994-05-23 12:03:32 +04:00
|
|
|
* and hence allows two arguments. HP-UX dup has only one arg.
|
1993-05-13 17:56:20 +04:00
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_dup(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
struct hpux_sys_dup_args *uap = v;
|
|
|
|
struct filedesc *fdp = p->p_fd;
|
1993-05-13 17:56:20 +04:00
|
|
|
struct file *fp;
|
|
|
|
int fd, error;
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
if (((unsigned)SCARG(uap, fd)) >= fdp->fd_nfiles ||
|
|
|
|
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
1993-05-13 17:56:20 +04:00
|
|
|
return (EBADF);
|
1997-04-01 23:58:58 +04:00
|
|
|
if ((error = fdalloc(p, 0, &fd)))
|
1993-05-13 17:56:20 +04:00
|
|
|
return (error);
|
|
|
|
fdp->fd_ofiles[fd] = fp;
|
1994-10-20 07:47:31 +03:00
|
|
|
fdp->fd_ofileflags[fd] =
|
1995-05-10 20:45:25 +04:00
|
|
|
fdp->fd_ofileflags[SCARG(uap, fd)] &~ UF_EXCLOSE;
|
1993-05-13 17:56:20 +04:00
|
|
|
fp->f_count++;
|
|
|
|
if (fd > fdp->fd_lastfile)
|
|
|
|
fdp->fd_lastfile = fd;
|
|
|
|
*retval = fd;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_utssys(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
struct hpux_sys_utssys_args *uap = v;
|
|
|
|
int i;
|
1993-05-13 17:56:20 +04:00
|
|
|
int error;
|
1995-05-10 20:45:25 +04:00
|
|
|
struct hpux_utsname ut;
|
1997-04-01 23:58:58 +04:00
|
|
|
extern char ostype[], hostname[], osrelease[], version[];
|
1997-04-28 01:40:47 +04:00
|
|
|
extern char machine[];
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
switch (SCARG(uap, request)) {
|
1993-05-13 17:56:20 +04:00
|
|
|
/* uname */
|
|
|
|
case 0:
|
1998-08-10 00:36:58 +04:00
|
|
|
memset(&ut, 0, sizeof(ut));
|
1995-05-10 20:45:25 +04:00
|
|
|
|
|
|
|
strncpy(ut.sysname, ostype, sizeof(ut.sysname));
|
|
|
|
ut.sysname[sizeof(ut.sysname) - 1] = '\0';
|
|
|
|
|
|
|
|
/* copy hostname (sans domain) to nodename */
|
|
|
|
for (i = 0; i < 8 && hostname[i] != '.'; i++)
|
|
|
|
ut.nodename[i] = hostname[i];
|
|
|
|
ut.nodename[i] = '\0';
|
|
|
|
|
|
|
|
strncpy(ut.release, osrelease, sizeof(ut.release));
|
|
|
|
ut.release[sizeof(ut.release) - 1] = '\0';
|
|
|
|
|
|
|
|
strncpy(ut.version, version, sizeof(ut.version));
|
|
|
|
ut.version[sizeof(ut.version) - 1] = '\0';
|
|
|
|
|
1997-04-28 01:40:47 +04:00
|
|
|
strncpy(ut.machine, machine, sizeof(ut.machine));
|
|
|
|
ut.machine[sizeof(ut.machine) - 1] = '\0';
|
1995-05-10 20:45:25 +04:00
|
|
|
|
|
|
|
error = copyout((caddr_t)&ut,
|
|
|
|
(caddr_t)SCARG(uap, uts), sizeof(ut));
|
1993-05-13 17:56:20 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* gethostname */
|
|
|
|
case 5:
|
1994-10-20 07:47:31 +03:00
|
|
|
/* SCARG(uap, dev) is length */
|
|
|
|
if (SCARG(uap, dev) > hostnamelen + 1)
|
|
|
|
SCARG(uap, dev) = hostnamelen + 1;
|
|
|
|
error = copyout((caddr_t)hostname, (caddr_t)SCARG(uap, uts),
|
|
|
|
SCARG(uap, dev));
|
1993-05-13 17:56:20 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* ?? */
|
|
|
|
case 2: /* ustat */
|
|
|
|
case 3: /* ?? */
|
|
|
|
case 4: /* sethostname */
|
|
|
|
default:
|
|
|
|
error = EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_sysconf(p, v, retval)
|
1994-05-23 12:03:32 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1994-05-23 12:03:32 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_sysconf_args *uap = v;
|
1994-05-23 12:03:32 +04:00
|
|
|
|
1997-10-19 23:25:07 +04:00
|
|
|
switch (SCARG(uap, name)) {
|
|
|
|
case HPUX_SYSCONF_ARGMAX:
|
|
|
|
*retval = ARG_MAX;
|
|
|
|
break;
|
|
|
|
case HPUX_SYSCONF_CHILDMAX:
|
|
|
|
*retval = maxproc;
|
|
|
|
break;
|
1994-05-23 12:03:32 +04:00
|
|
|
case HPUX_SYSCONF_CLKTICK:
|
|
|
|
*retval = hz;
|
|
|
|
break;
|
1997-10-19 23:25:07 +04:00
|
|
|
case HPUX_SYSCONF_NGRPMAX:
|
|
|
|
*retval = NGROUPS_MAX;
|
|
|
|
break;
|
1994-05-23 12:03:32 +04:00
|
|
|
case HPUX_SYSCONF_OPENMAX:
|
1997-10-19 23:25:07 +04:00
|
|
|
*retval = maxfiles;
|
|
|
|
break;
|
|
|
|
case HPUX_SYSCONF_JOBCNTRL:
|
|
|
|
*retval = 1;
|
|
|
|
break;
|
|
|
|
case HPUX_SYSCONF_SAVEDIDS:
|
|
|
|
#ifdef _POSIX_SAVED_IDS
|
|
|
|
*retval = 1;
|
|
|
|
#else
|
|
|
|
*retval = 0;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HPUX_SYSCONF_VERSION:
|
|
|
|
*retval = 198808;
|
1994-05-23 12:03:32 +04:00
|
|
|
break;
|
|
|
|
/* architecture */
|
|
|
|
case HPUX_SYSCONF_CPUTYPE:
|
1996-01-06 15:44:06 +03:00
|
|
|
*retval = hpux_cpu_sysconf_arch();
|
1994-05-23 12:03:32 +04:00
|
|
|
break;
|
|
|
|
default:
|
1996-01-06 15:44:06 +03:00
|
|
|
/* XXX */
|
1994-10-20 07:47:31 +03:00
|
|
|
uprintf("HP-UX sysconf(%d) not implemented\n",
|
|
|
|
SCARG(uap, name));
|
1994-05-23 12:03:32 +04:00
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_ulimit(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
struct hpux_sys_ulimit_args *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
struct rlimit *limp;
|
|
|
|
int error = 0;
|
|
|
|
|
|
|
|
limp = &p->p_rlimit[RLIMIT_FSIZE];
|
1994-10-20 07:47:31 +03:00
|
|
|
switch (SCARG(uap, cmd)) {
|
1993-05-13 17:56:20 +04:00
|
|
|
case 2:
|
1994-10-20 07:47:31 +03:00
|
|
|
SCARG(uap, newlimit) *= 512;
|
|
|
|
if (SCARG(uap, newlimit) > limp->rlim_max &&
|
1993-05-13 17:56:20 +04:00
|
|
|
(error = suser(p->p_ucred, &p->p_acflag)))
|
|
|
|
break;
|
1994-10-20 07:47:31 +03:00
|
|
|
limp->rlim_cur = limp->rlim_max = SCARG(uap, newlimit);
|
1993-05-13 17:56:20 +04:00
|
|
|
/* else fall into... */
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
*retval = limp->rlim_max / 512;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
limp = &p->p_rlimit[RLIMIT_DATA];
|
|
|
|
*retval = ctob(p->p_vmspace->vm_tsize) + limp->rlim_max;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
error = EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Map "real time" priorities 0 (high) thru 127 (low) into nice
|
|
|
|
* values -16 (high) thru -1 (low).
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_rtprio(cp, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *cp;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
struct hpux_sys_rtprio_args *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
|
|
|
int nice, error;
|
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, prio) < RTPRIO_MIN && SCARG(uap, prio) > RTPRIO_MAX &&
|
|
|
|
SCARG(uap, prio) != RTPRIO_NOCHG &&
|
|
|
|
SCARG(uap, prio) != RTPRIO_RTOFF)
|
1993-05-13 17:56:20 +04:00
|
|
|
return (EINVAL);
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, pid) == 0)
|
1993-05-13 17:56:20 +04:00
|
|
|
p = cp;
|
1994-10-20 07:47:31 +03:00
|
|
|
else if ((p = pfind(SCARG(uap, pid))) == 0)
|
1993-05-13 17:56:20 +04:00
|
|
|
return (ESRCH);
|
1996-10-02 22:04:56 +04:00
|
|
|
nice = p->p_nice - NZERO;
|
|
|
|
if (nice < 0)
|
1993-05-13 17:56:20 +04:00
|
|
|
*retval = (nice + 16) << 3;
|
|
|
|
else
|
|
|
|
*retval = RTPRIO_RTOFF;
|
1994-10-20 07:47:31 +03:00
|
|
|
switch (SCARG(uap, prio)) {
|
1993-05-13 17:56:20 +04:00
|
|
|
|
|
|
|
case RTPRIO_NOCHG:
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
case RTPRIO_RTOFF:
|
1996-10-02 22:04:56 +04:00
|
|
|
if (nice >= 0)
|
1993-05-13 17:56:20 +04:00
|
|
|
return (0);
|
1996-10-02 22:04:56 +04:00
|
|
|
nice = 0;
|
1993-05-13 17:56:20 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
1994-10-20 07:47:31 +03:00
|
|
|
nice = (SCARG(uap, prio) >> 3) - 16;
|
1993-05-13 17:56:20 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
error = donice(cp, p, nice);
|
|
|
|
if (error == EACCES)
|
|
|
|
error = EPERM;
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1996-01-06 15:44:06 +03:00
|
|
|
/* hpux_sys_advise() is found in hpux_machdep.c */
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1997-10-17 22:43:48 +04:00
|
|
|
#if 0 /* XXX - This really, really doesn't work anymore. --scottr */
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_ptrace(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_ptrace_args *uap = v;
|
1997-04-01 23:58:58 +04:00
|
|
|
int error;
|
|
|
|
#if defined(PT_READ_U) || defined(PT_WRITE_U)
|
|
|
|
int isps = 0;
|
1994-05-23 12:03:32 +04:00
|
|
|
struct proc *cp;
|
1997-04-01 23:58:58 +04:00
|
|
|
#endif
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
switch (SCARG(uap, req)) {
|
1994-05-23 12:03:32 +04:00
|
|
|
/* map signal */
|
1995-05-10 20:45:25 +04:00
|
|
|
#if defined(PT_STEP) || defined(PT_CONTINUE)
|
|
|
|
# ifdef PT_STEP
|
1994-05-23 12:03:32 +04:00
|
|
|
case PT_STEP:
|
1995-05-10 20:45:25 +04:00
|
|
|
# endif
|
|
|
|
# ifdef PT_CONTINUE
|
1994-05-23 12:03:32 +04:00
|
|
|
case PT_CONTINUE:
|
1995-05-10 20:45:25 +04:00
|
|
|
# endif
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, data)) {
|
|
|
|
SCARG(uap, data) = hpuxtobsdsig(SCARG(uap, data));
|
|
|
|
if (SCARG(uap, data) == 0)
|
|
|
|
SCARG(uap, data) = NSIG;
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
1994-05-23 12:03:32 +04:00
|
|
|
break;
|
1995-05-10 20:45:25 +04:00
|
|
|
#endif
|
1994-05-23 12:03:32 +04:00
|
|
|
/* map u-area offset */
|
1995-05-10 20:45:25 +04:00
|
|
|
#if defined(PT_READ_U) || defined(PT_WRITE_U)
|
|
|
|
# ifdef PT_READ_U
|
1994-05-23 12:03:32 +04:00
|
|
|
case PT_READ_U:
|
1995-05-10 20:45:25 +04:00
|
|
|
# endif
|
|
|
|
# ifdef PT_WRITE_U
|
1994-05-23 12:03:32 +04:00
|
|
|
case PT_WRITE_U:
|
1995-05-10 20:45:25 +04:00
|
|
|
# endif
|
1994-05-23 12:03:32 +04:00
|
|
|
/*
|
1996-01-06 15:44:06 +03:00
|
|
|
* Big, cheezy hack: hpux_to_bsd_uoff is really intended
|
1994-05-23 12:03:32 +04:00
|
|
|
* to be called in the child context (procxmt) but we
|
|
|
|
* do it here in the parent context to avoid hacks in
|
|
|
|
* the MI sys_process.c file. This works only because
|
|
|
|
* we can access the child's md_regs pointer and it
|
|
|
|
* has the correct value (the child has already trapped
|
|
|
|
* into the kernel).
|
|
|
|
*/
|
1994-10-20 07:47:31 +03:00
|
|
|
if ((cp = pfind(SCARG(uap, pid))) == 0)
|
1994-05-23 12:03:32 +04:00
|
|
|
return (ESRCH);
|
1994-10-20 07:47:31 +03:00
|
|
|
SCARG(uap, addr) =
|
1996-01-06 15:44:06 +03:00
|
|
|
(int *)hpux_to_bsd_uoff(SCARG(uap, addr), &isps, cp);
|
1994-05-23 12:03:32 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Since HP-UX PS is only 16-bits in ar0, requests
|
|
|
|
* to write PS actually contain the PS in the high word
|
|
|
|
* and the high half of the PC (the following register)
|
|
|
|
* in the low word. Move the PS value to where BSD
|
|
|
|
* expects it.
|
|
|
|
*/
|
1994-10-20 07:47:31 +03:00
|
|
|
if (isps && SCARG(uap, req) == PT_WRITE_U)
|
|
|
|
SCARG(uap, data) >>= 16;
|
1994-05-23 12:03:32 +04:00
|
|
|
break;
|
1995-05-10 20:45:25 +04:00
|
|
|
#endif
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
1995-05-10 20:45:25 +04:00
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
error = sys_ptrace(p, uap, retval);
|
1994-05-23 12:03:32 +04:00
|
|
|
/*
|
|
|
|
* Align PS as HP-UX expects it (see WRITE_U comment above).
|
|
|
|
* Note that we do not return the high part of PC like HP-UX
|
|
|
|
* would, but the HP-UX debuggers don't require it.
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
#ifdef PT_READ_U
|
1994-10-20 07:47:31 +03:00
|
|
|
if (isps && error == 0 && SCARG(uap, req) == PT_READ_U)
|
1994-05-23 12:03:32 +04:00
|
|
|
*retval <<= 16;
|
1995-05-10 20:45:25 +04:00
|
|
|
#endif
|
1993-05-13 17:56:20 +04:00
|
|
|
return (error);
|
|
|
|
}
|
1997-10-17 22:43:48 +04:00
|
|
|
#endif
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1994-05-23 12:03:32 +04:00
|
|
|
/*
|
|
|
|
* HP-UX mmap() emulation (mainly for shared library support).
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_mmap(p, v, retval)
|
1994-05-23 12:03:32 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1994-05-23 12:03:32 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_mmap_args *uap = v;
|
|
|
|
struct sys_mmap_args /* {
|
|
|
|
syscallarg(caddr_t) addr;
|
|
|
|
syscallarg(size_t) len;
|
|
|
|
syscallarg(int) prot;
|
|
|
|
syscallarg(int) flags;
|
|
|
|
syscallarg(int) fd;
|
|
|
|
syscallarg(long) pad;
|
|
|
|
syscallarg(off_t) pos;
|
|
|
|
} */ nargs;
|
|
|
|
|
|
|
|
SCARG(&nargs, addr) = SCARG(uap, addr);
|
|
|
|
SCARG(&nargs, len) = SCARG(uap, len);
|
|
|
|
SCARG(&nargs, prot) = SCARG(uap, prot);
|
|
|
|
SCARG(&nargs, flags) = SCARG(uap, flags) &
|
1994-05-23 12:03:32 +04:00
|
|
|
~(HPUXMAP_FIXED|HPUXMAP_REPLACE|HPUXMAP_ANON);
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, flags) & HPUXMAP_FIXED)
|
1995-10-07 09:25:19 +03:00
|
|
|
SCARG(&nargs, flags) |= MAP_FIXED;
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, flags) & HPUXMAP_ANON)
|
1995-10-07 09:25:19 +03:00
|
|
|
SCARG(&nargs, flags) |= MAP_ANON;
|
|
|
|
SCARG(&nargs, fd) = (SCARG(&nargs, flags) & MAP_ANON) ? -1 : SCARG(uap, fd);
|
|
|
|
SCARG(&nargs, pos) = SCARG(uap, pos);
|
|
|
|
|
|
|
|
return (sys_mmap(p, &nargs, retval));
|
1994-05-23 12:03:32 +04:00
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1993-05-13 17:56:20 +04:00
|
|
|
hpuxtobsdioctl(com)
|
1994-10-31 00:43:03 +03:00
|
|
|
u_long com;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
|
|
|
switch (com) {
|
|
|
|
case HPUXTIOCSLTC:
|
|
|
|
com = TIOCSLTC; break;
|
|
|
|
case HPUXTIOCGLTC:
|
|
|
|
com = TIOCGLTC; break;
|
|
|
|
case HPUXTIOCSPGRP:
|
|
|
|
com = TIOCSPGRP; break;
|
|
|
|
case HPUXTIOCGPGRP:
|
|
|
|
com = TIOCGPGRP; break;
|
|
|
|
case HPUXTIOCLBIS:
|
|
|
|
com = TIOCLBIS; break;
|
|
|
|
case HPUXTIOCLBIC:
|
|
|
|
com = TIOCLBIC; break;
|
|
|
|
case HPUXTIOCLSET:
|
|
|
|
com = TIOCLSET; break;
|
|
|
|
case HPUXTIOCLGET:
|
|
|
|
com = TIOCLGET; break;
|
1994-05-23 12:03:32 +04:00
|
|
|
case HPUXTIOCGWINSZ:
|
|
|
|
com = TIOCGWINSZ; break;
|
|
|
|
case HPUXTIOCSWINSZ:
|
|
|
|
com = TIOCSWINSZ; break;
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
return(com);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1994-05-23 12:03:32 +04:00
|
|
|
* HP-UX ioctl system call. The differences here are:
|
1993-05-13 17:56:20 +04:00
|
|
|
* IOC_IN also means IOC_VOID if the size portion is zero.
|
|
|
|
* no FIOCLEX/FIONCLEX/FIOASYNC/FIOGETOWN/FIOSETOWN
|
|
|
|
* the sgttyb struct is 2 bytes longer
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_ioctl(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
struct hpux_sys_ioctl_args /* {
|
1996-01-06 15:44:06 +03:00
|
|
|
syscallarg(int) fd;
|
|
|
|
syscallarg(int) com;
|
|
|
|
syscallarg(caddr_t) data;
|
|
|
|
} */ *uap = v;
|
1997-04-01 23:58:58 +04:00
|
|
|
struct filedesc *fdp = p->p_fd;
|
|
|
|
struct file *fp;
|
|
|
|
int com, error = 0;
|
|
|
|
u_int size;
|
1993-05-13 17:56:20 +04:00
|
|
|
caddr_t memp = 0;
|
|
|
|
#define STK_PARAMS 128
|
|
|
|
char stkbuf[STK_PARAMS];
|
1995-05-10 20:45:25 +04:00
|
|
|
caddr_t dt = stkbuf;
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
com = SCARG(uap, com);
|
1993-05-13 17:56:20 +04:00
|
|
|
|
|
|
|
/* XXX */
|
|
|
|
if (com == HPUXTIOCGETP || com == HPUXTIOCSETP)
|
1995-05-10 20:45:25 +04:00
|
|
|
return (getsettty(p, SCARG(uap, fd), com, SCARG(uap, data)));
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
if (((unsigned)SCARG(uap, fd)) >= fdp->fd_nfiles ||
|
|
|
|
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
1993-05-13 17:56:20 +04:00
|
|
|
return (EBADF);
|
|
|
|
if ((fp->f_flag & (FREAD|FWRITE)) == 0)
|
|
|
|
return (EBADF);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Interpret high order word to find
|
|
|
|
* amount of data to be copied to/from the
|
|
|
|
* user's address space.
|
|
|
|
*/
|
|
|
|
size = IOCPARM_LEN(com);
|
|
|
|
if (size > IOCPARM_MAX)
|
|
|
|
return (ENOTTY);
|
|
|
|
if (size > sizeof (stkbuf)) {
|
|
|
|
memp = (caddr_t)malloc((u_long)size, M_IOCTLOPS, M_WAITOK);
|
1995-05-10 20:45:25 +04:00
|
|
|
dt = memp;
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
if (com&IOC_IN) {
|
|
|
|
if (size) {
|
1995-05-10 20:45:25 +04:00
|
|
|
error = copyin(SCARG(uap, data), dt, (u_int)size);
|
1993-05-13 17:56:20 +04:00
|
|
|
if (error) {
|
|
|
|
if (memp)
|
|
|
|
free(memp, M_IOCTLOPS);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
} else
|
1995-05-10 20:45:25 +04:00
|
|
|
*(caddr_t *)dt = SCARG(uap, data);
|
1993-05-13 17:56:20 +04:00
|
|
|
} else if ((com&IOC_OUT) && size)
|
|
|
|
/*
|
|
|
|
* Zero the buffer so the user always
|
|
|
|
* gets back something deterministic.
|
|
|
|
*/
|
1998-08-10 00:36:58 +04:00
|
|
|
memset(dt, 0, size);
|
1993-05-13 17:56:20 +04:00
|
|
|
else if (com&IOC_VOID)
|
1995-05-10 20:45:25 +04:00
|
|
|
*(caddr_t *)dt = SCARG(uap, data);
|
1993-05-13 17:56:20 +04:00
|
|
|
|
|
|
|
switch (com) {
|
|
|
|
|
|
|
|
case HPUXFIOSNBIO:
|
|
|
|
{
|
1995-05-10 20:45:25 +04:00
|
|
|
char *ofp = &fdp->fd_ofileflags[SCARG(uap, fd)];
|
1993-05-13 17:56:20 +04:00
|
|
|
int tmp;
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
if (*(int *)dt)
|
1995-12-08 10:54:43 +03:00
|
|
|
*ofp |= HPUX_UF_FIONBIO_ON;
|
1993-05-13 17:56:20 +04:00
|
|
|
else
|
1995-12-08 10:54:43 +03:00
|
|
|
*ofp &= ~HPUX_UF_FIONBIO_ON;
|
1993-05-13 17:56:20 +04:00
|
|
|
/*
|
1994-05-23 12:03:32 +04:00
|
|
|
* Only set/clear if O_NONBLOCK/FNDELAY not in effect
|
1993-05-13 17:56:20 +04:00
|
|
|
*/
|
1995-12-08 10:54:43 +03:00
|
|
|
if ((*ofp & (HPUX_UF_NONBLOCK_ON|HPUX_UF_FNDELAY_ON)) == 0) {
|
|
|
|
tmp = *ofp & HPUX_UF_FIONBIO_ON;
|
1993-05-13 17:56:20 +04:00
|
|
|
error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO,
|
|
|
|
(caddr_t)&tmp, p);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case HPUXTIOCCONS:
|
1995-05-10 20:45:25 +04:00
|
|
|
*(int *)dt = 1;
|
|
|
|
error = (*fp->f_ops->fo_ioctl)(fp, TIOCCONS, dt, p);
|
1993-05-13 17:56:20 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* BSD-style job control ioctls */
|
|
|
|
case HPUXTIOCLBIS:
|
|
|
|
case HPUXTIOCLBIC:
|
|
|
|
case HPUXTIOCLSET:
|
1995-05-10 20:45:25 +04:00
|
|
|
*(int *)dt &= HPUXLTOSTOP;
|
|
|
|
if (*(int *)dt & HPUXLTOSTOP)
|
|
|
|
*(int *)dt = LTOSTOP;
|
1993-05-13 17:56:20 +04:00
|
|
|
/* fall into */
|
1994-05-23 12:03:32 +04:00
|
|
|
|
|
|
|
/* simple mapping cases */
|
1993-05-13 17:56:20 +04:00
|
|
|
case HPUXTIOCLGET:
|
|
|
|
case HPUXTIOCSLTC:
|
|
|
|
case HPUXTIOCGLTC:
|
|
|
|
case HPUXTIOCSPGRP:
|
|
|
|
case HPUXTIOCGPGRP:
|
1994-05-23 12:03:32 +04:00
|
|
|
case HPUXTIOCGWINSZ:
|
|
|
|
case HPUXTIOCSWINSZ:
|
1993-05-13 17:56:20 +04:00
|
|
|
error = (*fp->f_ops->fo_ioctl)
|
1995-05-10 20:45:25 +04:00
|
|
|
(fp, hpuxtobsdioctl(com), dt, p);
|
1993-05-13 17:56:20 +04:00
|
|
|
if (error == 0 && com == HPUXTIOCLGET) {
|
1995-05-10 20:45:25 +04:00
|
|
|
*(int *)dt &= LTOSTOP;
|
|
|
|
if (*(int *)dt & LTOSTOP)
|
|
|
|
*(int *)dt = HPUXLTOSTOP;
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
1994-05-23 12:03:32 +04:00
|
|
|
/* SYS 5 termio and POSIX termios */
|
1993-05-13 17:56:20 +04:00
|
|
|
case HPUXTCGETA:
|
|
|
|
case HPUXTCSETA:
|
|
|
|
case HPUXTCSETAW:
|
|
|
|
case HPUXTCSETAF:
|
1994-05-23 12:03:32 +04:00
|
|
|
case HPUXTCGETATTR:
|
|
|
|
case HPUXTCSETATTR:
|
|
|
|
case HPUXTCSETATTRD:
|
|
|
|
case HPUXTCSETATTRF:
|
1995-05-10 20:45:25 +04:00
|
|
|
error = hpux_termio(SCARG(uap, fd), com, dt, p);
|
1993-05-13 17:56:20 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
1995-05-10 20:45:25 +04:00
|
|
|
error = (*fp->f_ops->fo_ioctl)(fp, com, dt, p);
|
1993-05-13 17:56:20 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Copy any data to user, size was
|
|
|
|
* already set and checked above.
|
|
|
|
*/
|
|
|
|
if (error == 0 && (com&IOC_OUT) && size)
|
1995-05-10 20:45:25 +04:00
|
|
|
error = copyout(dt, SCARG(uap, data), (u_int)size);
|
1993-05-13 17:56:20 +04:00
|
|
|
if (memp)
|
|
|
|
free(memp, M_IOCTLOPS);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1996-01-06 15:44:06 +03:00
|
|
|
/* hpux_sys_getcontext() is found in hpux_machdep.c */
|
1993-05-13 17:56:20 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the equivalent of BSD getpgrp but with more restrictions.
|
|
|
|
* Note we do not check the real uid or "saved" uid.
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_getpgrp2(cp, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *cp;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
struct hpux_sys_getpgrp2_args *uap = v;
|
|
|
|
struct proc *p;
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, pid) == 0)
|
|
|
|
SCARG(uap, pid) = cp->p_pid;
|
|
|
|
p = pfind(SCARG(uap, pid));
|
1993-05-13 17:56:20 +04:00
|
|
|
if (p == 0)
|
|
|
|
return (ESRCH);
|
|
|
|
if (cp->p_ucred->cr_uid && p->p_ucred->cr_uid != cp->p_ucred->cr_uid &&
|
|
|
|
!inferior(p))
|
|
|
|
return (EPERM);
|
|
|
|
*retval = p->p_pgid;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the equivalent of BSD setpgrp but with more restrictions.
|
|
|
|
* Note we do not check the real uid or "saved" uid or pgrp.
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_setpgrp2(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_setpgrp2_args *uap = v;
|
1995-09-20 02:53:47 +04:00
|
|
|
|
1993-05-13 17:56:20 +04:00
|
|
|
/* empirically determined */
|
1995-05-10 20:45:25 +04:00
|
|
|
if (SCARG(uap, pgid) < 0 || SCARG(uap, pgid) >= 30000)
|
1993-05-13 17:56:20 +04:00
|
|
|
return (EINVAL);
|
1995-10-07 09:25:19 +03:00
|
|
|
return (sys_setpgid(p, uap, retval));
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX Same as BSD setre[ug]id right now. Need to consider saved ids.
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_setresuid(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_setresuid_args *uap = v;
|
1995-09-20 02:53:47 +04:00
|
|
|
|
1996-06-23 15:10:01 +04:00
|
|
|
return (sys_setreuid(p, uap, retval));
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_setresgid(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_setresgid_args *uap = v;
|
1995-09-20 02:53:47 +04:00
|
|
|
|
1996-06-23 15:10:01 +04:00
|
|
|
return (sys_setregid(p, uap, retval));
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_getrlimit(p, v, retval)
|
1994-05-23 12:03:32 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1994-05-23 12:03:32 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_getrlimit_args *uap = v;
|
|
|
|
struct compat_43_sys_getrlimit_args ap;
|
1995-05-10 20:45:25 +04:00
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, which) > HPUXRLIMIT_NOFILE)
|
1994-05-23 12:03:32 +04:00
|
|
|
return (EINVAL);
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, which) == HPUXRLIMIT_NOFILE)
|
|
|
|
SCARG(uap, which) = RLIMIT_NOFILE;
|
1995-05-10 20:45:25 +04:00
|
|
|
|
|
|
|
SCARG(&ap, which) = SCARG(uap, which);
|
|
|
|
SCARG(&ap, rlp) = SCARG(uap, rlp);
|
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
return (compat_43_sys_getrlimit(p, uap, retval));
|
1994-05-23 12:03:32 +04:00
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_setrlimit(p, v, retval)
|
1994-05-23 12:03:32 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1994-05-23 12:03:32 +04:00
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct hpux_sys_setrlimit_args *uap = v;
|
|
|
|
struct compat_43_sys_setrlimit_args ap;
|
1995-05-10 20:45:25 +04:00
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, which) > HPUXRLIMIT_NOFILE)
|
1994-05-23 12:03:32 +04:00
|
|
|
return (EINVAL);
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, which) == HPUXRLIMIT_NOFILE)
|
|
|
|
SCARG(uap, which) = RLIMIT_NOFILE;
|
1995-05-10 20:45:25 +04:00
|
|
|
|
|
|
|
SCARG(&ap, which) = SCARG(uap, which);
|
|
|
|
SCARG(&ap, rlp) = SCARG(uap, rlp);
|
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
return (compat_43_sys_setrlimit(p, uap, retval));
|
1994-05-23 12:03:32 +04:00
|
|
|
}
|
|
|
|
|
1993-05-13 17:56:20 +04:00
|
|
|
/*
|
|
|
|
* XXX: simple recognition hack to see if we can make grmd work.
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_lockf(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
/* struct hpux_sys_lockf_args *uap = v; */
|
1995-09-20 02:53:47 +04:00
|
|
|
|
1993-05-13 17:56:20 +04:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
hpux_sys_getaccess(p, v, retval)
|
1997-04-01 23:58:58 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1997-04-01 23:58:58 +04:00
|
|
|
struct hpux_sys_getaccess_args *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
int lgroups[NGROUPS];
|
|
|
|
int error = 0;
|
1997-04-01 23:58:58 +04:00
|
|
|
struct ucred *cred;
|
|
|
|
struct vnode *vp;
|
1994-05-23 12:03:32 +04:00
|
|
|
struct nameidata nd;
|
1993-05-13 17:56:20 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Build an appropriate credential structure
|
|
|
|
*/
|
|
|
|
cred = crdup(p->p_ucred);
|
1994-10-20 07:47:31 +03:00
|
|
|
switch (SCARG(uap, uid)) {
|
1993-05-13 17:56:20 +04:00
|
|
|
case 65502: /* UID_EUID */
|
|
|
|
break;
|
|
|
|
case 65503: /* UID_RUID */
|
|
|
|
cred->cr_uid = p->p_cred->p_ruid;
|
|
|
|
break;
|
|
|
|
case 65504: /* UID_SUID */
|
|
|
|
error = EINVAL;
|
|
|
|
break;
|
|
|
|
default:
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, uid) > 65504)
|
1993-05-13 17:56:20 +04:00
|
|
|
error = EINVAL;
|
1994-10-20 07:47:31 +03:00
|
|
|
cred->cr_uid = SCARG(uap, uid);
|
1993-05-13 17:56:20 +04:00
|
|
|
break;
|
|
|
|
}
|
1994-10-20 07:47:31 +03:00
|
|
|
switch (SCARG(uap, ngroups)) {
|
1993-05-13 17:56:20 +04:00
|
|
|
case -1: /* NGROUPS_EGID */
|
|
|
|
cred->cr_ngroups = 1;
|
|
|
|
break;
|
|
|
|
case -5: /* NGROUPS_EGID_SUPP */
|
|
|
|
break;
|
|
|
|
case -2: /* NGROUPS_RGID */
|
|
|
|
cred->cr_ngroups = 1;
|
|
|
|
cred->cr_gid = p->p_cred->p_rgid;
|
|
|
|
break;
|
|
|
|
case -6: /* NGROUPS_RGID_SUPP */
|
|
|
|
cred->cr_gid = p->p_cred->p_rgid;
|
|
|
|
break;
|
|
|
|
case -3: /* NGROUPS_SGID */
|
|
|
|
case -7: /* NGROUPS_SGID_SUPP */
|
|
|
|
error = EINVAL;
|
|
|
|
break;
|
|
|
|
case -4: /* NGROUPS_SUPP */
|
|
|
|
if (cred->cr_ngroups > 1)
|
|
|
|
cred->cr_gid = cred->cr_groups[1];
|
|
|
|
else
|
|
|
|
error = EINVAL;
|
|
|
|
break;
|
|
|
|
default:
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, ngroups) > 0 && SCARG(uap, ngroups) <= NGROUPS)
|
|
|
|
error = copyin((caddr_t)SCARG(uap, gidset),
|
1993-05-13 17:56:20 +04:00
|
|
|
(caddr_t)&lgroups[0],
|
1994-10-20 07:47:31 +03:00
|
|
|
SCARG(uap, ngroups) *
|
|
|
|
sizeof(lgroups[0]));
|
1993-05-13 17:56:20 +04:00
|
|
|
else
|
|
|
|
error = EINVAL;
|
|
|
|
if (error == 0) {
|
|
|
|
int gid;
|
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
for (gid = 0; gid < SCARG(uap, ngroups); gid++)
|
1993-05-13 17:56:20 +04:00
|
|
|
cred->cr_groups[gid] = lgroups[gid];
|
1994-10-20 07:47:31 +03:00
|
|
|
cred->cr_ngroups = SCARG(uap, ngroups);
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Lookup file using caller's effective IDs.
|
|
|
|
*/
|
|
|
|
if (error == 0) {
|
1994-05-23 12:03:32 +04:00
|
|
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
|
1994-10-20 07:47:31 +03:00
|
|
|
SCARG(uap, path), p);
|
1994-05-23 12:03:32 +04:00
|
|
|
error = namei(&nd);
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
if (error) {
|
|
|
|
crfree(cred);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Use the constructed credentials for access checks.
|
|
|
|
*/
|
1994-05-23 12:03:32 +04:00
|
|
|
vp = nd.ni_vp;
|
1993-05-13 17:56:20 +04:00
|
|
|
*retval = 0;
|
|
|
|
if (VOP_ACCESS(vp, VREAD, cred, p) == 0)
|
|
|
|
*retval |= R_OK;
|
|
|
|
if (vn_writechk(vp) == 0 && VOP_ACCESS(vp, VWRITE, cred, p) == 0)
|
|
|
|
*retval |= W_OK;
|
1997-05-08 20:19:43 +04:00
|
|
|
if (VOP_ACCESS(vp, VEXEC, cred, p) == 0)
|
|
|
|
*retval |= X_OK;
|
1993-05-13 17:56:20 +04:00
|
|
|
vput(vp);
|
|
|
|
crfree(cred);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1996-01-06 15:44:06 +03:00
|
|
|
/* hpux_to_bsd_uoff() is found in hpux_machdep.c */
|
1993-05-13 17:56:20 +04:00
|
|
|
|
|
|
|
/*
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
* Ancient HP-UX system calls. Some 9.x executables even use them!
|
1993-05-13 17:56:20 +04:00
|
|
|
*/
|
|
|
|
#define HPUX_HZ 50
|
|
|
|
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
#include <sys/times.h>
|
1993-05-13 17:56:20 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SYS V style setpgrp()
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
hpux_sys_setpgrp_6x(p, v, retval)
|
1997-04-01 23:58:58 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1995-05-10 20:45:25 +04:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
1995-09-20 02:53:47 +04:00
|
|
|
|
1993-05-13 17:56:20 +04:00
|
|
|
if (p->p_pid != p->p_pgid)
|
|
|
|
enterpgrp(p, p->p_pid, 0);
|
|
|
|
*retval = p->p_pgid;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
hpux_sys_time_6x(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
struct hpux_sys_time_6x_args /* {
|
|
|
|
syscallarg(time_t *) t;
|
|
|
|
} */ *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
int error = 0;
|
1995-05-10 20:45:25 +04:00
|
|
|
struct timeval tv;
|
1993-05-13 17:56:20 +04:00
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
microtime(&tv);
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
if (SCARG(uap, t) != NULL)
|
|
|
|
error = copyout(&tv.tv_sec, SCARG(uap, t), sizeof(time_t));
|
1995-05-10 20:45:25 +04:00
|
|
|
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
*retval = (register_t)tv.tv_sec;
|
|
|
|
return (error);
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
hpux_sys_stime_6x(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
struct hpux_sys_stime_6x_args /* {
|
|
|
|
syscallarg(int) time;
|
|
|
|
} */ *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
struct timeval tv;
|
|
|
|
int s, error;
|
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
tv.tv_sec = SCARG(uap, time);
|
1993-05-13 17:56:20 +04:00
|
|
|
tv.tv_usec = 0;
|
1997-04-01 23:58:58 +04:00
|
|
|
if ((error = suser(p->p_ucred, &p->p_acflag)))
|
1993-05-13 17:56:20 +04:00
|
|
|
return (error);
|
|
|
|
|
|
|
|
/* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
|
|
|
|
boottime.tv_sec += tv.tv_sec - time.tv_sec;
|
1997-02-28 08:01:21 +03:00
|
|
|
s = splclock(); time = tv; splx(s);
|
1993-05-13 17:56:20 +04:00
|
|
|
resettodr();
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
hpux_sys_ftime_6x(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
struct hpux_sys_ftime_6x_args /* {
|
|
|
|
syscallarg(struct hpux_timeb *) tp;
|
|
|
|
} */ *uap = v;
|
1995-05-10 20:45:25 +04:00
|
|
|
struct hpux_otimeb tb;
|
1993-05-13 17:56:20 +04:00
|
|
|
int s;
|
|
|
|
|
1997-02-28 08:01:21 +03:00
|
|
|
s = splclock();
|
1993-05-13 17:56:20 +04:00
|
|
|
tb.time = time.tv_sec;
|
|
|
|
tb.millitm = time.tv_usec / 1000;
|
|
|
|
splx(s);
|
1997-01-15 04:28:28 +03:00
|
|
|
/* NetBSD has no kernel notion of timezone -- fake it. */
|
|
|
|
tb.timezone = 0;
|
|
|
|
tb.dstflag = 0;
|
1994-10-20 07:47:31 +03:00
|
|
|
return (copyout((caddr_t)&tb, (caddr_t)SCARG(uap, tp), sizeof (tb)));
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
hpux_sys_alarm_6x(p, v, retval)
|
1997-04-01 23:58:58 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
struct hpux_sys_alarm_6x_args /* {
|
|
|
|
syscallarg(int) deltat;
|
|
|
|
} */ *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
int s = splhigh();
|
|
|
|
|
2000-03-23 09:40:33 +03:00
|
|
|
callout_stop(&p->p_realit_ch);
|
1993-05-13 17:56:20 +04:00
|
|
|
timerclear(&p->p_realtimer.it_interval);
|
|
|
|
*retval = 0;
|
|
|
|
if (timerisset(&p->p_realtimer.it_value) &&
|
|
|
|
timercmp(&p->p_realtimer.it_value, &time, >))
|
|
|
|
*retval = p->p_realtimer.it_value.tv_sec - time.tv_sec;
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, deltat) == 0) {
|
1993-05-13 17:56:20 +04:00
|
|
|
timerclear(&p->p_realtimer.it_value);
|
|
|
|
splx(s);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
p->p_realtimer.it_value = time;
|
1994-10-20 07:47:31 +03:00
|
|
|
p->p_realtimer.it_value.tv_sec += SCARG(uap, deltat);
|
2000-03-25 23:23:05 +03:00
|
|
|
callout_reset(&p->p_realit_ch, hzto(&p->p_realtimer.it_value),
|
2000-03-23 09:40:33 +03:00
|
|
|
realitexpire, p);
|
1993-05-13 17:56:20 +04:00
|
|
|
splx(s);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
hpux_sys_nice_6x(p, v, retval)
|
1997-04-01 23:58:58 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
struct hpux_sys_nice_6x_args /* {
|
|
|
|
syscallarg(int) nval;
|
|
|
|
} */ *uap = v;
|
1993-05-13 17:56:20 +04:00
|
|
|
int error;
|
|
|
|
|
1996-10-02 22:04:56 +04:00
|
|
|
error = donice(p, p, (p->p_nice - NZERO) + SCARG(uap, nval));
|
1993-05-13 17:56:20 +04:00
|
|
|
if (error == 0)
|
|
|
|
*retval = p->p_nice - NZERO;
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
hpux_sys_times_6x(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
struct hpux_sys_times_6x_args /* {
|
|
|
|
syscallarg(struct tms *) tms;
|
|
|
|
} */ *uap = v;
|
1994-05-17 14:37:09 +04:00
|
|
|
struct timeval ru, rs;
|
1993-05-13 17:56:20 +04:00
|
|
|
struct tms atms;
|
|
|
|
int error;
|
|
|
|
|
1994-05-17 14:37:09 +04:00
|
|
|
calcru(p, &ru, &rs, NULL);
|
|
|
|
atms.tms_utime = hpux_scale(&ru);
|
|
|
|
atms.tms_stime = hpux_scale(&rs);
|
1994-01-07 03:43:39 +03:00
|
|
|
atms.tms_cutime = hpux_scale(&p->p_stats->p_cru.ru_utime);
|
|
|
|
atms.tms_cstime = hpux_scale(&p->p_stats->p_cru.ru_stime);
|
1995-05-10 20:45:25 +04:00
|
|
|
error = copyout((caddr_t)&atms, (caddr_t)SCARG(uap, tms),
|
1994-10-20 07:47:31 +03:00
|
|
|
sizeof (atms));
|
1993-05-13 17:56:20 +04:00
|
|
|
if (error == 0)
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
*(time_t *)retval = hpux_scale((struct timeval *)&time) -
|
|
|
|
hpux_scale(&boottime);
|
1993-05-13 17:56:20 +04:00
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Doesn't exactly do what the documentation says.
|
|
|
|
* What we really do is return 1/HPUX_HZ-th of a second since that
|
|
|
|
* is what HP-UX returns.
|
|
|
|
*/
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
static int
|
1994-01-07 03:43:39 +03:00
|
|
|
hpux_scale(tvp)
|
1997-04-01 23:58:58 +04:00
|
|
|
struct timeval *tvp;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
|
|
|
return (tvp->tv_sec * HPUX_HZ + tvp->tv_usec * HPUX_HZ / 1000000);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set IUPD and IACC times on file.
|
|
|
|
* Can't set ICHG.
|
|
|
|
*/
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
hpux_sys_utime_6x(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
struct hpux_sys_utime_6x_args /* {
|
|
|
|
syscallarg(char *) fname;
|
|
|
|
syscallarg(time_t *) tptr;
|
|
|
|
} */ *uap = v;
|
1997-04-01 23:58:58 +04:00
|
|
|
struct vnode *vp;
|
1993-05-13 17:56:20 +04:00
|
|
|
struct vattr vattr;
|
|
|
|
time_t tv[2];
|
|
|
|
int error;
|
|
|
|
struct nameidata nd;
|
|
|
|
|
1994-10-20 07:47:31 +03:00
|
|
|
if (SCARG(uap, tptr)) {
|
|
|
|
error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv,
|
|
|
|
sizeof (tv));
|
1993-05-13 17:56:20 +04:00
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
} else
|
|
|
|
tv[0] = tv[1] = time.tv_sec;
|
|
|
|
vattr_null(&vattr);
|
1996-02-01 03:18:04 +03:00
|
|
|
vattr.va_atime.tv_sec = tv[0];
|
|
|
|
vattr.va_atime.tv_nsec = 0;
|
|
|
|
vattr.va_mtime.tv_sec = tv[1];
|
|
|
|
vattr.va_mtime.tv_nsec = 0;
|
1994-10-20 07:47:31 +03:00
|
|
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
|
|
|
|
SCARG(uap, fname), p);
|
1997-04-01 23:58:58 +04:00
|
|
|
if ((error = namei(&nd)))
|
1993-05-13 17:56:20 +04:00
|
|
|
return (error);
|
1994-05-23 12:03:32 +04:00
|
|
|
vp = nd.ni_vp;
|
1993-05-13 17:56:20 +04:00
|
|
|
if (vp->v_mount->mnt_flag & MNT_RDONLY)
|
|
|
|
error = EROFS;
|
|
|
|
else
|
1994-05-23 12:03:32 +04:00
|
|
|
error = VOP_SETATTR(vp, &vattr, nd.ni_cnd.cn_cred, p);
|
1993-05-13 17:56:20 +04:00
|
|
|
vput(vp);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1995-05-10 20:45:25 +04:00
|
|
|
int
|
Get COMPAT_HPUX partially working on the hp300. Notable improvements:
* It compiles (and links).
* Make use of "/emul/hpux" where applicable.
* Untangle a bit, pulling some funtions from the monolithic
hpux_compat.c into hpux_file.c, hpux_exec.c, etc.
* Fix a couple of bugs.
Yet to do:
* Move hp300-specific functions into hp300/hp300/hpux_machdep.c.
* Make everything work properly (you laugh...)
These changes are sufficient to run some simple HP-UX 9.x executables,
including ls(1) (which will read password and group information from the
YP server correctly, albeit slowly), a simple "hello world", uname(1),
and a few other odds and ends. Dynamically linked executables work, and
demand-paging _seems_ to work properly. Major problems:
* socket and/or signal handling appears to need some work yet.
* 99% sure I didn't do exactly the right thing adjusting for the
fact that "kstack" is gone now.
* ktrace(1)'ing some executables (HP-UX telnet(1) is what I tried)
causes the HP-UX executable to dump core with a SIGSEGV for an
as of yet unknown reason.
This is mostly meant as a checkpoint/snapshot, to make it easier for others
to track progress on this code, and hack on it themselves. It's certainly
better off now than before.
1995-11-28 11:39:45 +03:00
|
|
|
hpux_sys_pause_6x(p, v, retval)
|
1993-05-13 17:56:20 +04:00
|
|
|
struct proc *p;
|
1995-09-20 02:53:47 +04:00
|
|
|
void *v;
|
1994-10-20 07:47:31 +03:00
|
|
|
register_t *retval;
|
1993-05-13 17:56:20 +04:00
|
|
|
{
|
|
|
|
|
1998-10-01 07:26:18 +04:00
|
|
|
return (sigsuspend1(p, &p->p_sigmask));
|
1993-05-13 17:56:20 +04:00
|
|
|
}
|