ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc.. Fossies Dox: ucommon-7.0.0.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 19 #ifndef UCOMMON_SYSRUNTIME 21 #include <ucommon-config.h> 31 #include <netinet/tcp.h> 32 #include <arpa/inet.h> 33 #include <sys/socket.h> 40 #ifdef HAVE_SYS_RESOURCE_H 42 #include <sys/resource.h> 51 #define EOF std::streambuf::traits_type::eof() 52 #define IS_EOF(x) std::streambuf::traits_type::eq_int_type(x, EOF) 53 #define GET(x) std::streambuf::traits_type::to_int_type(x) 54 #define PUT(x) std::streambuf::traits_type::to_char_type(x) 57 streambuf(), iostream((streambuf *)this)
65 int ret = underflow();
91 gbuf =
new char[size];
92 pbuf =
new char[size];
93 assert(
gbuf != NULL &&
pbuf != NULL);
96 #if (defined(__GNUC__) && (__GNUC__ < 3)) && !defined(MSWINDOWS) && !defined(STLPORT) 154 clear(ios::failbit | rdstate());
172 #define MSG_WAITALL 0 200 clear(ios::failbit | rdstate());
221 clear(ios::failbit | rdstate());
225 rlen =
_read(eback(), rlen);
232 clear(ios::failbit | rdstate());
236 setg(eback(), eback(), eback() + rlen);
250 rlen =
_write((
const char *)&
ch, 1);
263 req = (ssize_t)(pptr() - pbase());
265 rlen =
_write(pbase(), req);
358 socklen_t alen =
sizeof(
max);
366 setsockopt(
so, IPPROTO_TCP, TCP_MAXSEG, (
char *)&
max,
sizeof(
max));
367 getsockopt(
so, IPPROTO_TCP, TCP_MAXSEG, (
char *)&
max, &alen);
382 setsockopt(
so, IPPROTO_TCP, TCP_MAXSEG, (
char *)&mss,
sizeof(mss));
390 else if(mss * 6 < 64000u)
413 open(cmd, access, args, envp, size);
456 gbuf =
new char[size];
458 pbuf =
new char[size];
462 #if (defined(__GNUC__) && (__GNUC__ < 3)) && !defined(MSWINDOWS) && !defined(STLPORT) 496 rlen =
rd.
read(eback(), rlen);
502 clear(ios::failbit | rdstate());
506 setg(eback(), eback(), eback() + rlen);
536 req = (ssize_t)(pptr() - pbase());
637 open(filename, mode, size);
643 open(filename, mode, access, size);
697 gbuf =
new char[size];
707 pbuf =
new char[size];
718 #if (defined(__GNUC__) && (__GNUC__ < 3)) && !defined(MSWINDOWS) && !defined(STLPORT) 740 fd.
open(fname, fmode, access);
767 rlen =
fd.
read(eback(), rlen);
773 clear(ios::failbit | rdstate());
777 setg(eback(), eback(), eback() + rlen);
791 req = (ssize_t)(pptr() - pbase());
817 std::streambuf(), std::ostream(this)
828 std::streambuf(), std::ostream(this)
852 std::streambuf(), std::istream(this)
854 bp = (
const uint8_t *)
str;
856 pos = (
const uint8_t *)
str;
860 std::streambuf(), std::istream(this)
925 const char *cp = fmt.
_print();
928 out.write(cp, strlen(cp));
949 size_t size = list.
size() - 64;
951 char *tmp = (
char *)malloc(size);
953 inp.getline(tmp, size);
954 if(!list.
filter(tmp, size))
964 while(
is(sp) &&
out.good()) {
965 const char *cp = sp->get();
966 size_t size = strlen(cp);
977 size_t size = source.
count();
981 const char *buf = source.
c_str();
982 std::string tmp(buf, size);
1031 iostream&
null = nullstream;
ssize_t write(const void *buffer, size_t count)
int sendwait(unsigned size)
int underflow(void) __OVERRIDE
static shell::pid_t spawn(const char *path, char **argv, char **env=NULL, fd_t *stdio=NULL)
void allocate(size_t size)
static shell::stringopt out('o', "--output", _TEXT("output file"), "filename", "-")
int underflow() __OVERRIDE
ssize_t read(void *buffer, size_t count)
void seek(fsys::offset_t offset)
tcpstream(const tcpstream ©)
int sendsize(unsigned size)
static std::ostream & print(std::ostream &out, const PrintProtocol &format)
static ssize_t recvfrom(socket_t socket, void *buffer, size_t size, int flags=0, struct sockaddr_storage *address=NULL)
int underflow(void) __OVERRIDE
bool getline(std::istream &in, char *buffer, size_t size)
int underflow(void) __OVERRIDE
int connectto(struct addrinfo *list)
static ssize_t sendto(socket_t socket, const void *buffer, size_t size, int flags=0, const struct sockaddr *address=NULL)
int overflow(int ch) __OVERRIDE
socket_t accept(struct sockaddr_storage *address=NULL) const
omemstream(uint8_t *data, size_t size)
int int size_t size_t char * data(void)
static socket_t create(int family, int type, int protocol)
__LOCAL void allocate(unsigned size)
int overflow(int c) __OVERRIDE
static shell::stringopt input('i', "--input", _TEXT("stdin path to use"), "filename")
static int inherit(fd_t &descriptor, bool enable)
int overflow(int ch) __OVERRIDE
int underflow() __OVERRIDE
static int cancel(shell::pid_t pid)
void assign(fd_t descriptor)
int overflow(int ch) __OVERRIDE
virtual ssize_t _read(char *buffer, size_t size)
virtual ssize_t _write(const char *buffer, size_t size)
String str(Socket &so, size_t size)
static uint8_t buffer[65536]
__LOCAL void allocate(size_t size, access_t mode)
static std::string & append(std::string &target, String &source)
static int family(socket_t socket)
void open(const char *path, access_t access)
__LOCAL void allocate(size_t size, fsys::access_t mode)
int recvsize(unsigned size)
bool putline(std::ostream &out, char *buffer)
const char * c_str(void) const
bool wait(timeout_t timeout=0) const
void open(Socket::address &address, unsigned segment=536)
virtual const char * _print(void) const =0
static int pipe(fd_t &input, fd_t &output, size_t size=0)
void open(const char *filename, fsys::access_t access, size_t buffering=512)
imemstream(const uint8_t *data, size_t size)
static std::istream & input(std::istream &inp, InputProtocol &format)
static struct addrinfo * query(const char *host, const char *service, int type=SOCK_STREAM, int protocol=0)
int overflow(int ch) __OVERRIDE
void open(const char *path, access_t access, char **args, char **env=NULL, size_t buffering=512)
int seek(offset_t offset)
static int wait(shell::pid_t pid)
#define INVALID_PID_VALUE