Re: fix "_nfiles" references for crash dump

2018-09-05 Thread Martin Pieuchot
On 04/09/18(Tue) 14:59, Naoki Fukaumi wrote:
> hi tech@,
> 
> "_nfiles" was renamed to "_numfiles" by this commit,
>  https://marc.info/?l=openbsd-cvs=147199491615345=2
> 
> then fstat/pstat put following errors,
> 
>  # fstat -M bsd.0.core -N bsd.0
>  fstat: _nfiles: no such symbol
> 
>  # pstat -f -M bsd.0.core -N bsd.0
>  pstat: kvm_getfiles: _nfiles: no such symbol
> 
>  # pstat -T -M bsd.0.core -N bsd.0
>  pstat: cannot read nfile: invalid translation (invalid PTE)
> 
> this patch fixes the problem.

ok mpi@

> Index: lib/libkvm/kvm_file2.c
> ===
> RCS file: /cvs/src/lib/libkvm/kvm_file2.c,v
> retrieving revision 1.53
> diff -u -p -u -p -r1.53 kvm_file2.c
> --- lib/libkvm/kvm_file2.c2 Jan 2018 06:38:45 -   1.53
> +++ lib/libkvm/kvm_file2.c4 Sep 2018 04:19:00 -
> @@ -209,7 +209,7 @@ kvm_deadfile_byfile(kvm_t *kd, int op, i
>   int nfiles;
>  
>   nl[0].n_name = "_filehead";
> - nl[1].n_name = "_nfiles";
> + nl[1].n_name = "_numfiles";
>   nl[2].n_name = 0;
>  
>   if (kvm_nlist(kd, nl) != 0) {
> @@ -280,7 +280,7 @@ kvm_deadfile_byid(kvm_t *kd, int op, int
>   int i, nfiles;
>  
>   nl[0].n_name = "_filehead";
> - nl[1].n_name = "_nfiles";
> + nl[1].n_name = "_numfiles";
>   nl[2].n_name = "_allprocess";
>   nl[3].n_name = 0;
>  
> Index: usr.sbin/pstat/pstat.c
> ===
> RCS file: /cvs/src/usr.sbin/pstat/pstat.c,v
> retrieving revision 1.118
> diff -u -p -u -p -r1.118 pstat.c
> --- usr.sbin/pstat/pstat.c3 Aug 2018 14:39:55 -   1.118
> +++ usr.sbin/pstat/pstat.c4 Sep 2018 04:19:00 -
> @@ -69,7 +69,7 @@
>  
>  struct nlist vnodenl[] = {
>  #define  FNL_NFILE   0   /* sysctl */
> - {"_nfiles"},
> + {"_numfiles"},
>  #define FNL_MAXFILE  1   /* sysctl */
>   {"_maxfiles"},
>  #define TTY_NTTY 2   /* sysctl */
> 



fix "_nfiles" references for crash dump

2018-09-04 Thread Naoki Fukaumi
hi tech@,

"_nfiles" was renamed to "_numfiles" by this commit,
 https://marc.info/?l=openbsd-cvs=147199491615345=2

then fstat/pstat put following errors,

 # fstat -M bsd.0.core -N bsd.0
 fstat: _nfiles: no such symbol

 # pstat -f -M bsd.0.core -N bsd.0
 pstat: kvm_getfiles: _nfiles: no such symbol

 # pstat -T -M bsd.0.core -N bsd.0
 pstat: cannot read nfile: invalid translation (invalid PTE)

this patch fixes the problem.

--
FUKAUMI Naoki

Index: lib/libkvm/kvm_file2.c
===
RCS file: /cvs/src/lib/libkvm/kvm_file2.c,v
retrieving revision 1.53
diff -u -p -u -p -r1.53 kvm_file2.c
--- lib/libkvm/kvm_file2.c  2 Jan 2018 06:38:45 -   1.53
+++ lib/libkvm/kvm_file2.c  4 Sep 2018 04:19:00 -
@@ -209,7 +209,7 @@ kvm_deadfile_byfile(kvm_t *kd, int op, i
int nfiles;
 
nl[0].n_name = "_filehead";
-   nl[1].n_name = "_nfiles";
+   nl[1].n_name = "_numfiles";
nl[2].n_name = 0;
 
if (kvm_nlist(kd, nl) != 0) {
@@ -280,7 +280,7 @@ kvm_deadfile_byid(kvm_t *kd, int op, int
int i, nfiles;
 
nl[0].n_name = "_filehead";
-   nl[1].n_name = "_nfiles";
+   nl[1].n_name = "_numfiles";
nl[2].n_name = "_allprocess";
nl[3].n_name = 0;
 
Index: usr.sbin/pstat/pstat.c
===
RCS file: /cvs/src/usr.sbin/pstat/pstat.c,v
retrieving revision 1.118
diff -u -p -u -p -r1.118 pstat.c
--- usr.sbin/pstat/pstat.c  3 Aug 2018 14:39:55 -   1.118
+++ usr.sbin/pstat/pstat.c  4 Sep 2018 04:19:00 -
@@ -69,7 +69,7 @@
 
 struct nlist vnodenl[] = {
 #defineFNL_NFILE   0   /* sysctl */
-   {"_nfiles"},
+   {"_numfiles"},
 #define FNL_MAXFILE1   /* sysctl */
{"_maxfiles"},
 #define TTY_NTTY   2   /* sysctl */