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.
std::iostream sbuild::cctty (&cttybuf)

Variables

emap init_errors []
 This is a list of the supported error codes.

Typedef Documentation

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


Function Documentation

__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.

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

int @26::open_ctty (  )  [static]

Open the controlling terminal and return its file descriptor.

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

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

Set close-on-exec flag.

An error will be thrown on failure.

Parameters:
fd the file descriptor to set.


Variable Documentation

emap init_errors[] [static]

Initial value:

    {
      
      emap(CTTY_CLOEXEC, N_("The CTTY FD_CLOEXEC flag could not be set")),
      
      emap(CTTY_DUP,     N_("The CTTY 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 Sun Jul 8 21:23:37 2007 for sbuild by  doxygen 1.5.2