Lines Matching defs:cntrl

113 static int pty_open_master(const char *prog, int *cntrl, char *slave_name);
116 static int pty_parent(const char *prog, int cntrl);
117 static int pty_stop_parent(int waserr, int cntrl, GetLine *gl, char *rbuff);
131 int cntrl = -1; /* The fd of the pseudo-terminal controller device */
172 if(pty_open_master(prog, &cntrl, slave_name))
201 status = pty_parent(prog, cntrl);
202 close(cntrl);
204 close(cntrl); /* The child doesn't use the slave device */
223 * cntrl int * The file descriptor of the pseudo-terminal
224 * controller device will be assigned tp *cntrl.
232 static int pty_open_master(const char *prog, int *cntrl, char *slave_name)
240 *cntrl = -1;
248 *cntrl = open("/dev/ptmx", O_RDWR);
249 if(*cntrl >= 0) {
253 char *name = ptsname(*cntrl);
265 close(*cntrl);
266 *cntrl = -1;
287 while(*cntrl < 0 && (file = readdir(dir))) {
301 *cntrl = open(master_name, O_RDWR);
302 if(*cntrl < 0)
319 if(*cntrl < 0) {
328 if(grantpt(*cntrl) < 0 ||
329 unlockpt(*cntrl) < 0) {
411 * cntrl int The file descriptor of the controller end of the
417 static int pty_parent(const char *prog, int cntrl)
427 return pty_stop_parent(1, cntrl, gl, rbuff);
434 return pty_stop_parent(1, cntrl, gl, rbuff);
440 if(gl_watch_fd(gl, cntrl, GLFD_READ, pty_read_from_program, rbuff))
441 return pty_stop_parent(1, cntrl, gl, rbuff);
447 if(pty_write_to_fd(cntrl, line, strlen(line)))
448 return pty_stop_parent(1, cntrl, gl, rbuff);
451 return pty_stop_parent(0, cntrl, gl, rbuff);
464 * cntrl int The file descriptor of the controller end of the
472 static int pty_stop_parent(int waserr, int cntrl, GetLine *gl, char *rbuff)
478 close(cntrl);