diff --git a/sys/include/sys/ioctl.h b/sys/include/sys/ioctl.h index 6a2a0b2..b3ed165 100644 --- a/sys/include/sys/ioctl.h +++ b/sys/include/sys/ioctl.h @@ -25,30 +25,29 @@ /* this should be _IORW, but stdio got there first */ #define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) - #define IOCPARM_IVAL(x) ((int)(intptr_t)(void *)*(caddr_t *)(void *)(x)) #define NCCS 20 -typedef unsigned int tcflag_t; -typedef unsigned char cc_t; -typedef unsigned int speed_t; +typedef unsigned int tcflag_t; +typedef unsigned char cc_t; +typedef unsigned int speed_t; struct termios { - tcflag_t c_iflag; /* input flags */ - tcflag_t c_oflag; /* output flags */ - tcflag_t c_cflag; /* control flags */ - tcflag_t c_lflag; /* local flags */ - cc_t c_cc[NCCS]; /* control chars */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ + tcflag_t c_iflag; /* input flags */ + tcflag_t c_oflag; /* output flags */ + tcflag_t c_cflag; /* control flags */ + tcflag_t c_lflag; /* local flags */ + cc_t c_cc[NCCS]; /* control chars */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ }; struct winsize { - unsigned short ws_row; /* rows, in characters */ - unsigned short ws_col; /* columns, in characters */ - unsigned short ws_xpixel; /* horizontal size, pixels */ - unsigned short ws_ypixel; /* vertical size, pixels */ + unsigned short ws_row; /* rows, in characters */ + unsigned short ws_col; /* columns, in characters */ + unsigned short ws_xpixel; /* horizontal size, pixels */ + unsigned short ws_ypixel; /* vertical size, pixels */ }; #define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */ diff --git a/sys/kernel/descrip.c b/sys/kernel/descrip.c index 47f7ac1..4e663b2 100644 --- a/sys/kernel/descrip.c +++ b/sys/kernel/descrip.c @@ -52,15 +52,15 @@ fp = (struct file *) td->o_files[uap->fd]; switch (uap->cmd) { - case 3: - td->td_retval[0] = fp->f_flag; + case 3: + td->td_retval[0] = fp->f_flag; break; - case 4: - fp->f_flag &= ~FCNTLFLAGS; - fp->f_flag |= FFLAGS(uap->arg & ~O_ACCMODE) & FCNTLFLAGS; + case 4: + fp->f_flag &= ~FCNTLFLAGS; + fp->f_flag |= FFLAGS(uap->arg & ~O_ACCMODE) & FCNTLFLAGS; break; - default: - kprintf("ERROR DEFAULT"); + default: + kprintf("ERROR DEFAULT"); } return (0x0); @@ -100,7 +100,8 @@ if (td->o_files[fd] != fp) { error = -1; - } else { + } + else { kfree(td->o_files[fd]); td->o_files[fd] = 0x0; } @@ -216,9 +217,9 @@ } break; case TIOCGWINSZ: - struct winsize *win = struct winsize *) args->data; - win.ws_row = 50; - win.ws_col = 80; + struct winsize *win = (struct winsize *) args->data; + win->ws_row = 50; + win->ws_col = 80; break; default: kprintf("ioFD:%i:0x%X!", args->fd, args->com); @@ -232,57 +233,57 @@ int sys_select(struct thread *td, struct sys_select_args *args) { int error = 0x0; /* - int i = 0x0; + int i = 0x0; - fd_set sock_rfds; - fd_set sock_wfds; - fd_set sock_efds; + fd_set sock_rfds; + fd_set sock_wfds; + fd_set sock_efds; - FD_ZERO(&sock_rfds); - FD_ZERO(&sock_wfds); - FD_ZERO(&sock_efds); + FD_ZERO(&sock_rfds); + FD_ZERO(&sock_wfds); + FD_ZERO(&sock_efds); - if (args->in != 0x0) { - for (i = 0; i < args->nd; i++) { - FD_SET(((struct file * ) td->o_files[args->in[0]]).socket, &sock_rfds); - } - } + if (args->in != 0x0) { + for (i = 0; i < args->nd; i++) { + FD_SET(((struct file * ) td->o_files[args->in[0]]).socket, &sock_rfds); + } + } - if (args->ou != 0x0) { - for (i = 0; i < args->nd; i++) { - FD_SET(((struct file * ) td->o_files[args->ou[0]]).socket, &sock_wfds); - } - } + if (args->ou != 0x0) { + for (i = 0; i < args->nd; i++) { + FD_SET(((struct file * ) td->o_files[args->ou[0]]).socket, &sock_wfds); + } + } - if (args->ex != 0x0) { - for (i = 0; i < args->nd; i++) { - FD_SET(((struct file * ) td->o_files[args->ex[0]]).socket, &sock_efds); - } - } + if (args->ex != 0x0) { + for (i = 0; i < args->nd; i++) { + FD_SET(((struct file * ) td->o_files[args->ex[0]]).socket, &sock_efds); + } + } - if ((td->td_retval[0] = lwip_select(args->nd, &sock_rfds, &sock_wfds, &sock_efds, args->tv)) == -1) - error = -1; + if ((td->td_retval[0] = lwip_select(args->nd, &sock_rfds, &sock_wfds, &sock_efds, args->tv)) == -1) + error = -1; - if (args->in != 0x0) { - for (i = 0; i < MAX_FILES; i++) { - if (!FD_ISSET(((struct file * ) td->o_files[args->ou[0]]).socket, &sock_rfds)) - FD_CLR(((struct file * ) td->o_files[args->ou[0]]).socket, args->in); - } - } + if (args->in != 0x0) { + for (i = 0; i < MAX_FILES; i++) { + if (!FD_ISSET(((struct file * ) td->o_files[args->ou[0]]).socket, &sock_rfds)) + FD_CLR(((struct file * ) td->o_files[args->ou[0]]).socket, args->in); + } + } - if (args->ou != 0x0) { - for (i = 0; i < MAX_FILES; i++) { - if (!FD_ISSET(((struct file * ) td->o_files[args->ou[0]]).socket, &sock_wfds)) - FD_CLR(((struct file * ) td->o_files[args->ou[0]]).socket, args->ou); - } - } + if (args->ou != 0x0) { + for (i = 0; i < MAX_FILES; i++) { + if (!FD_ISSET(((struct file * ) td->o_files[args->ou[0]]).socket, &sock_wfds)) + FD_CLR(((struct file * ) td->o_files[args->ou[0]]).socket, args->ou); + } + } - if (args->ex != 0x0) { - for (i = 0; i < MAX_FILES; i++) { - if (!FD_ISSET(((struct file * ) td->o_files[args->ou[0]]).socket, &sock_efds)) - FD_CLR(((struct file * ) td->o_files[args->ou[0]]).socket, args->ex); - } - } + if (args->ex != 0x0) { + for (i = 0; i < MAX_FILES; i++) { + if (!FD_ISSET(((struct file * ) td->o_files[args->ou[0]]).socket, &sock_efds)) + FD_CLR(((struct file * ) td->o_files[args->ou[0]]).socket, args->ex); + } + } */