mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
o Include <sys/time.h>
o Make this ILP32/LP64 clean: cast pointers to long o Code conditional upon DEBUG must also be conditional upon _LIBC_R_
This commit is contained in:
parent
dc2e8ca41b
commit
49fa07a087
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152599
@ -31,19 +31,20 @@
|
|||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "pthread.h"
|
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
|
#include "pthread.h"
|
||||||
|
|
||||||
#if defined(_LIBC_R_)
|
#if defined(_LIBC_R_)
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
@ -179,17 +180,17 @@ extern char *strtok_r(char *str, const char *sep, char **last);
|
|||||||
* Functions
|
* Functions
|
||||||
*----------------------------------------------------------*/
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined(_LIBC_R_) && defined(DEBUG)
|
||||||
static void
|
static void
|
||||||
kern_switch (pthread_t pthread_out, pthread_t pthread_in)
|
kern_switch (pthread_t pthread_out, pthread_t pthread_in)
|
||||||
{
|
{
|
||||||
if (pthread_out != NULL)
|
if (pthread_out != NULL)
|
||||||
printf ("Swapping out thread 0x%x, ", (int) pthread_out);
|
printf ("Swapping out thread 0x%lx, ", (long) pthread_out);
|
||||||
else
|
else
|
||||||
printf ("Swapping out kernel thread, ");
|
printf ("Swapping out kernel thread, ");
|
||||||
|
|
||||||
if (pthread_in != NULL)
|
if (pthread_in != NULL)
|
||||||
printf ("swapping in thread 0x%x\n", (int) pthread_in);
|
printf ("swapping in thread 0x%lx\n", (long) pthread_in);
|
||||||
else
|
else
|
||||||
printf ("swapping in kernel thread.\n");
|
printf ("swapping in kernel thread.\n");
|
||||||
}
|
}
|
||||||
@ -465,8 +466,8 @@ waiter (void *arg)
|
|||||||
pthread_mutex_unlock (&waiter_mutex);
|
pthread_mutex_unlock (&waiter_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_trace ("Thread %d: Exiting thread 0x%x\n", (int) statep->id,
|
log_trace ("Thread %ld: Exiting thread 0x%lx\n", (long) statep->id,
|
||||||
(int) pthread_self());
|
(long) pthread_self());
|
||||||
pthread_exit (arg);
|
pthread_exit (arg);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -512,8 +513,8 @@ lock_twice (void *arg)
|
|||||||
if (statep->ret == 0)
|
if (statep->ret == 0)
|
||||||
pthread_mutex_unlock (statep->cmd.mutex);
|
pthread_mutex_unlock (statep->cmd.mutex);
|
||||||
|
|
||||||
log_trace ("Thread %d: Exiting thread 0x%x\n", (int) statep->id,
|
log_trace ("Thread %ld: Exiting thread 0x%lx\n", (long) statep->id,
|
||||||
(int) pthread_self());
|
(long) pthread_self());
|
||||||
pthread_exit (arg);
|
pthread_exit (arg);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -522,8 +523,8 @@ lock_twice (void *arg)
|
|||||||
static void
|
static void
|
||||||
sighandler (int signo)
|
sighandler (int signo)
|
||||||
{
|
{
|
||||||
log ("Signal handler caught signal %d, thread id 0x%x\n",
|
log ("Signal handler caught signal %d, thread id 0x%lx\n",
|
||||||
signo, (int) pthread_self());
|
signo, (long) pthread_self());
|
||||||
|
|
||||||
if (signo == SIGINT)
|
if (signo == SIGINT)
|
||||||
done = 1;
|
done = 1;
|
||||||
@ -1481,7 +1482,7 @@ int main (int argc, char *argv[])
|
|||||||
/* Create a pipe to catch the results of thread wakeups. */
|
/* Create a pipe to catch the results of thread wakeups. */
|
||||||
assert (pipe (pipefd) == 0);
|
assert (pipe (pipefd) == 0);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined(_LIBC_R_) && defined(DEBUG)
|
||||||
assert (pthread_switch_add_np (kern_switch) == 0);
|
assert (pthread_switch_add_np (kern_switch) == 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -31,19 +31,20 @@
|
|||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "pthread.h"
|
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
|
#include "pthread.h"
|
||||||
|
|
||||||
#if defined(_LIBC_R_)
|
#if defined(_LIBC_R_)
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
@ -179,17 +180,17 @@ extern char *strtok_r(char *str, const char *sep, char **last);
|
|||||||
* Functions
|
* Functions
|
||||||
*----------------------------------------------------------*/
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined(_LIBC_R_) && defined(DEBUG)
|
||||||
static void
|
static void
|
||||||
kern_switch (pthread_t pthread_out, pthread_t pthread_in)
|
kern_switch (pthread_t pthread_out, pthread_t pthread_in)
|
||||||
{
|
{
|
||||||
if (pthread_out != NULL)
|
if (pthread_out != NULL)
|
||||||
printf ("Swapping out thread 0x%x, ", (int) pthread_out);
|
printf ("Swapping out thread 0x%lx, ", (long) pthread_out);
|
||||||
else
|
else
|
||||||
printf ("Swapping out kernel thread, ");
|
printf ("Swapping out kernel thread, ");
|
||||||
|
|
||||||
if (pthread_in != NULL)
|
if (pthread_in != NULL)
|
||||||
printf ("swapping in thread 0x%x\n", (int) pthread_in);
|
printf ("swapping in thread 0x%lx\n", (long) pthread_in);
|
||||||
else
|
else
|
||||||
printf ("swapping in kernel thread.\n");
|
printf ("swapping in kernel thread.\n");
|
||||||
}
|
}
|
||||||
@ -465,8 +466,8 @@ waiter (void *arg)
|
|||||||
pthread_mutex_unlock (&waiter_mutex);
|
pthread_mutex_unlock (&waiter_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_trace ("Thread %d: Exiting thread 0x%x\n", (int) statep->id,
|
log_trace ("Thread %ld: Exiting thread 0x%lx\n", (long) statep->id,
|
||||||
(int) pthread_self());
|
(long) pthread_self());
|
||||||
pthread_exit (arg);
|
pthread_exit (arg);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -512,8 +513,8 @@ lock_twice (void *arg)
|
|||||||
if (statep->ret == 0)
|
if (statep->ret == 0)
|
||||||
pthread_mutex_unlock (statep->cmd.mutex);
|
pthread_mutex_unlock (statep->cmd.mutex);
|
||||||
|
|
||||||
log_trace ("Thread %d: Exiting thread 0x%x\n", (int) statep->id,
|
log_trace ("Thread %ld: Exiting thread 0x%lx\n", (long) statep->id,
|
||||||
(int) pthread_self());
|
(long) pthread_self());
|
||||||
pthread_exit (arg);
|
pthread_exit (arg);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -522,8 +523,8 @@ lock_twice (void *arg)
|
|||||||
static void
|
static void
|
||||||
sighandler (int signo)
|
sighandler (int signo)
|
||||||
{
|
{
|
||||||
log ("Signal handler caught signal %d, thread id 0x%x\n",
|
log ("Signal handler caught signal %d, thread id 0x%lx\n",
|
||||||
signo, (int) pthread_self());
|
signo, (long) pthread_self());
|
||||||
|
|
||||||
if (signo == SIGINT)
|
if (signo == SIGINT)
|
||||||
done = 1;
|
done = 1;
|
||||||
@ -1481,7 +1482,7 @@ int main (int argc, char *argv[])
|
|||||||
/* Create a pipe to catch the results of thread wakeups. */
|
/* Create a pipe to catch the results of thread wakeups. */
|
||||||
assert (pipe (pipefd) == 0);
|
assert (pipe (pipefd) == 0);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined(_LIBC_R_) && defined(DEBUG)
|
||||||
assert (pthread_switch_add_np (kern_switch) == 0);
|
assert (pthread_switch_add_np (kern_switch) == 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user