From 10b25803ce879ee6ac832b884bfdabc79769486a Mon Sep 17 00:00:00 2001
From: Flavio Cruz <flaviocruz@gmail.com>
Date: Mon, 12 Feb 2024 01:26:34 -0500
Subject: Add thread_set_name RPC.

Like task_set_name, we use the same size as the task name and will
inherit the task name, whenever it exists. This will be used to
implement pthread_setname_np.
Message-ID: <20240212062634.1082207-2-flaviocruz@gmail.com>
---
 kern/thread.h | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'kern/thread.h')

diff --git a/kern/thread.h b/kern/thread.h
index 7bfe2e89..21b25030 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -54,6 +54,12 @@
 #include <machine/thread.h>
 #include <ipc/ipc_kmsg_queue.h>
 
+/*
+ * Thread name buffer size. Use the same size as the task so
+ * the thread can inherit the task's name.
+ */
+#define THREAD_NAME_SIZE TASK_NAME_SIZE
+
 struct thread {
 	/* Run queues */
 	queue_chain_t	links;		/* current run queue links */
@@ -232,6 +238,8 @@ struct thread {
 #if	MACH_LOCK_MON
 	unsigned lock_stack;
 #endif
+
+	char	name[THREAD_NAME_SIZE];
 };
 
 #include <kern/cpu_number.h>
-- 
cgit v1.2.3