Bonsoir,
j'ai fait un code qui afiche tout les PID des processus et des threads sous widows,il marche bien.
moi je veut le marcher sous lunix,s'il veut plait est ce qu'il ya une methode pour le marcher sous lunix ou bien un equivalant entre les fonctions et marci, voila mon code:
#include <stdio.h>
#include <windows.h>
#include <tlhelp32.h>
#include<pthread.h>
int main()
{ int i;
pid_t getpid(void);
HANDLE pro;
HANDLE th;
PROCESSENTRY32 pe;
THREADENTRY32 te;
pro = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (Process32First(pro, &pe))
{
th = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0);
te.dwSize = sizeof(THREADENTRY32 );
do{
printf( "\n\n====================================================" );
printf( "\n NOM DE PROCESSUS: %s", pe.szExeFile );
printf( "\n ====================================================" );
printf( "\n ID de processus = %d",pe.th32ProcessID);
printf( "\n Nombre de threads = %d",pe.cntThreads );
printf( "\n ID du processus parent = %d", pe.th32ParentProcessID);
if( Thread32First( th, &te ) )
{ i=0;
do {
printf( "\n ID du THREAD numero %d = %d",i,te.th32ThreadID);
i=i+1;
}
while( Thread32Next(th, &te ) );
CloseHandle(th);
}
}
while (Process32Next(pro,&pe));
CloseHandle(pro );
}
return 0;
}