mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-24 23:15:46 +00:00
Barely ever seen any 1000 digit PIDs …
This commit is contained in:
parent
6646030116
commit
6921000481
@ -52,8 +52,6 @@ void OpenFilesScreen_draw(InfoScreen* this) {
|
||||
}
|
||||
|
||||
static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) {
|
||||
char buffer[1025];
|
||||
xSnprintf(buffer, 1024, "%d", pid);
|
||||
OpenFiles_ProcessData* pdata = xCalloc(1, sizeof(OpenFiles_ProcessData));
|
||||
OpenFiles_FileData* fdata = NULL;
|
||||
OpenFiles_Data* item = &(pdata->data);
|
||||
@ -76,6 +74,8 @@ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) {
|
||||
exit(1);
|
||||
dup2(fdnull, STDERR_FILENO);
|
||||
close(fdnull);
|
||||
char buffer[32] = {0};
|
||||
xSnprintf(buffer, sizeof(buffer), "%d", pid);
|
||||
execlp("lsof", "lsof", "-P", "-p", buffer, "-F", NULL);
|
||||
exit(127);
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ void TraceScreen_draw(InfoScreen* this) {
|
||||
}
|
||||
|
||||
bool TraceScreen_forkTracer(TraceScreen* this) {
|
||||
char buffer[1001];
|
||||
int error = pipe(this->fdpair);
|
||||
if (error == -1) return false;
|
||||
this->child = fork();
|
||||
@ -84,6 +83,7 @@ bool TraceScreen_forkTracer(TraceScreen* this) {
|
||||
dup2(this->fdpair[1], STDERR_FILENO);
|
||||
int ok = fcntl(this->fdpair[1], F_SETFL, O_NONBLOCK);
|
||||
if (ok != -1) {
|
||||
char buffer[32] = {0};
|
||||
xSnprintf(buffer, sizeof(buffer), "%d", this->super.process->pid);
|
||||
execlp("strace", "strace", "-T", "-tt", "-s", "512", "-p", buffer, NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user