Add ibcs2_sys_gtty.

This commit is contained in:
matt 2000-08-11 22:20:10 +00:00
parent ef5099c8d8
commit 66617b2137
2 changed files with 65 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibcs2_ioctl.c,v 1.19 2000/06/16 01:56:37 matt Exp $ */
/* $NetBSD: ibcs2_ioctl.c,v 1.20 2000/08/11 22:20:10 matt Exp $ */
/*
* Copyright (c) 1994, 1995 Scott Bartram
@ -559,3 +559,42 @@ ibcs2_sys_ioctl(p, v, retval)
return ENOSYS;
}
int
ibcs2_sys_gtty(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
struct ibcs2_sys_gtty_args /* {
syscallarg(int) fd;
syscallarg(struct sgttyb *) tb;
} */ *uap = v;
struct filedesc *fdp = p->p_fd;
struct file *fp;
struct sgttyb tb;
struct ibcs2_sgttyb itb;
int error;
if (SCARG(uap, fd) < 0 || SCARG(uap, fd) >= fdp->fd_nfiles ||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) {
DPRINTF(("ibcs2_sys_gtty(%d): bad fd %d ", p->p_pid,
SCARG(uap, fd)));
return EBADF;
}
if ((fp->f_flag & (FREAD|FWRITE)) == 0) {
DPRINTF(("ibcs2_sys_gtty(%d): bad fp flag ", p->p_pid));
return EBADF;
}
error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETP, (caddr_t)&tb, p);
if (error)
return error;
itb.sg_ispeed = tb.sg_ispeed;
itb.sg_ospeed = tb.sg_ospeed;
itb.sg_erase = tb.sg_erase;
itb.sg_kill = tb.sg_kill;
itb.sg_flags = tb.sg_flags & ~(IBCS2_GHUPCL|IBCS2_GXTABS);
return copyout((caddr_t)&itb, SCARG(uap, tb), sizeof(itb));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibcs2_termios.h,v 1.3 1994/10/26 02:53:07 cgd Exp $ */
/* $NetBSD: ibcs2_termios.h,v 1.4 2000/08/11 22:20:10 matt Exp $ */
/*
* Copyright (c) 1994 Scott Bartram
@ -231,5 +231,28 @@ struct ibcs2_winsize {
u_short ws_ypixel;
};
#endif /* _IBCS2_H_ */
#define IBCS2_GHUPCL 0x0001
#define IBCS2_GXTABS 0x0002
#define IBCS2_GLCASE 0x0004
#define IBCS2_GECHO 0x0008
#define IBCS2_GCRMOD 0x0010
#define IBCS2_GRAW 0x0020
#define IBCS2_GODDP 0x0040
#define IBCS2_GEVENP 0x0080
#define IBCS2_GANYP 0x00C0
#define IBCS2_GNLDELAY 0x0300
#define IBCS2_GTBDELAY 0x0400
#define IBCS2_GCRDELAY 0x3000
#define IBCS2_GVTDELAY 0x4000
#define IBCS2_GBSDELAY 0x8000
#define IBCS2_GALLDELAY 0xFF00
struct ibcs2_sgttyb {
char sg_ispeed;
char sg_ospeed;
char sg_erase;
char sg_kill;
int sg_flags;
};
#endif /* _IBCS2_H_ */