this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implemented a few more PTY ioctls (#100)

mc subshell is sadly still not working.

+74 -1
+8
src/kernel/emulation/linux/ioctl/filio.c
··· 15 15 16 16 extern int sprintf(char* buf, const char* fmt, ...); 17 17 extern int strncmp(const char *, const char *, __SIZE_TYPE__); 18 + extern __SIZE_TYPE__ strlen(const char*); 19 + extern void* memmove(void*, void*, __SIZE_TYPE__); 20 + 18 21 static bool get_fd_path(int fd, char* buf, size_t len) 19 22 { 20 23 char proc[32]; ··· 27 30 return false; 28 31 29 32 buf[ret] = 0; 33 + if (strncmp(buf, "/Volumes/SystemRoot/dev/", 24) == 0) 34 + { 35 + // Remove /Volumes/SystemRoot from the start 36 + memmove(buf, buf + 19, strlen(buf + 19) + 1); 37 + } 30 38 return true; 31 39 } 32 40
+55
src/kernel/emulation/linux/ioctl/termios.c
··· 3 3 #include <stddef.h> 4 4 #include <stdint.h> 5 5 #include <stdbool.h> 6 + #include "../simple.h" 6 7 7 8 // Speeds are stored in cflags 8 9 // http://osxr.org/glibc/source/sysdeps/unix/sysv/linux/speed.c?v=glibc-2.13 ··· 152 153 *retval = __real_ioctl(fd, 0x00005411, arg); 153 154 return IOCTL_HANDLED; 154 155 } 156 + case BSD_TIOCPTYUNLK: 157 + { 158 + int unlock = 0; 159 + *retval = __real_ioctl(fd, LINUX_TIOCSPTLCK, &unlock); 160 + return IOCTL_HANDLED; 161 + } 162 + case BSD_TIOCPTYGNAME: 163 + { 164 + char* buf = (char*) arg; // 128-byte long buffer 165 + int ptyno; 166 + 167 + *retval = __real_ioctl(fd, LINUX_TIOCGPTN, &ptyno); 168 + if (*retval == 0) 169 + { 170 + __simple_sprintf(buf, "/dev/pts/%d", ptyno); 171 + } 172 + 173 + return IOCTL_HANDLED; 174 + } 175 + case BSD_TIOCPTYGRANT: 176 + { 177 + *retval = 0; 178 + return IOCTL_HANDLED; 179 + } 180 + case BSD_TIOCSCTTY: 181 + { 182 + *retval = __real_ioctl(fd, LINUX_TIOCSCTTY, arg); 183 + return IOCTL_HANDLED; 184 + } 185 + case BSD_TIOCCONS: 186 + { 187 + *retval = __real_ioctl(fd, LINUX_TIOCCONS, 0); 188 + return IOCTL_HANDLED; 189 + } 190 + case BSD_TIOCFLUSH: 191 + { 192 + int queue = (int) arg; 193 + switch (queue) 194 + { 195 + case BSD_TCIFLUSH: 196 + queue = LINUX_TCIFLUSH; break; 197 + case BSD_TCOFLUSH: 198 + queue = LINUX_TCOFLUSH; break; 199 + case BSD_TCIOFLUSH: 200 + queue = LINUX_TCIOFLUSH; break; 201 + default: 202 + *retval = -EINVAL; 203 + return IOCTL_HANDLED; 204 + } 205 + 206 + *retval = __real_ioctl(fd, LINUX_TCFLSH, queue); 207 + return IOCTL_HANDLED; 208 + } 155 209 default: 156 210 __simple_printf("Passing thru unhandled ioctl 0x%x on fd %d\n", cmd, fd); 211 + __builtin_trap(); 157 212 return IOCTL_PASS; 158 213 } 159 214 }
+11 -1
src/kernel/emulation/linux/ioctl/termios.h
··· 129 129 #define BSD_TIOCSDRAINWAIT BSD_IOW('t', 87, int) 130 130 #define BSD_TIOCGDRAINWAIT BSD_IOR('t', 86, int) 131 131 #define BSD_TIOCPTYGRANT BSD_IO('t', 84) 132 - #define BSD_TIOCPTYGNAME BSD_IOC(IOC_OUT, 't', 83, 128) 132 + #define BSD_TIOCPTYGNAME BSD_IOC(BSD_IOC_OUT, 't', 83, 128) 133 133 #define BSD_TIOCPTYUNLK BSD_IO('t', 82) 134 134 135 135 #define BSD_IGNBRK 0x00000001 ··· 367 367 368 368 #define LINUX_POSIX_VDISABLE ((unsigned char)'\0') 369 369 #define BSD_POSIX_VDISABLE ((unsigned char)'\377') 370 + 371 + #define LINUX_TIOCSPTLCK LINUX_IOW('T', 0x31, int) 372 + #define LINUX_TIOCGPTN LINUX_IOR('T', 0x30, unsigned int) 373 + 374 + #define BSD_TCIFLUSH 1 375 + #define BSD_TCOFLUSH 2 376 + #define BSD_TCIOFLUSH 3 377 + #define LINUX_TCIFLUSH 0 378 + #define LINUX_TCOFLUSH 1 379 + #define LINUX_TCIOFLUSH 2 370 380 371 381 #endif 372 382