LLDB mainline
HostProcessPosix.cpp
Go to the documentation of this file.
1//===-- HostProcessPosix.cpp ----------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "lldb/Host/Host.h"
12
13#include "llvm/ADT/STLExtras.h"
14
15#include <climits>
16#include <csignal>
17#include <unistd.h>
18
19using namespace lldb_private;
20
21static const int kInvalidPosixProcess = 0;
22
25
27 : HostNativeProcessBase(process) {}
28
30
34 error.SetErrorString("HostProcessPosix refers to an invalid process");
35 return error;
36 }
37
39}
40
43
44 if (-1 == ::kill(process, signo))
45 error.SetErrorToErrno();
46
47 return error;
48}
49
51
53
56 return false;
57
58 // Send this process the null signal. If it succeeds the process is running.
59 Status error = Signal(0);
60 return error.Success();
61}
62
63llvm::Expected<HostThread> HostProcessPosix::StartMonitoring(
64 const Host::MonitorChildProcessCallback &callback) {
66}
static llvm::raw_ostream & error(Stream &strm)
static const int kInvalidPosixProcess
bool IsRunning() const override
llvm::Expected< HostThread > StartMonitoring(const Host::MonitorChildProcessCallback &callback) override
virtual Status Signal(int signo) const
lldb::pid_t GetProcessId() const override
std::function< void(lldb::pid_t pid, int signal, int status)> MonitorChildProcessCallback
Definition: Host.h:69
static llvm::Expected< HostThread > StartMonitoringChildProcess(const MonitorChildProcessCallback &callback, lldb::pid_t pid)
Start monitoring a child process.
An error handling class.
Definition: Status.h:44
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
uint64_t pid_t
Definition: lldb-types.h:81
uint64_t process_t
Definition: lldb-types.h:57
#define SIGKILL