NetBSD-Bugs archive

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

Re: kern/57320: ATF test case kernel/t_magic_symlinks:machine_arch fails on RPI02W/evbarm only



The following reply was made to PR kern/57320; it has been noted by GNATS.

From: Michael van Elst <mlelstv%serpens.de@localhost>
To: "David H. Gutteridge" <david%gutteridge.ca@localhost>
Cc: gnats-bugs%netbsd.org@localhost, martin%duskware.de@localhost
Subject: Re: kern/57320: ATF test case kernel/t_magic_symlinks:machine_arch
 fails on RPI02W/evbarm only
Date: Thu, 20 Apr 2023 08:53:45 +0200

 On Thu, Apr 20, 2023 at 07:19:50AM +0200, Michael van Elst wrote:
 
 > I guess the only controversial thing would be to make PROC_MACHINE_ARCH
 > something machine-independent, if it should be hidden behind a new
 > public symbol, or if it should be a hack in vfs_lookup.c :)
 
 This here seems to work:
 
 Index: sys/sys/proc.h
 ===================================================================
 RCS file: /cvsroot/src/sys/sys/proc.h,v
 retrieving revision 1.370
 diff -p -u -r1.370 proc.h
 --- sys/sys/proc.h      9 May 2022 13:27:24 -0000       1.370
 +++ sys/sys/proc.h      20 Apr 2023 06:49:21 -0000
 @@ -593,6 +593,10 @@ _proclist_skipmarker(struct proc *p0)
  #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.
   */
 Index: sys/kern/vfs_lookup.c
 ===================================================================
 RCS file: /cvsroot/src/sys/kern/vfs_lookup.c,v
 retrieving revision 1.233
 diff -p -u -r1.233 vfs_lookup.c
 --- sys/kern/vfs_lookup.c       9 Apr 2023 09:18:09 -0000       1.233
 +++ sys/kern/vfs_lookup.c       20 Apr 2023 06:49:21 -0000
 @@ -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);
 
 
 # sysctl hw.machine_arch
 hw.machine_arch = earmv7hf
 
 .....
 t_magic_symlinks (1/1): 10 test cases
     domainname: [1.356511s] Passed.
     gid: [1.308785s] Passed.
     hostname: [1.307164s] Passed.
     machine: [1.304504s] Passed.
     machine_arch: [1.306524s] Passed.
     ostype: [1.303740s] Passed.
     realpath: [1.371548s] Passed.
     rgid: [1.301601s] Passed.
     ruid: [1.304645s] Passed.
     uid: [1.302798s] Passed.
 [13.199923s]
 
 
 -- 
                                 Michael van Elst
 Internet: mlelstv%serpens.de@localhost
                                 "A potential Snark may lurk in every tree."
 


Home | Main Index | Thread Index | Old Index