MCPcopy Create free account
hub / github.com/F-Stack/f-stack / forkpty

Function forkpty

tools/libutil/pty.c:90–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90int
91forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
92{
93 int master, slave, pid;
94
95 if (openpty(&master, &slave, name, termp, winp) == -1)
96 return (-1);
97 switch (pid = fork()) {
98 case -1:
99 (void)close(slave);
100 return (-1);
101 case 0:
102 /*
103 * child
104 */
105 (void)close(master);
106 login_tty(slave);
107 return (0);
108 }
109 /*
110 * parent
111 */
112 *amaster = master;
113 (void) close(slave);
114 return (pid);
115}

Callers

nothing calls this directly

Calls 3

openptyFunction · 0.85
login_ttyFunction · 0.85
closeFunction · 0.50

Tested by

no test coverage detected