19#define _XOPEN_SOURCE 600
32using namespace std::placeholders;
67 if (!
fUrl.
Set(url,
"",
"pty", emsg))
return false;
69 int fd = posix_openpt(O_RDWR);
71 emsg.
InitErrno(
"Rw11VirtTermPty::Open",
"posix_openpt() failed: ", errno);
75 int irc = grantpt(fd);
77 emsg.
InitErrno(
"Rw11VirtTermPty::Open",
"grantpt() failed: ", errno);
84 emsg.
InitErrno(
"Rw11VirtTermPty::Open",
"unlockpt() failed: ", errno);
89 char* pname = ptsname(fd);
90 if (pname ==
nullptr) {
91 emsg.
InitErrno(
"Rw11VirtTermPty::Open",
"ptsname() failed: ", errno);
111 ssize_t irc = write(
fFd, data, count);
112 if (irc != ssize_t(count)) {
113 emsg.
InitErrno(
"Rw11VirtTermPty::Snd",
"write() failed: ", errno);
127 if (pfd.revents & (~pfd.events))
return -1;
130 ssize_t irc = read(
fFd, buf, 1024);
147 os << bl << (text?text:
"--") <<
"Rw11VirtTermPty @ " <<
this << endl;
149 os << bl <<
" fFd: " <<
fFd << endl;
void InitErrno(const std::string &meth, const std::string &text, int errnum)
FIXME_docs.
void RemovePollHandler(int fd, short events, bool nothrow=false)
FIXME_docs.
void AddPollHandler(pollhdl_t &&pollhdl, int fd, short events=POLLIN)
FIXME_docs.
I/O appicator to generate fill characters.
bool Set(const std::string &url, const std::string &optlist, RerrMsg &emsg)
FIXME_docs.
void Inc(size_t ind, double val=1.)
FIXME_docs.
virtual bool Snd(const uint8_t *data, size_t count, RerrMsg &emsg)
FIXME_docs.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
int RcvPollHandler(const pollfd &pfd)
FIXME_docs.
~Rw11VirtTermPty()
Destructor.
virtual bool Open(const std::string &url, RerrMsg &emsg)
FIXME_docs.
Rw11VirtTermPty(Rw11Unit *punit)
Default constructor.
int fFd
fd for pty master side
rcvcbfo_t fRcvCb
receive callback fobj
std::string fChannelId
channel id
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
RlinkServer & Server() const
FIXME_docs.
Declaration of class ReventLoop.