Module Name: src
Committed By: kamil
Date: Wed Jan 29 16:34:09 UTC 2020
Modified Files:
src/lib/libpthread: pthread_misc.c
Log Message:
Check thread->pt_magic with PT_MAGIC promptly
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libpthread/pthread_misc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libpthread/pthread_misc.c
diff -u src/lib/libpthread/pthread_misc.c:1.16 src/lib/libpthread/pthread_misc.c:1.17
--- src/lib/libpthread/pthread_misc.c:1.16 Mon Jan 13 18:22:56 2020
+++ src/lib/libpthread/pthread_misc.c Wed Jan 29 16:34:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_misc.c,v 1.16 2020/01/13 18:22:56 ad Exp $ */
+/* $NetBSD: pthread_misc.c,v 1.17 2020/01/29 16:34:09 kamil Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_misc.c,v 1.16 2020/01/13 18:22:56 ad Exp $");
+__RCSID("$NetBSD: pthread_misc.c,v 1.17 2020/01/29 16:34:09 kamil Exp $");
#include <errno.h>
#include <string.h>
@@ -61,6 +61,9 @@ int
pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *param)
{
+ pthread__error(EINVAL, "Invalid thread",
+ thread->pt_magic == PT_MAGIC);
+
if (pthread__find(thread) != 0)
return ESRCH;
@@ -76,6 +79,9 @@ pthread_setschedparam(pthread_t thread,
{
struct sched_param sp;
+ pthread__error(EINVAL, "Invalid thread",
+ thread->pt_magic == PT_MAGIC);
+
if (pthread__find(thread) != 0)
return ESRCH;
@@ -90,6 +96,9 @@ int
pthread_getaffinity_np(pthread_t thread, size_t size, cpuset_t *cpuset)
{
+ pthread__error(EINVAL, "Invalid thread",
+ thread->pt_magic == PT_MAGIC);
+
if (pthread__find(thread) != 0)
return ESRCH;
@@ -103,6 +112,9 @@ int
pthread_setaffinity_np(pthread_t thread, size_t size, cpuset_t *cpuset)
{
+ pthread__error(EINVAL, "Invalid thread",
+ thread->pt_magic == PT_MAGIC);
+
if (pthread__find(thread) != 0)
return ESRCH;
@@ -117,6 +129,9 @@ pthread_setschedprio(pthread_t thread, i
{
struct sched_param sp;
+ pthread__error(EINVAL, "Invalid thread",
+ thread->pt_magic == PT_MAGIC);
+
if (pthread__find(thread) != 0)
return ESRCH;
@@ -131,6 +146,9 @@ int
pthread_kill(pthread_t thread, int sig)
{
+ pthread__error(EINVAL, "Invalid thread",
+ thread->pt_magic == PT_MAGIC);
+
if ((sig < 0) || (sig >= _NSIG))
return EINVAL;
if (pthread__find(thread) != 0)