sbuild-ctty.cc File Reference

#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>

Include dependency graph for sbuild-ctty.cc:


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::ccttycttybuf

Typedef Documentation

typedef std::pair<ctty_error_code,const char *> emap [static]


Function Documentation

__gnu_cxx::stdio_filebuf<char> @30::cttybuf ( cttybuf_fd()  ,
std::ios::in|std::ios::out   
) [static]

A streambuf for cctty.

int @30::cttybuf_fd (  )  [static]

Get the file descriptor for cttybuf.

An error will be thrown on failure.

Returns:
the CTTY_FILENO file descriptor if there is a CTTY, or a duplicated file descriptor for stdin otherwise.

References sbuild::CTTY_DUP, sbuild::CTTY_FILENO(), and set_cloexec().

int @30::open_ctty (  )  [static]

Open the controlling terminal and return its file descriptor.

Returns:
the CTTY fd, or -1 on failure.

References set_cloexec().

void @30::set_cloexec ( int  fd  )  [static]

Set close-on-exec flag.

An error will be thrown on failure.

Parameters:
fd the file descriptor to set.

References sbuild::CTTY_CLOEXEC.

Referenced by cttybuf_fd(), and open_ctty().


Variable Documentation

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"))
    }
This is a list of the supported error codes.

It's used to construct the real error codes map.


Generated on Sat Jul 5 11:59:17 2008 for sbuild by  doxygen 1.5.6