#include <sys/types.h> /* for getppid */ #include <unistd.h> /* for getppid */ #include <pthread.h> /* for threads */ #include <stdio.h> /* for perror etc */ #include <stdlib.h> /* for exit */ static pid_t mainThread; static pid_t childThread; void *child(void* arg){ childThread = getppid(); return arg; } int main(){ pthread_t tid; mainThread = getppid(); if(pthread_create(&tid, NULL, child, (void *)NULL)){ perror("Could not create thread"); exit(EXIT_FAILURE); } else { pthread_join(tid, NULL); } if(childThread == mainThread){ printf("Your system is using NPTL\n"); } else { printf("Your system is using LinuxThreads\n"); } exit(EXIT_SUCCESS); }