added tcgetattr/tcsetattr for bash
authorAndrew Waterman <waterman@parcad.millennium.berkeley.edu>
Mon, 8 Feb 2010 23:00:35 +0000 (15:00 -0800)
committerAndrew Waterman <waterman@parcad.millennium.berkeley.edu>
Mon, 8 Feb 2010 23:00:35 +0000 (15:00 -0800)
kern/arch/sparc/frontend.h
kern/arch/sparc/syscalls.c
kern/include/ros/syscall.h
kern/include/syscall.h
kern/src/syscall.c

index ed3f315..15f5c15 100644 (file)
@@ -35,6 +35,8 @@ int32_t sys_nbputch(char ch);
 #define RAMP_SYSCALL_umask             60
 #define RAMP_SYSCALL_fcntl             62
 #define RAMP_SYSCALL_lstat             88
+#define RAMP_SYSCALL_tcgetattr         89
+#define RAMP_SYSCALL_tcsetattr         90
 #define RAMP_SYSCALL_closedir          91
 #define RAMP_SYSCALL_rewinddir         92
 #define RAMP_SYSCALL_readdir           93
index 5419fdb..851ded5 100644 (file)
@@ -318,3 +318,23 @@ intreg_t sys_gettimeofday(struct proc* p, int* buf)
        return memcpy_to_user_errno(p,buf,kbuf,sizeof(kbuf));
 }
 
+#define SIZEOF_STRUCT_TERMIOS 60
+intreg_t sys_tcgetattr(struct proc* p, int fd, void* termios_p)
+{
+       int kbuf[SIZEOF_STRUCT_TERMIOS/sizeof(int)];
+       int ret = fe(tcgetattr,fd,PADDR(kbuf),0,0);
+       if(ret != -1 && memcpy_to_user_errno(p,termios_p,kbuf,SIZEOF_STRUCT_TERMIOS))
+               ret = -1;
+       return ret;
+}
+
+intreg_t sys_tcsetattr(struct proc* p, int fd, int optional_actions, const void* termios_p)
+{
+       void* kbuf = user_memdup_errno(p,termios_p,SIZEOF_STRUCT_TERMIOS);
+       if(kbuf == NULL)
+               return -1;
+       int ret = fe(tcsetattr,fd,optional_actions,PADDR(kbuf),0);
+       user_memdup_free(p,kbuf);
+       return ret;
+}
+
index 29bfbad..cb3b001 100644 (file)
@@ -55,7 +55,9 @@
 #define SYS_unlink                             113
 #define SYS_chdir                              114
 #define SYS_getcwd                             115
-#define SYS_gettimeofday                       116
+#define SYS_gettimeofday               116
+#define SYS_tcgetattr                  117
+#define SYS_tcsetattr                  118
 
 /* For Buster Measurement Flags */
 #define BUSTER_SHARED                  0x0001
index 1b7c1e5..70c4343 100644 (file)
@@ -38,5 +38,7 @@ intreg_t sys_getcwd(struct proc* p, char* pwd, int size);
 intreg_t sys_gettimeofday(struct proc* p, int* buf);
 intreg_t sys_mprotect(struct proc* p, void* addr, size_t len, int prot);
 intreg_t sys_munmap(struct proc* p, void* addr, size_t len);
+intreg_t sys_tcsetattr(struct proc* p, int fd, int optional_actions, const void* termios_p);
+intreg_t sys_tcgetattr(struct proc* p, int fd, void* termios_p);
 
 #endif /* !ROS_KERN_SYSCALL_H */
index dc68230..1f3f86c 100644 (file)
@@ -697,6 +697,8 @@ intreg_t syscall(struct proc *p, uintreg_t syscallno, uintreg_t a1,
                [SYS_chdir] = (syscall_t)sys_chdir,
                [SYS_getcwd] = (syscall_t)sys_getcwd,
                [SYS_gettimeofday] = (syscall_t)sys_gettimeofday,
+               [SYS_tcgetattr] = (syscall_t)sys_tcgetattr,
+               [SYS_tcsetattr] = (syscall_t)sys_tcsetattr
        #endif
        };