本文整理汇总了C++中Status::SetErrorToErrno方法的典型用法代码示例。如果您正苦于以下问题:C++ Status::SetErrorToErrno方法的具体用法?C++ Status::SetErrorToErrno怎么用?C++ Status::SetErrorToErrno使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::SetErrorToErrno方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetLastError
void Socket::SetLastError(Status &error) {
#if defined(_WIN32)
error.SetError(::WSAGetLastError(), lldb::eErrorTypeWin32);
#else
error.SetErrorToErrno();
#endif
}
示例2: Signal
Status HostProcessPosix::Signal(lldb::process_t process, int signo) {
Status error;
if (-1 == ::kill(process, signo))
error.SetErrorToErrno();
return error;
}
示例3: PutSTDIN
size_t ProcessFreeBSD::PutSTDIN(const char *buf, size_t len, Status &error) {
ssize_t status;
if ((status = write(m_monitor->GetTerminalFD(), buf, len)) < 0) {
error.SetErrorToErrno();
return 0;
}
return status;
}
示例4: DoSignal
Status ProcessFreeBSD::DoSignal(int signal) {
Status error;
if (kill(GetID(), signal))
error.SetErrorToErrno();
return error;
}
示例5: DoHalt
Status ProcessFreeBSD::DoHalt(bool &caused_stop) {
Status error;
if (IsStopped()) {
caused_stop = false;
} else if (kill(GetID(), SIGSTOP)) {
caused_stop = false;
error.SetErrorToErrno();
} else {
caused_stop = true;
}
return error;
}
示例6: DoDestroy
Status ProcessFreeBSD::DoDestroy() {
Status error;
if (!HasExited()) {
assert(m_monitor);
m_exit_now = true;
if (GetID() == LLDB_INVALID_PROCESS_ID) {
error.SetErrorString("invalid process id");
return error;
}
if (!m_monitor->Kill()) {
error.SetErrorToErrno();
return error;
}
SetPrivateState(eStateExited);
}
return error;
}
示例7: DoLaunch
Status ProcessFreeBSD::DoLaunch(Module *module,
ProcessLaunchInfo &launch_info) {
Status error;
assert(m_monitor == NULL);
FileSpec working_dir = launch_info.GetWorkingDirectory();
if (working_dir) {
FileSystem::Instance().Resolve(working_dir);
if (!FileSystem::Instance().IsDirectory(working_dir.GetPath())) {
error.SetErrorStringWithFormat("No such file or directory: %s",
working_dir.GetCString());
return error;
}
}
SetPrivateState(eStateLaunching);
const lldb_private::FileAction *file_action;
// Default of empty will mean to use existing open file descriptors
FileSpec stdin_file_spec{};
FileSpec stdout_file_spec{};
FileSpec stderr_file_spec{};
const FileSpec dbg_pts_file_spec{launch_info.GetPTY().GetSlaveName(NULL, 0)};
file_action = launch_info.GetFileActionForFD(STDIN_FILENO);
stdin_file_spec =
GetFileSpec(file_action, stdin_file_spec, dbg_pts_file_spec);
file_action = launch_info.GetFileActionForFD(STDOUT_FILENO);
stdout_file_spec =
GetFileSpec(file_action, stdout_file_spec, dbg_pts_file_spec);
file_action = launch_info.GetFileActionForFD(STDERR_FILENO);
stderr_file_spec =
GetFileSpec(file_action, stderr_file_spec, dbg_pts_file_spec);
m_monitor = new ProcessMonitor(
this, module, launch_info.GetArguments().GetConstArgumentVector(),
launch_info.GetEnvironment(), stdin_file_spec, stdout_file_spec,
stderr_file_spec, working_dir, launch_info, error);
m_module = module;
if (!error.Success())
return error;
int terminal = m_monitor->GetTerminalFD();
if (terminal >= 0) {
// The reader thread will close the file descriptor when done, so we pass it a
// copy.
#ifdef F_DUPFD_CLOEXEC
int stdio = fcntl(terminal, F_DUPFD_CLOEXEC, 0);
if (stdio == -1) {
error.SetErrorToErrno();
return error;
}
#else
// Special case when F_DUPFD_CLOEXEC does not exist (Debian kFreeBSD)
int stdio = fcntl(terminal, F_DUPFD, 0);
if (stdio == -1) {
error.SetErrorToErrno();
return error;
}
stdio = fcntl(terminal, F_SETFD, FD_CLOEXEC);
if (stdio == -1) {
error.SetErrorToErrno();
return error;
}
#endif
SetSTDIOFileDescriptor(stdio);
}
SetID(m_monitor->GetPID());
return error;
}