Changeset 3891
- Timestamp:
- Nov 6, 2009, 6:46:05 PM (13 years ago)
- Location:
- neercs/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/grab.c
r3875 r3891 39 39 #include "mytrace.h" 40 40 41 int grab_process(long pid, char *ptyname, int ptyfd )41 int grab_process(long pid, char *ptyname, int ptyfd, int *newpid) 42 42 { 43 43 #if defined HAVE_LINUX_KDEV_T_H … … 117 117 } 118 118 119 if(parent)120 {121 ret = mytrace_exec(parent, "/usr/bin/reset");122 if(ret < 0)123 mytrace_exit(parent, 0);124 mytrace_detach(parent);125 waitpid(pid, NULL, 0); /* Wait for reset to finish before displaying */126 mytrace_write(child, 2, "\x1b[H\x1b[2J", 7); 127 mytrace_write(child, 2, "\n[Process stolen by neercs]\r\n\n", 30);128 }119 ret = mytrace_exec(parent, "/usr/bin/reset"); 120 if(ret < 0) 121 mytrace_exit(parent, 0); 122 mytrace_detach(parent); 123 waitpid(pid, NULL, 0); /* Wait for reset to finish before displaying */ 124 mytrace_write(child, 2, "\x1b[H\x1b[2J", 7); 125 mytrace_write(child, 2, "\n[Process stolen by neercs]\r\n\n", 30); 126 127 pid = mytrace_getpid(child); 128 *newpid = pid; 129 129 130 130 /* Set the process's session ID */ … … 173 173 continue; 174 174 } 175 176 /* FIXME Only needed once */ 177 mytrace_sctty(child, fd); 178 175 179 if(validtos) 176 180 { -
neercs/trunk/src/mytrace.c
r3873 r3891 474 474 errno = err; 475 475 return ret; 476 #else 477 errno = ENOSYS; 478 return -1; 479 #endif 480 } 481 482 int mytrace_sctty(struct mytrace *t, int fd) 483 { 484 #if defined USE_GRAB 485 ptrace(PTRACE_SETOPTIONS, t->pid, NULL, PTRACE_O_TRACEEXIT); 486 return remote_syscall(t, MYCALL_IOCTL, fd, TIOCSCTTY, 0); 476 487 #else 477 488 errno = ENOSYS; -
neercs/trunk/src/mytrace.h
r3873 r3891 33 33 int mytrace_tcgets(struct mytrace *t, int fd, struct termios *tos); 34 34 int mytrace_tcsets(struct mytrace *t, int fd, struct termios *tos); 35 int mytrace_sctty(struct mytrace *t, int fd); -
neercs/trunk/src/neercs.h
r3876 r3891 227 227 228 228 int create_pty(char *cmd, unsigned int w, unsigned int h, int *cpid); 229 int create_pty_grab(long pid, unsigned int w, unsigned int h );230 int grab_process(long pid, char *ptyname, int ptyfd );229 int create_pty_grab(long pid, unsigned int w, unsigned int h, int *cpid); 230 int grab_process(long pid, char *ptyname, int ptyfd, int *newpid); 231 231 long select_process(struct screen_list* screen_list); 232 232 -
neercs/trunk/src/screens.c
r3551 r3891 45 45 s->h = h+1; 46 46 s->bell = 0; 47 s->pid = pid; 48 49 s->fd = create_pty_grab(pid, w, h); 47 48 s->fd = create_pty_grab(pid, w, h, &s->pid); 50 49 51 50 if(s->fd < 0) -
neercs/trunk/src/term.c
r3461 r3891 831 831 } 832 832 833 int create_pty_grab(long pid, unsigned int w, unsigned int h )833 int create_pty_grab(long pid, unsigned int w, unsigned int h, int *newpid) 834 834 { 835 835 int fdm, fds; … … 844 844 845 845 set_tty_size(0, w, h); 846 grab_process(pid, ptsname(fdm), fds );846 grab_process(pid, ptsname(fdm), fds, newpid); 847 847 848 848 fcntl(fdm, F_SETFL, O_NDELAY);
Note: See TracChangeset
for help on using the changeset viewer.