Skip to contentSkip to conversation

PATCH: Define auxiliary vector size, AT_VECTOR_SIZE

PATCH H. J. Lu 1 participant 1 message Jul 26, 2005

Subsystems (2)
lore
Share & tools
lore

H. J. Lu

author
#0 lore raw

The size of auxiliary vector is fixed at 42 in linux/sched.h. But it isn't very obvious when looking at linux/elf.h. This patch adds AT_VECTOR_SIZE so that we can change it if necessary when a new vector is added.

H.J.

include/linux/elf.h renamed from include/linux/elf.h.auxv +2 -0
@@ -178,6 +178,8 @@ typedef __s64	Elf64_Sxword;
 
 #define AT_SECURE 23   /* secure mode boolean */
 
+#define AT_VECTOR_SIZE  42 /* Size of auxiliary table.  */
+
 typedef struct dynamic{
   Elf32_Sword d_tag;
   union{
include/linux/sched.h renamed from include/linux/sched.h.auxv +3 -1
@@ -30,6 +30,8 @@
 #include <linux/pid.h>
 #include <linux/percpu.h>
 
+#include <linux/elf.h>	/* For AT_VECTOR_SIZE */
+
 struct exec_domain;
 extern int exec_shield;
 extern int exec_shield_randomize;
@@ -238,7 +240,7 @@ struct mm_struct {
 	unsigned long rss, anon_rss, total_vm, locked_vm, shared_vm;
 	unsigned long exec_vm, stack_vm, reserved_vm, def_flags;
 
-	unsigned long saved_auxv[42]; /* for /proc/PID/auxv */
+	unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
 
 	unsigned dumpable:2;
 	cpumask_t cpu_vm_mask;