Ignore:
Timestamp:
Jun 18, 2008, 11:08:44 PM (14 years ago)
Author:
Pascal Terjan
Message:
  • Remove termios stuff, does not do anything currently
File:
1 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/grab.c

    r2450 r2451  
    55#include <stdlib.h>
    66#include <string.h>
    7 #include <termios.h>
    87#include <unistd.h>
    98
     
    180179}
    181180
    182 static int do_get_termios(pid_t pid, int fd, struct termios *t) {
    183     struct user_regs_struct regs;
    184     void *backup_page;
    185     void *target_page = (void*)(0x08048000);
    186     size_t size = (1<<12)*2; /* 8K */
    187     int ret;
    188 
    189     /* Backup the pages that we will use */
    190     backup_page = malloc(size);
    191     if (memcpy_from_target(pid, backup_page, target_page, size) < 0)
    192         return -1;
    193 
    194     if(ptrace(PTRACE_GETREGS, pid, NULL, &regs) < 0)
    195     {
    196         fprintf(stderr, "PTRACE_GETREGS failed\n");
    197         return errno;
    198     }
    199 
    200     regs.eax = SYS_ioctl;
    201     regs.ebx = fd;
    202     regs.ecx = TCGETS;
    203     regs.edx = ((long)target_page);
    204 
    205     if((ret = do_syscall(pid, &regs)) != 0)
    206     {
    207         return ret;
    208     }
    209 
    210     if (regs.eax < 0) {
    211         fprintf(stderr, "ioctl failed\n");
    212         return (-regs.eax);
    213     }
    214 
    215     memcpy_from_target(pid, t, (void*)(target_page), sizeof(struct termios));
    216 
    217     /* Restore the pages */
    218     memcpy_into_target(pid, target_page, backup_page, size);
    219 
    220     return 0;
    221 }
    222 
    223181static int do_setsid(pid_t pid) {
    224182    struct user_regs_struct regs;
     
    266224int grab_process(pid_t pid, char *ptyname, int ptyfd)
    267225{
    268     struct termios t;
    269226    int i, fd = 0, mode, ret;
    270227    char fdstr[1024];
     
    302259
    303260        debug("fd %d is a pty", i);
    304         if((ret = do_get_termios(pid, i, &t)))
    305         {
    306             fprintf(stderr, "do_get_termios %s\n", strerror(ret));
    307         }
    308261        if((ret = do_close(pid, i)))
    309262        {
Note: See TracChangeset for help on using the changeset viewer.