Centralize the HP-UX file flags translation stuff.
This commit is contained in:
parent
b0ca4831ea
commit
d7cef923ac
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hpux.h,v 1.9 1995/11/28 08:39:47 thorpej Exp $ */
|
||||
/* $NetBSD: hpux.h,v 1.10 1995/12/08 07:54:43 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Jason R. Thorpe. All rights reserved.
|
||||
@ -321,3 +321,10 @@ struct hpux_sigaction {
|
||||
* code to the HP-UX EAGAIN value.
|
||||
*/
|
||||
#define OEAGAIN 82
|
||||
|
||||
/*
|
||||
* Extensions to the fd_ofileflags flags.
|
||||
*/
|
||||
#define HPUX_UF_NONBLOCK_ON 0x10
|
||||
#define HPUX_UF_FNDELAY_ON 0x20
|
||||
#define HPUX_UF_FIONBIO_ON 0x40
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hpux_compat.c,v 1.20 1995/11/28 08:39:48 thorpej Exp $ */
|
||||
/* $NetBSD: hpux_compat.c,v 1.21 1995/12/08 07:54:46 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -121,15 +121,6 @@ extern char sigcode[], esigcode[];
|
||||
extern struct sysent hpux_sysent[];
|
||||
extern char *hpux_syscallnames[];
|
||||
|
||||
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
|
||||
/*
|
||||
* XXX extensions to the fd_ofileflags flags.
|
||||
* Hate to put this there, but they do need to be per-file.
|
||||
*/
|
||||
#define UF_NONBLOCK_ON 0x10
|
||||
#define UF_FNDELAY_ON 0x20
|
||||
#define UF_FIONBIO_ON 0x40
|
||||
|
||||
static int hpux_scale __P((struct timeval *));
|
||||
|
||||
/*
|
||||
@ -307,10 +298,10 @@ hpux_sys_read(p, v, retval)
|
||||
if (error == EWOULDBLOCK) {
|
||||
char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)];
|
||||
|
||||
if (*fp & UF_NONBLOCK_ON) {
|
||||
if (*fp & HPUX_UF_NONBLOCK_ON) {
|
||||
*retval = -1;
|
||||
error = OEAGAIN;
|
||||
} else if (*fp & UF_FNDELAY_ON) {
|
||||
} else if (*fp & HPUX_UF_FNDELAY_ON) {
|
||||
*retval = 0;
|
||||
error = 0;
|
||||
}
|
||||
@ -331,10 +322,10 @@ hpux_sys_write(p, v, retval)
|
||||
if (error == EWOULDBLOCK) {
|
||||
char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)];
|
||||
|
||||
if (*fp & UF_NONBLOCK_ON) {
|
||||
if (*fp & HPUX_UF_NONBLOCK_ON) {
|
||||
*retval = -1;
|
||||
error = OEAGAIN;
|
||||
} else if (*fp & UF_FNDELAY_ON) {
|
||||
} else if (*fp & HPUX_UF_FNDELAY_ON) {
|
||||
*retval = 0;
|
||||
error = 0;
|
||||
}
|
||||
@ -355,10 +346,10 @@ hpux_sys_readv(p, v, retval)
|
||||
if (error == EWOULDBLOCK) {
|
||||
char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)];
|
||||
|
||||
if (*fp & UF_NONBLOCK_ON) {
|
||||
if (*fp & HPUX_UF_NONBLOCK_ON) {
|
||||
*retval = -1;
|
||||
error = OEAGAIN;
|
||||
} else if (*fp & UF_FNDELAY_ON) {
|
||||
} else if (*fp & HPUX_UF_FNDELAY_ON) {
|
||||
*retval = 0;
|
||||
error = 0;
|
||||
}
|
||||
@ -379,10 +370,10 @@ hpux_sys_writev(p, v, retval)
|
||||
if (error == EWOULDBLOCK) {
|
||||
char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)];
|
||||
|
||||
if (*fp & UF_NONBLOCK_ON) {
|
||||
if (*fp & HPUX_UF_NONBLOCK_ON) {
|
||||
*retval = -1;
|
||||
error = OEAGAIN;
|
||||
} else if (*fp & UF_FNDELAY_ON) {
|
||||
} else if (*fp & HPUX_UF_FNDELAY_ON) {
|
||||
*retval = 0;
|
||||
error = 0;
|
||||
}
|
||||
@ -1002,14 +993,14 @@ hpux_sys_ioctl(p, v, retval)
|
||||
int tmp;
|
||||
|
||||
if (*(int *)dt)
|
||||
*ofp |= UF_FIONBIO_ON;
|
||||
*ofp |= HPUX_UF_FIONBIO_ON;
|
||||
else
|
||||
*ofp &= ~UF_FIONBIO_ON;
|
||||
*ofp &= ~HPUX_UF_FIONBIO_ON;
|
||||
/*
|
||||
* Only set/clear if O_NONBLOCK/FNDELAY not in effect
|
||||
*/
|
||||
if ((*ofp & (UF_NONBLOCK_ON|UF_FNDELAY_ON)) == 0) {
|
||||
tmp = *ofp & UF_FIONBIO_ON;
|
||||
if ((*ofp & (HPUX_UF_NONBLOCK_ON|HPUX_UF_FNDELAY_ON)) == 0) {
|
||||
tmp = *ofp & HPUX_UF_FIONBIO_ON;
|
||||
error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO,
|
||||
(caddr_t)&tmp, p);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hpux_exec.c,v 1.1 1995/11/28 08:39:57 thorpej Exp $ */
|
||||
/* $NetBSD: hpux_exec.c,v 1.2 1995/12/08 07:54:50 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Jason R. Thorpe. All rights reserved.
|
||||
@ -171,7 +171,8 @@ exec_hpux_prep_zmagic(p, epp)
|
||||
struct exec_package *epp;
|
||||
{
|
||||
struct hpux_exec *execp = epp->ep_hdr;
|
||||
long bsize, baddr, nontext;
|
||||
long bsize, baddr;
|
||||
long nontext;
|
||||
int (*vm_func) __P((struct proc *, struct exec_vmcmd *));
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hpux_file.c,v 1.1 1995/11/28 08:39:58 thorpej Exp $ */
|
||||
/* $NetBSD: hpux_file.c,v 1.2 1995/12/08 07:54:53 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Jason R. Thorpe. All rights reserved.
|
||||
@ -115,14 +115,6 @@ hpux_sys_creat(p, v, retval)
|
||||
return sys_open(p, &oa, retval);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX extensions to the fd_ofileflags flags.
|
||||
* Hate to put this there, but they do need to be per-file.
|
||||
*/
|
||||
#define UF_NONBLOCK_ON 0x10
|
||||
#define UF_FNDELAY_ON 0x20
|
||||
#define UF_FIONBIO_ON 0x40
|
||||
|
||||
/*
|
||||
* HP-UX open(2) system call.
|
||||
*
|
||||
@ -196,7 +188,8 @@ hpux_sys_open(p, v, retval)
|
||||
*/
|
||||
if ((error == 0) && (nflags & O_NDELAY))
|
||||
p->p_fd->fd_ofileflags[*retval] |=
|
||||
(flags & HPUXNONBLOCK) ? UF_NONBLOCK_ON : UF_FNDELAY_ON;
|
||||
(flags & HPUXNONBLOCK) ?
|
||||
HPUX_UF_NONBLOCK_ON : HPUX_UF_FNDELAY_ON;
|
||||
|
||||
return (error);
|
||||
}
|
||||
@ -233,16 +226,16 @@ hpux_sys_fcntl(p, v, retval)
|
||||
switch (SCARG(uap, cmd)) {
|
||||
case F_SETFL:
|
||||
if (arg & HPUXNONBLOCK)
|
||||
*pop |= UF_NONBLOCK_ON;
|
||||
*pop |= HPUX_UF_NONBLOCK_ON;
|
||||
else
|
||||
*pop &= ~UF_NONBLOCK_ON;
|
||||
*pop &= ~HPUX_UF_NONBLOCK_ON;
|
||||
|
||||
if (arg & HPUXNDELAY)
|
||||
*pop |= UF_FNDELAY_ON;
|
||||
*pop |= HPUX_UF_FNDELAY_ON;
|
||||
else
|
||||
*pop &= ~UF_FNDELAY_ON;
|
||||
*pop &= ~HPUX_UF_FNDELAY_ON;
|
||||
|
||||
if (*pop & (UF_NONBLOCK_ON|UF_FNDELAY_ON|UF_FIONBIO_ON))
|
||||
if (*pop & (HPUX_UF_NONBLOCK_ON|HPUX_UF_FNDELAY_ON|HPUX_UF_FIONBIO_ON))
|
||||
arg |= FNONBLOCK;
|
||||
else
|
||||
arg &= ~FNONBLOCK;
|
||||
@ -351,10 +344,10 @@ hpux_sys_fcntl(p, v, retval)
|
||||
mode = *retval;
|
||||
*retval &= ~(O_CREAT|O_TRUNC|O_EXCL);
|
||||
if (mode & FNONBLOCK) {
|
||||
if (*pop & UF_NONBLOCK_ON)
|
||||
if (*pop & HPUX_UF_NONBLOCK_ON)
|
||||
*retval |= HPUXNONBLOCK;
|
||||
|
||||
if ((*pop & UF_FNDELAY_ON) == 0)
|
||||
if ((*pop & HPUX_UF_FNDELAY_ON) == 0)
|
||||
*retval &= ~HPUXNDELAY;
|
||||
}
|
||||
if (mode & O_CREAT)
|
||||
|
Loading…
Reference in New Issue
Block a user