Include pthread.h in plugin.h to get pthread_t definition.
Fix swapctl() argument count detection on OpenBSD.

on OpenBSD swapctl() takes three arguments, but is defined in unistd.h
and also needs sys/param.h.

http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/swapctl.2

we need to add those headers to both detections to make sure the test
on 'swapctl takes two arguments' correctly fails.
Link collectd-tg with -lpthread if available

otherwise linking fails with undefined refs to pthread_mutex_* functions
inpt_queue is a TAILQ on OpenBSD
Use cpu_stage() where expected in the CAN_USE_SYSCTL, HAVE_LIBSTATGRAB and HAVE_SYSCTLBYNAME codepaths.

cpu_state() isnt a function.
Recent NetBSD versions also use a TAILQ.
Merge pull request #779 from landryb/openbsd_build_fixes

Openbsd build fixes