|
|
|
|
@ -251,15 +251,15 @@ static void OpenFiles_Data_clear(OpenFiles_Data* data) { |
|
|
|
|
free(data->data[i]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void OpenFilesScreen_scan(InfoScreen* this) { |
|
|
|
|
Panel* panel = this->display; |
|
|
|
|
static void OpenFilesScreen_scan(InfoScreen* super) { |
|
|
|
|
Panel* panel = super->display; |
|
|
|
|
int idx = Panel_getSelectedIndex(panel); |
|
|
|
|
Panel_prune(panel); |
|
|
|
|
OpenFiles_ProcessData* pdata = OpenFilesScreen_getProcessData(((OpenFilesScreen*)this)->pid); |
|
|
|
|
OpenFiles_ProcessData* pdata = OpenFilesScreen_getProcessData(((OpenFilesScreen*)super)->pid); |
|
|
|
|
if (pdata->error == 127) { |
|
|
|
|
InfoScreen_addLine(this, "Could not execute 'lsof'. Please make sure it is available in your $PATH."); |
|
|
|
|
InfoScreen_addLine(super, "Could not execute 'lsof'. Please make sure it is available in your $PATH."); |
|
|
|
|
} else if (pdata->error == 1) { |
|
|
|
|
InfoScreen_addLine(this, "Failed listing open files."); |
|
|
|
|
InfoScreen_addLine(super, "Failed listing open files."); |
|
|
|
|
} else { |
|
|
|
|
char hdrbuf[128] = {0}; |
|
|
|
|
snprintf(hdrbuf, sizeof(hdrbuf), "%5.5s %-7.7s %-4.4s %6.6s %*s %*s %*s %s", |
|
|
|
|
@ -287,7 +287,7 @@ static void OpenFilesScreen_scan(InfoScreen* this) { |
|
|
|
|
pdata->cols[getIndexForType('i')], |
|
|
|
|
getDataForType(data, 'i'), |
|
|
|
|
getDataForType(data, 'n')); |
|
|
|
|
InfoScreen_addLine(this, entry); |
|
|
|
|
InfoScreen_addLine(super, entry); |
|
|
|
|
free(entry); |
|
|
|
|
OpenFiles_Data_clear(data); |
|
|
|
|
OpenFiles_FileData* old = fdata; |
|
|
|
|
@ -297,7 +297,7 @@ static void OpenFilesScreen_scan(InfoScreen* this) { |
|
|
|
|
OpenFiles_Data_clear(&pdata->data); |
|
|
|
|
} |
|
|
|
|
free(pdata); |
|
|
|
|
Vector_insertionSort(this->lines); |
|
|
|
|
Vector_insertionSort(super->lines); |
|
|
|
|
Vector_insertionSort(panel->items); |
|
|
|
|
Panel_setSelected(panel, idx); |
|
|
|
|
} |
|
|
|
|
|