/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.
*/
/* * O_NOCTTY (?) we'll be a group leader in any case (?) * So will get a controlling terminal.. O_NOCTTY - do we need it? *
*/ if ((masterfd = posix_openpt(O_RDWR | O_NOCTTY)) == -1) { return -1;
}
#ifdefined(TIOCSCTTY) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__APPLE__) // If this terminal is already the controlling // terminal of a different session group then the // ioctl fails with EPERM, unless the caller is root if (ioctl(pty_fd, TIOCSCTTY, 0) == -1) {
printf("ERROR ioctl(TIOCSCTTY) failed on \"pty %d\" -- %s\n",
pty_fd, strerror(errno)); exit(-1);
} #endif
/* * Slave becomes stdin/stdout/stderr of child.
*/ if (dup2(pty_fd, STDIN_FILENO) != STDIN_FILENO) {
err_sys("dup2 error to stdin");
}
if (dup2(pty_fd, STDOUT_FILENO) != STDOUT_FILENO) {
err_sys("dup2 error to stdout");
}
if (dup2(pty_fd, STDERR_FILENO) != STDERR_FILENO) {
err_sys("dup2 error to stderr");
}
close(pty_fd);
}
¤ Dauer der Verarbeitung: 0.28 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.