#include <config.h>
#include "sbuild-ctty.h"
#include <cerrno>
#include <cstring>
#include <ext/stdio_filebuf.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
Typedefs | |
typedef std::pair < ctty_error_code, const char * > | emap |
Functions | |
void | set_cloexec (int fd) |
Set close-on-exec flag. | |
int | open_ctty () |
Open the controlling terminal and return its file descriptor. | |
const int | sbuild::CTTY_FILENO (open_ctty()) |
int | cttybuf_fd () |
Get the file descriptor for cttybuf. | |
__gnu_cxx::stdio_filebuf< char > | cttybuf (cttybuf_fd(), std::ios::in|std::ios::out) |
A streambuf for cctty. | |
Variables | |
emap | init_errors [] |
This is a list of the supported error codes. | |
std::iostream sbuild::cctty & | cttybuf |
typedef std::pair<ctty_error_code,const char *> emap [static] |
__gnu_cxx::stdio_filebuf<char> @26::cttybuf | ( | cttybuf_fd() | , | |
std::ios::in|std::ios::out | ||||
) | [static] |
A streambuf for cctty.
int @26::cttybuf_fd | ( | ) | [static] |
Get the file descriptor for cttybuf.
An error will be thrown on failure.
References sbuild::CTTY_DUP, sbuild::CTTY_FILENO(), and set_cloexec().
int @26::open_ctty | ( | ) | [static] |
Open the controlling terminal and return its file descriptor.
References set_cloexec().
void @26::set_cloexec | ( | int | fd | ) | [static] |
Set close-on-exec flag.
An error will be thrown on failure.
fd | the file descriptor to set. |
References sbuild::CTTY_CLOEXEC.
Referenced by cttybuf_fd(), and open_ctty().
std::iostream sbuild::cctty& cttybuf |
emap init_errors[] [static] |
Initial value:
{ emap(CTTY_CLOEXEC, N_("The controlling terminal close-on-execute flag could not be set")), emap(CTTY_DUP, N_("The controlling terminal file descriptor could not be duplicated")) }
It's used to construct the real error codes map.