cntrl
XLOCALE_ISCTYPE(cntrl, _CTYPE_C)
exitcode = cntrl();
cmtseq(), conn(), startup(), cntrl();
static int pty_open_manager(const char *prog, int *cntrl, char *subsid_name);
static int pty_parent(const char *prog, int cntrl);
static int pty_stop_parent(int waserr, int cntrl, GetLine *gl, char *rbuff);
int cntrl = -1; /* The fd of the pseudo-terminal controller device */
if(pty_open_manager(prog, &cntrl, subsid_name))
status = pty_parent(prog, cntrl);
close(cntrl);
close(cntrl); /* The child doesn't use the subsidiary device */
static int pty_open_manager(const char *prog, int *cntrl, char *subsid_name)
*cntrl = -1;
*cntrl = open("/dev/ptmx", O_RDWR);
if(*cntrl >= 0) {
char *name = ptsname(*cntrl);
close(*cntrl);
*cntrl = -1;
while(*cntrl < 0 && (file = readdir(dir))) {
*cntrl = open(manager_name, O_RDWR);
if(*cntrl < 0)
if(*cntrl < 0) {
if(grantpt(*cntrl) < 0 ||
unlockpt(*cntrl) < 0) {
static int pty_parent(const char *prog, int cntrl)
return pty_stop_parent(1, cntrl, gl, rbuff);
return pty_stop_parent(1, cntrl, gl, rbuff);
if(gl_watch_fd(gl, cntrl, GLFD_READ, pty_read_from_program, rbuff))
return pty_stop_parent(1, cntrl, gl, rbuff);
if(pty_write_to_fd(cntrl, line, strlen(line)))
return pty_stop_parent(1, cntrl, gl, rbuff);
return pty_stop_parent(0, cntrl, gl, rbuff);
static int pty_stop_parent(int waserr, int cntrl, GetLine *gl, char *rbuff)
close(cntrl);
struct termios cntrl;
(void) ioctl(FD, TCGETS, &cntrl);
(void) cfsetospeed(&cntrl, B0);
cntrl.c_cflag &= ~XCLUDE;
(void) ioctl(FD, TCSETSF, &cntrl);
struct termios cntrl;
(void) ioctl(AC, TCGETS, &cntrl);
(void) cfsetospeed(&cntrl, B0);
(void) cfsetispeed(&cntrl, B0);
cntrl.c_cflag &= ~(CSIZE|PARENB|PARODD);
(void) cfsetospeed(&cntrl, B2400);
cntrl.c_cflag |= CS8;
cntrl.c_iflag &= IXOFF|IXANY;
cntrl.c_lflag &= ~(ICANON|ISIG);
cntrl.c_oflag = 0;
cntrl.c_cc[VMIN] = cntrl.c_cc[VTIME] = 0;
(void) ioctl(AC, TCSETSF, &cntrl);
DEFN_ISTYPE(cntrl, _ISCNTRL)
DEFN_ISWTYPE(cntrl, _CTYPE_C)
rsm_controller_t *cntrl;
cntrl = (rsm_controller_t *)seg->rsmseg_controller;
if (cntrl == NULL) {
e = cntrl->cntr_segops->rsm_memseg_import_getv(sg_io);
rsm_controller_t *cntrl;
cntrl = (rsm_controller_t *)seg->rsmseg_controller;
if (cntrl == NULL) {
e = cntrl->cntr_segops->rsm_memseg_import_putv(sg_io);
rsm_controller_t *cntrl = (rsm_controller_t *)cntrl_handle;
e = cntrl->cntr_segops->rsm_create_localmemory_handle(
rsm_controller_t *cntrl = (rsm_controller_t *)cntrl_handle;
e = cntrl->cntr_segops->rsm_free_localmemory_handle(local_handle);
test_ctype(cntrl);