/usr/include/bobcat/ifdstreambuf is in libbobcat-dev 2.20.01-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #ifndef INCLUDED_BOBCAT_IFDSTREAMBUF_
#define INCLUDED_BOBCAT_IFDSTREAMBUF_
#include <streambuf>
namespace FBB
{
class IFdStreambuf: public std::streambuf
{
public:
// Mode defines what to do with the file descriptor at
// destruction-time or when the default open is
// called. CLOSE_FD will close the fd, KEEP_FD will leave the
// fd as-is. When open is called with a Mode argument, then
// the provided argument is used for the actual fd. The Mode
// specified at the constructor is therefore only used for the
// mode-less open() call and for the destructor.
enum Mode
{
CLOSE_FD,
KEEP_FD,
};
private:
Mode d_mode;
int d_fd;
size_t d_n;
char* d_buffer;
public:
IFdStreambuf();
explicit IFdStreambuf(Mode mode);
explicit IFdStreambuf(int fd, size_t n = 1);
IFdStreambuf(int fd, Mode mode, size_t n = 1);
IFdStreambuf(IFdStreambuf const &other) = delete;
~IFdStreambuf();
IFdStreambuf &operator=(IFdStreambuf const &other) = delete;
void close();
void open(int xfd, Mode mode, size_t n = 1);
void open(int xfd, size_t n = 1);
int fd() const;
private:
virtual int underflow();
virtual std::streamsize xsgetn(char *dest, std::streamsize n);
void cleanup(Mode mode);
};
inline void IFdStreambuf::open(int xfd, size_t n)
{
open(xfd, d_mode, n);
}
inline void IFdStreambuf::close()
{
cleanup(CLOSE_FD);
}
inline int IFdStreambuf::fd() const
{
return d_fd;
}
} // FBB
#endif
|