Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
processinfo.cpp File Reference

Whether a pid is still the process sonde started: when it started, and whether it is alive (design 0030). More...

#include "processes.h"
#include <QtCore/QDateTime>
#include <QtCore/QLocale>
#include <csignal>
#include <sys/types.h>
#include <QtCore/QProcess>
#include <optional>

Classes

struct  Sonde::Cli::anonymous_namespace{processinfo.cpp}::ProcessInfo
 What sonde knows of a process: when it started, and whether it is a zombie. More...

Namespaces

namespace  Sonde
 Embeddable Model Context Protocol server for Qt applications.

Functions

QString Sonde::Cli::anonymous_namespace{processinfo.cpp}::lstart (qint64 secs)
 secs since the epoch as ps -o lstart= shows it: local time, in the C locale, "Tue Dec 1 13:04:05 2026".
std::optional< ProcessInfo > Sonde::Cli::anonymous_namespace{processinfo.cpp}::info (qint64 pid)
 Process pid's state and start, from ps, as the Python sonde read them.
QString Sonde::Cli::processStartTime (qint64 pid)
 When process pid started, as ps -o lstart= gives it on POSIX (local time, "Tue Dec 1 13:04:05 2026") or as Windows' creation time (a FILETIME, in decimal), or an empty string if it is unknown.
bool Sonde::Cli::processAlive (qint64 pid)
 Whether process pid exists and is ours to signal: not gone, not another user's, and not a zombie.

Detailed Description

Whether a pid is still the process sonde started: when it started, and whether it is alive (design 0030).

Function Documentation

◆ processAlive()

bool Sonde::Cli::processAlive ( qint64 pid)

Whether process pid exists and is ours to signal: not gone, not another user's, and not a zombie.

A process that is exiting is alive until it is a zombie with no thread left but its main one (on Linux the main thread is a zombie as soon as it has exited, while the others end): until then it may still hold its sockets.

◆ processStartTime()

QString Sonde::Cli::processStartTime ( qint64 pid)

When process pid started, as ps -o lstart= gives it on POSIX (local time, "Tue Dec 1 13:04:05 2026") or as Windows' creation time (a FILETIME, in decimal), or an empty string if it is unknown.

The same text the Python sonde recorded, so either reads the other's pid file.