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 "HostProcessPosix refers to an invalid process");
35 }
36
38}
39
42
43 if (-1 == ::kill(process, signo))
44 return Status::FromErrno();
45
46 return error;
47}
48
50
52
55 return false;
56
57 // Send this process the null signal. If it succeeds the process is running.
58 Status error = Signal(0);
59 return error.Success();
60}
61
62llvm::Expected<HostThread> HostProcessPosix::StartMonitoring(
63 const Host::MonitorChildProcessCallback &callback) {
65}
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:88
static llvm::Expected< HostThread > StartMonitoringChildProcess(const MonitorChildProcessCallback &callback, lldb::pid_t pid)
Start monitoring a child process.
An error handling class.
Definition: Status.h:115
static Status FromErrno()
Set the current error to errno.
Definition: Status.cpp:276
static Status FromErrorString(const char *str)
Definition: Status.h:138
A class that represents a running process on the host machine.
uint64_t pid_t
Definition: lldb-types.h:83
uint64_t process_t
Definition: lldb-types.h:57
#define SIGKILL