Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Default PROC_MACHINE_ARCH to machine_arch and use this f...



details:   https://anonhg.NetBSD.org/src/rev/49abe01a6c9a
branches:  trunk
changeset: 374538:49abe01a6c9a
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon May 01 05:12:44 2023 +0000

description:
Default PROC_MACHINE_ARCH to machine_arch and use this for magic
symlinks to resolve "@machine_arch".

This keeps behaviour of magic symlinks and 'uname -p' output the same.
Fixes PR 57320.

diffstat:

 sys/kern/vfs_lookup.c |  8 ++++----
 sys/sys/proc.h        |  6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r 7003edb37a8e -r 49abe01a6c9a sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Sun Apr 30 22:33:57 2023 +0000
+++ b/sys/kern/vfs_lookup.c     Mon May 01 05:12:44 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.233 2023/04/09 09:18:09 riastradh Exp $       */
+/*     $NetBSD: vfs_lookup.c,v 1.234 2023/05/01 05:12:44 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.233 2023/04/09 09:18:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.234 2023/05/01 05:12:44 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -137,8 +137,8 @@ symlink_magic(struct proc *p, char *cp, 
                 * to frequency of use.
                 */
                if (MATCH("machine_arch")) {
-                       slen = VNL(MACHINE_ARCH);
-                       SUBSTITUTE("machine_arch", MACHINE_ARCH, slen);
+                       slen = strlen(PROC_MACHINE_ARCH(p));
+                       SUBSTITUTE("machine_arch", PROC_MACHINE_ARCH(p), slen);
                } else if (MATCH("machine")) {
                        slen = VNL(MACHINE);
                        SUBSTITUTE("machine", MACHINE, slen);
diff -r 7003edb37a8e -r 49abe01a6c9a sys/sys/proc.h
--- a/sys/sys/proc.h    Sun Apr 30 22:33:57 2023 +0000
+++ b/sys/sys/proc.h    Mon May 01 05:12:44 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: proc.h,v 1.370 2022/05/09 13:27:24 wiz Exp $   */
+/*     $NetBSD: proc.h,v 1.371 2023/05/01 05:12:44 mlelstv Exp $       */
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -593,6 +593,10 @@ static __inline struct proc *
 #define PROC_DBREGSZ(p) (((p)->p_flag & PK_32) ? \
     sizeof(process_dbreg32) : sizeof(struct dbreg))
 
+#ifndef PROC_MACHINE_ARCH
+#define PROC_MACHINE_ARCH(p) machine_arch
+#endif
+
 /*
  * PROCLIST_FOREACH: iterate on the given proclist, skipping PK_MARKER ones.
  */



Home | Main Index | Thread Index | Old Index