- Timestamp:
- Jun 15, 2008, 7:17:36 PM (13 years ago)
- Location:
- neercs/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/grab.c
r2428 r2429 256 256 } 257 257 258 int grab_process(pid_t pid, int ptyfd)258 int grab_process(pid_t pid, char *ptyname, int ptyfd) 259 259 { 260 260 struct termios t; 261 261 int i, fd = 0, mode, ret; 262 char tty[1024];263 262 char fdstr[1024]; 264 263 struct stat stat_buf; 265 264 266 snprintf(fdstr, sizeof(fdstr), "/proc/%d/fd/%d", getpid(), ptyfd); 267 if ((i = readlink(fdstr, tty, sizeof(tty)-1)) == -1) { 268 fprintf(stderr, "readlink failed\n"); 269 return -1; 270 } 271 tty[i] = 0; 272 debug("Our pty is %s", tty); 265 debug("pty is %s", ptyname); 273 266 274 267 if(ptrace(PTRACE_ATTACH, pid, 0, 0) < 0) … … 304 297 fprintf(stderr, "do_close %s\n", strerror(ret)); 305 298 } 306 if((ret = do_open(pid, tty, mode, &fd)))299 if((ret = do_open(pid, ptyname, mode, &fd))) 307 300 { 308 301 fprintf(stderr, "do_open %s\n", strerror(ret)); -
neercs/trunk/src/neercs.h
r2426 r2429 77 77 int create_pty(char *cmd, unsigned int w, unsigned int h, int *cpid); 78 78 int create_pty_grab(pid_t pid, unsigned int w, unsigned int h); 79 int grab_process(pid_t pid, int ptyfd);79 int grab_process(pid_t pid, char *ptyname, int ptyfd); 80 80 81 81 long int import_term(struct screen_list *screen_list, struct screen *sc, void const *data, unsigned int size); -
neercs/trunk/src/term.c
r2426 r2429 15 15 #include "config.h" 16 16 17 #define _XOPEN_SOURCE 17 18 #include <stdlib.h> 18 19 #include <stdio.h> … … 590 591 591 592 set_tty_size(0, w, h); 592 grab_process(pid, fds);593 grab_process(pid, ptsname(fdm), fds); 593 594 594 595 fcntl(fdm, F_SETFL, O_NDELAY);
Note: See TracChangeset
for help on using the changeset viewer.