summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_ioctl.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-03-10 22:30:53 +0000
committerpeter <peter@FreeBSD.org>1996-03-10 22:30:53 +0000
commitc1675b084754e256319f785cbcf1445b51e10acc (patch)
tree416ff8e3674aa4fc3d27ecc7db6156e563938c9d /sys/compat/linux/linux_ioctl.c
parentf7d16bb60b381a2f1ae4e1d204eec150ec5dbb4a (diff)
downloadFreeBSD-src-c1675b084754e256319f785cbcf1445b51e10acc.zip
FreeBSD-src-c1675b084754e256319f785cbcf1445b51e10acc.tar.gz
Implement rudumentry support for the linux TIOC[SG]ETSERIAL ioctl's.
To complete this, some extra state has to be kept somewhere so that the B38400 flag in Linux can be correctly translated to/from either 38400, 57600 or 115200. Submitted by: Robert Sanders <rsanders@mindspring.com>
Diffstat (limited to 'sys/compat/linux/linux_ioctl.c')
-rw-r--r--sys/compat/linux/linux_ioctl.c63
1 files changed, 62 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 1dea454..9c9c668 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_ioctl.c,v 1.7 1996/03/03 19:07:50 peter Exp $
+ * $Id: linux_ioctl.c,v 1.8 1996/03/04 11:15:19 peter Exp $
*/
#include <sys/param.h>
@@ -82,6 +82,24 @@ static struct speedtab sptab[] = {
{ 57600, 4097 }, { 115200, 4098 }, {-1, -1 }
};
+struct linux_serial_struct {
+ int type;
+ int line;
+ int port;
+ int irq;
+ int flags;
+ int xmit_fifo_size;
+ int custom_divisor;
+ int baud_base;
+ unsigned short close_delay;
+ char reserved_char[2];
+ int hub6;
+ unsigned short closing_wait;
+ unsigned short closing_wait2;
+ int reserved[4];
+};
+
+
static int
linux_to_bsd_speed(int code, struct speedtab *table)
{
@@ -411,6 +429,23 @@ linux_to_bsd_termio(struct linux_termio *linux_termio,
linux_to_bsd_termios(&tmios, bsd_termios);
}
+static void
+linux_tiocgserial(struct file *fp, struct linux_serial_struct *lss)
+{
+ if (!fp || !lss)
+ return;
+
+ lss->type = LINUX_PORT_16550A;
+ lss->flags = 0;
+ lss->close_delay = 0;
+}
+
+static void
+linux_tiocsserial(struct file *fp, struct linux_serial_struct *lss)
+{
+ if (!fp || !lss)
+ return;
+}
int
linux_ioctl(struct proc *p, struct linux_ioctl_args *args, int *retval)
@@ -658,6 +693,32 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args, int *retval)
case LINUX_SNDCTL_DSP_NONBLOCK:
args->cmd = SNDCTL_DSP_NONBLOCK;
return ioctl(p, (struct ioctl_args *)args, retval);
+
+ case LINUX_TIOCGSERIAL:
+ linux_tiocgserial(fp, (struct linux_serial_struct *)args->arg);
+ return 0;
+
+ case LINUX_TIOCSSERIAL:
+ linux_tiocsserial(fp, (struct linux_serial_struct *)args->arg);
+ return 0;
+
+ case LINUX_TCFLSH:
+ args->cmd = TIOCFLUSH;
+ switch (args->arg) {
+ case LINUX_TCIFLUSH:
+ args->arg = FREAD;
+ break;
+ case LINUX_TCOFLUSH:
+ args->arg = FWRITE;
+ break;
+ case LINUX_TCIOFLUSH:
+ args->arg = FREAD | FWRITE;
+ break;
+ default:
+ return EINVAL;
+ }
+ return ioctl(p, (struct ioctl_args *)args, retval);
+
}
uprintf("LINUX: 'ioctl' fd=%d, typ=0x%x(%c), num=0x%x not implemented\n",
args->fd, (args->cmd&0xffff00)>>8,
OpenPOWER on IntegriCloud