tech-userlevel archive

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

Re: savecore: default to -N /dev/ksyms?



On Fri, Mar 20, 2009 at 05:52:10PM +0000, David Laight wrote:
> On Fri, Mar 20, 2009 at 12:22:02PM -0400, Thor Lancelot Simon wrote:
> > +           if (access(_PATH_KSYMS, R_OK) == 0) {
> 
> You want to use open() not access(), since you want to know whether
> the open will suceed, not whether some check against the file
> permisions reports 'success'.
> 
> For instance you probably wnat to know whether the device driver
> will allow the open as well!

Actually, I think this is sufficient.  Basically, all uses of
getbootfile() in the tree right now are just plain wrong (they were
redundant before due to the libkvm default, and now they simply override
it with wrong data).  No change to libkvm required: though the control
flow is not tremendously clear, if you pass a NULL kernel filename it
DTRT.


Index: sbin/savecore/savecore.c
===================================================================
RCS file: /cvsroot/src/sbin/savecore/savecore.c,v
retrieving revision 1.76
diff -u -r1.76 savecore.c
--- sbin/savecore/savecore.c    20 Oct 2008 10:34:54 -0000      1.76
+++ sbin/savecore/savecore.c    20 Mar 2009 18:29:31 -0000
@@ -228,10 +228,6 @@
        if (!clear)
                dirname = argv[0];
 
-       if (kernel == NULL) {
-               kernel = getbootfile();
-       }
-
        (void)time(&now);
        kmem_setup();
 


Home | Main Index | Thread Index | Old Index