Usermode/libposix - Implimenting functions for dropbear
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / sys_ioctl.c
1 /*
2  * Acess2 POSIX Emulation
3  * - By John Hodge (thePowersGang)
4  *
5  * sys_ioctl.c
6  * - IOCtl hacks
7  */
8 #include <sys/ioctl.h>
9 #include <acess/sys.h>
10 #include <errno.h>
11
12 // === CODE ===
13 int ioctl(int fd, int request, ...)
14 {
15         if( fd < 0 ) {
16                 errno = EBADF;
17                 return -1;
18         }
19         
20         if( request < 0 ) {
21                 errno = EINVAL;
22                 return -1;
23         }
24
25         // #1. Get device type (IOCtl 0)
26         int devtype = _SysIOCtl(fd, 0, NULL);
27         
28         switch(devtype)
29         {
30         // 0: Normal file (no ioctls we care about)
31         case 0:
32         // 1: Has the ident set of ioctls, nothing else
33         case 1:
34                 return -1;
35         // TODO: Terminals
36         
37         // NFI
38         default:
39                 return -1;
40         }
41
42         return 0;
43 }
44
45

UCC git Repository :: git.ucc.asn.au