} while (0)
static void test_console_close_all(int ttyfd[MAXCONSOLES],
- int masterfd[MAXCONSOLES])
+ int ptmxfd[MAXCONSOLES])
{
int i;
for (i = 0; i < MAXCONSOLES; i++) {
- if (masterfd[i] != -1) {
- close(masterfd[i]);
- masterfd[i] = -1;
+ if (ptmxfd[i] != -1) {
+ close(ptmxfd[i]);
+ ptmxfd[i] = -1;
}
if (ttyfd[i] != -1) {
int nrconsoles, i, ret = -1;
int ttynum [MAXCONSOLES];
int ttyfd [MAXCONSOLES];
- int masterfd[MAXCONSOLES];
+ int ptmxfd[MAXCONSOLES];
for (i = 0; i < MAXCONSOLES; i++)
- ttynum[i] = ttyfd[i] = masterfd[i] = -1;
+ ttynum[i] = ttyfd[i] = ptmxfd[i] = -1;
ttynum[0] = 1;
- ret = c->console_getfd(c, &ttynum[0], &masterfd[0]);
+ ret = c->console_getfd(c, &ttynum[0], &ptmxfd[0]);
if (ret < 0) {
TSTERR("console allocate failed");
goto err1;
}
/* attempt to alloc same ttynum */
- ret = c->console_getfd(c, &ttynum[0], &masterfd[1]);
+ ret = c->console_getfd(c, &ttynum[0], &ptmxfd[1]);
if (ret != -1) {
TSTERR("console allocate should fail for allocated ttynum %d", ttynum[0]);
goto err2;
}
- close(masterfd[0]); masterfd[0] = -1;
+ close(ptmxfd[0]); ptmxfd[0] = -1;
close(ttyfd[0]); ttyfd[0] = -1;
/* ensure we can allocate all consoles, we do this a few times to
*/
for (i = 0; i < 10; i++) {
for (nrconsoles = 0; nrconsoles < MAXCONSOLES; nrconsoles++) {
- ret = c->console_getfd(c, &ttynum[nrconsoles], &masterfd[nrconsoles]);
+ ret = c->console_getfd(c, &ttynum[nrconsoles], &ptmxfd[nrconsoles]);
if (ret < 0)
break;
ttyfd[nrconsoles] = ret;
goto err2;
}
- test_console_close_all(ttyfd, masterfd);
+ test_console_close_all(ttyfd, ptmxfd);
}
ret = 0;
err2:
- test_console_close_all(ttyfd, masterfd);
+ test_console_close_all(ttyfd, ptmxfd);
err1:
return ret;