procps missing include dev headers upstream
Im running gentoo 6.8 and had a world update, which seemingly updated procps as well and procps > 4.0 does not have any dev headers. I had to downgrade to =sys-process/procps-3.3.17-r2 in order to (re-)build my (test-)application, which uses the dev headers.
Small Example:
#include <iostream>
#include <proc/readproc.h>
#include <cstring>
int main() {
bool verbose = false;
PROCTAB* proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLMEM | PROC_FILLSTATUS);
if (!proc) {
std::cerr << "Error: Failed to open /proc\n";
return 1;
}
proc_t proc_info;
bool found = false;
memset(&proc_info, 0, sizeof(proc_info)); // Initialize proc_info struct
if (verbose)
std::cout << "Entering while loop\n";
while (readproc(proc, &proc_info) != nullptr) {
if (verbose)
std::cout << "Processing process with PID: " << proc_info.tid << "\n";
if (proc_info.cmdline != nullptr) {
for (int i = 0; proc_info.cmdline[i] != nullptr; ++i) {
if (strstr(proc_info.cmdline[i], "test=") != nullptr) {
found = true;
std::cout << "PID: " << proc_info.tid << "\n";
std::cout << "Command line: " << proc_info.cmdline[i] << "\n";
break;
}
}
} else {
if (verbose)
std::cerr << "Error: Null cmdline encountered for PID " << proc_info.tid << "\n";
}
// Reset proc_info for next iteration
memset(&proc_info, 0, sizeof(proc_info));
}
if (!found) {
std::cerr << "No process found with 'test=' in the command line\n";
return 1;
}
g++ -o proctest proctest.cpp -lprocps
Can you explain:
- Why was that changed/removed upstream? Seemingly in https://github.com/warmchang/procps/commit/d974f064b5a269fe8bd009d1430d17218aaf07b7
- What am i supposed to do instead?
Thanks