Get rid of _PATH_UNIX completely; use getbootfile(3) instead.
DANGER WILL ROBINSON! _PATH_UNIX is currently defined as the literal string "don't use this". I am of two minds about this myself, but wanted to get something into the tree as quickly as possible.
This commit is contained in:
parent
53d733f050
commit
4be4929c2b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3041
@ -36,6 +36,8 @@
|
|||||||
#ifndef _PATHS_H_
|
#ifndef _PATHS_H_
|
||||||
#define _PATHS_H_
|
#define _PATHS_H_
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
/* Default search path. */
|
/* Default search path. */
|
||||||
#define _PATH_DEFPATH "/usr/bin:/bin"
|
#define _PATH_DEFPATH "/usr/bin:/bin"
|
||||||
/* All standard utilities path. */
|
/* All standard utilities path. */
|
||||||
@ -56,7 +58,7 @@
|
|||||||
#define _PATH_SENDMAIL "/usr/sbin/sendmail"
|
#define _PATH_SENDMAIL "/usr/sbin/sendmail"
|
||||||
#define _PATH_SHELLS "/etc/shells"
|
#define _PATH_SHELLS "/etc/shells"
|
||||||
#define _PATH_TTY "/dev/tty"
|
#define _PATH_TTY "/dev/tty"
|
||||||
#define _PATH_UNIX "/kernel"
|
#define _PATH_UNIX "don't use _PATH_UNIX"
|
||||||
#define _PATH_VI "/usr/bin/vi"
|
#define _PATH_VI "/usr/bin/vi"
|
||||||
|
|
||||||
/* Provide trailing slash, since mostly used for building pathnames. */
|
/* Provide trailing slash, since mostly used for building pathnames. */
|
||||||
@ -66,4 +68,9 @@
|
|||||||
#define _PATH_VARRUN "/var/run/"
|
#define _PATH_VARRUN "/var/run/"
|
||||||
#define _PATH_VARTMP "/var/tmp/"
|
#define _PATH_VARTMP "/var/tmp/"
|
||||||
|
|
||||||
|
/* How to get the correct name of the kernel. */
|
||||||
|
__BEGIN_DECLS
|
||||||
|
const char *getbootfile __P((void));
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
#endif /* !_PATHS_H_ */
|
#endif /* !_PATHS_H_ */
|
||||||
|
@ -182,7 +182,7 @@ _kvm_open(kd, uf, mf, sf, flag, errout)
|
|||||||
kd->argv = 0;
|
kd->argv = 0;
|
||||||
|
|
||||||
if (uf == 0)
|
if (uf == 0)
|
||||||
uf = _PATH_UNIX;
|
uf = getbootfile();
|
||||||
else if (strlen(uf) >= MAXPATHLEN) {
|
else if (strlen(uf) >= MAXPATHLEN) {
|
||||||
_kvm_err(kd, kd->program, "exec file name too long");
|
_kvm_err(kd, kd->program, "exec file name too long");
|
||||||
goto failed;
|
goto failed;
|
||||||
|
@ -70,9 +70,8 @@ This file must contain a symbol table.
|
|||||||
If this argument is
|
If this argument is
|
||||||
.Dv NULL ,
|
.Dv NULL ,
|
||||||
the currently running system is assumed,
|
the currently running system is assumed,
|
||||||
which is indicated by
|
as determined from
|
||||||
.Dv _PATH_UNIX
|
.Xr getbootfile 3 .
|
||||||
in <paths.h>.
|
|
||||||
.Pp
|
.Pp
|
||||||
.Fa corefile
|
.Fa corefile
|
||||||
is the kernel memory device file. It can be either /dev/mem
|
is the kernel memory device file. It can be either /dev/mem
|
||||||
|
@ -29,9 +29,10 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)savecore.8 8.1 (Berkeley) 6/5/93
|
.\" From: @(#)savecore.8 8.1 (Berkeley) 6/5/93
|
||||||
|
.\" $Id$
|
||||||
.\"
|
.\"
|
||||||
.Dd June 5, 1993
|
.Dd September 23, 1994
|
||||||
.Dt SAVECORE 8
|
.Dt SAVECORE 8
|
||||||
.Os BSD 4
|
.Os BSD 4
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -63,7 +64,8 @@ is insufficient disk space.
|
|||||||
.It Fl N
|
.It Fl N
|
||||||
Use
|
Use
|
||||||
.Ar system
|
.Ar system
|
||||||
as the kernel instead of the default ``/kernel''.
|
as the kernel instead of the running kernel (as determined from
|
||||||
|
.Xr getbootfile 3 )
|
||||||
.It Fl v
|
.It Fl v
|
||||||
Prints out some additional debugging information.
|
Prints out some additional debugging information.
|
||||||
.It Fl z
|
.It Fl z
|
||||||
@ -106,16 +108,11 @@ is meant to be called near the end of the initialization file
|
|||||||
.Pa /etc/rc
|
.Pa /etc/rc
|
||||||
(see
|
(see
|
||||||
.Xr rc 8 ) .
|
.Xr rc 8 ) .
|
||||||
.Sh FILES
|
|
||||||
.Bl -tag -width /kernelxx -compact
|
|
||||||
.It Pa /kernel
|
|
||||||
current
|
|
||||||
.Tn UNIX
|
|
||||||
.El
|
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
The minfree code does not consider the effect of compression.
|
The minfree code does not consider the effect of compression.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr compress 1 ,
|
.Xr compress 1 ,
|
||||||
|
.Xr getbootfile 3 ,
|
||||||
.Xr syslogd 8
|
.Xr syslogd 8
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
The
|
The
|
||||||
|
@ -121,7 +121,7 @@ int get_crashtime __P((void));
|
|||||||
void kmem_setup __P((void));
|
void kmem_setup __P((void));
|
||||||
void log __P((int, char *, ...));
|
void log __P((int, char *, ...));
|
||||||
void Lseek __P((int, off_t, int));
|
void Lseek __P((int, off_t, int));
|
||||||
int Open __P((char *, int rw));
|
int Open __P((const char *, int rw));
|
||||||
int Read __P((int, void *, int));
|
int Read __P((int, void *, int));
|
||||||
char *rawname __P((char *s));
|
char *rawname __P((char *s));
|
||||||
void save_core __P((void));
|
void save_core __P((void));
|
||||||
@ -202,7 +202,7 @@ kmem_setup()
|
|||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int kmem, i;
|
int kmem, i;
|
||||||
char *dump_sys;
|
const char *dump_sys;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some names we need for the currently running system, others for
|
* Some names we need for the currently running system, others for
|
||||||
@ -212,16 +212,17 @@ kmem_setup()
|
|||||||
* presumed to be the same (since the disk partitions are probably
|
* presumed to be the same (since the disk partitions are probably
|
||||||
* the same!)
|
* the same!)
|
||||||
*/
|
*/
|
||||||
if ((nlist(_PATH_UNIX, current_nl)) == -1)
|
if ((nlist(getbootfile(), current_nl)) == -1)
|
||||||
syslog(LOG_ERR, "%s: nlist: %s", _PATH_UNIX, strerror(errno));
|
syslog(LOG_ERR, "%s: nlist: %s", getbootfile(),
|
||||||
|
strerror(errno));
|
||||||
for (i = 0; cursyms[i] != -1; i++)
|
for (i = 0; cursyms[i] != -1; i++)
|
||||||
if (current_nl[cursyms[i]].n_value == 0) {
|
if (current_nl[cursyms[i]].n_value == 0) {
|
||||||
syslog(LOG_ERR, "%s: %s not in namelist",
|
syslog(LOG_ERR, "%s: %s not in namelist",
|
||||||
_PATH_UNIX, current_nl[cursyms[i]].n_name);
|
getbootfile(), current_nl[cursyms[i]].n_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_sys = kernel ? kernel : _PATH_UNIX;
|
dump_sys = kernel ? kernel : getbootfile();
|
||||||
if ((nlist(dump_sys, dump_nl)) == -1)
|
if ((nlist(dump_sys, dump_nl)) == -1)
|
||||||
syslog(LOG_ERR, "%s: nlist: %s", dump_sys, strerror(errno));
|
syslog(LOG_ERR, "%s: nlist: %s", dump_sys, strerror(errno));
|
||||||
for (i = 0; dumpsyms[i] != -1; i++)
|
for (i = 0; dumpsyms[i] != -1; i++)
|
||||||
@ -278,7 +279,7 @@ check_kmem()
|
|||||||
if (strcmp(vers, core_vers) && kernel == 0)
|
if (strcmp(vers, core_vers) && kernel == 0)
|
||||||
syslog(LOG_WARNING,
|
syslog(LOG_WARNING,
|
||||||
"warning: %s version mismatch:\n\t%s\nand\t%s\n",
|
"warning: %s version mismatch:\n\t%s\nand\t%s\n",
|
||||||
_PATH_UNIX, vers, core_vers);
|
getbootfile(), vers, core_vers);
|
||||||
(void)fseek(fp,
|
(void)fseek(fp,
|
||||||
(off_t)(dumplo + ok(dump_nl[X_PANICSTR].n_value)), L_SET);
|
(off_t)(dumplo + ok(dump_nl[X_PANICSTR].n_value)), L_SET);
|
||||||
(void)fread(&panicstr, sizeof(panicstr), 1, fp);
|
(void)fread(&panicstr, sizeof(panicstr), 1, fp);
|
||||||
@ -413,7 +414,7 @@ err2: syslog(LOG_WARNING,
|
|||||||
(void)close(ofd);
|
(void)close(ofd);
|
||||||
|
|
||||||
/* Copy the kernel. */
|
/* Copy the kernel. */
|
||||||
ifd = Open(kernel ? kernel : _PATH_UNIX, O_RDONLY);
|
ifd = Open(kernel ? kernel : getbootfile(), O_RDONLY);
|
||||||
(void)snprintf(path, sizeof(path), "%s/kernel.%d%s",
|
(void)snprintf(path, sizeof(path), "%s/kernel.%d%s",
|
||||||
dirname, bounds, compress ? ".Z" : "");
|
dirname, bounds, compress ? ".Z" : "");
|
||||||
if (compress) {
|
if (compress) {
|
||||||
@ -440,7 +441,7 @@ err2: syslog(LOG_WARNING,
|
|||||||
}
|
}
|
||||||
if (nr < 0) {
|
if (nr < 0) {
|
||||||
syslog(LOG_ERR, "%s: %s",
|
syslog(LOG_ERR, "%s: %s",
|
||||||
kernel ? kernel : _PATH_UNIX, strerror(errno));
|
kernel ? kernel : getbootfile(), strerror(errno));
|
||||||
syslog(LOG_WARNING,
|
syslog(LOG_WARNING,
|
||||||
"WARNING: kernel may be incomplete");
|
"WARNING: kernel may be incomplete");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -532,13 +533,13 @@ int
|
|||||||
check_space()
|
check_space()
|
||||||
{
|
{
|
||||||
register FILE *fp;
|
register FILE *fp;
|
||||||
char *tkernel;
|
const char *tkernel;
|
||||||
off_t minfree, spacefree, kernelsize, needed;
|
off_t minfree, spacefree, kernelsize, needed;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
struct statfs fsbuf;
|
struct statfs fsbuf;
|
||||||
char buf[100], path[MAXPATHLEN];
|
char buf[100], path[MAXPATHLEN];
|
||||||
|
|
||||||
tkernel = kernel ? kernel : _PATH_UNIX;
|
tkernel = kernel ? kernel : getbootfile();
|
||||||
if (stat(tkernel, &st) < 0) {
|
if (stat(tkernel, &st) < 0) {
|
||||||
syslog(LOG_ERR, "%s: %m", tkernel);
|
syslog(LOG_ERR, "%s: %m", tkernel);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -575,7 +576,7 @@ check_space()
|
|||||||
|
|
||||||
int
|
int
|
||||||
Open(name, rw)
|
Open(name, rw)
|
||||||
char *name;
|
const char *name;
|
||||||
int rw;
|
int rw;
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -110,7 +110,7 @@ dkinit()
|
|||||||
}
|
}
|
||||||
NREAD(X_DK_NDRIVE, &dk_ndrive, LONG);
|
NREAD(X_DK_NDRIVE, &dk_ndrive, LONG);
|
||||||
if (dk_ndrive <= 0) {
|
if (dk_ndrive <= 0) {
|
||||||
error("dk_ndrive=%d according to %s", dk_ndrive, _PATH_UNIX);
|
error("dk_ndrive=%d according to %s", dk_ndrive, getbootfile());
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
dk_mspw = (float *)calloc(dk_ndrive, sizeof (float));
|
dk_mspw = (float *)calloc(dk_ndrive, sizeof (float));
|
||||||
|
@ -145,7 +145,7 @@ initmbufs()
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
if (namelist[X_MBSTAT].n_type == 0) {
|
if (namelist[X_MBSTAT].n_type == 0) {
|
||||||
error("namelist on %s failed", _PATH_UNIX);
|
error("namelist on %s failed", getbootfile());
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (system == NULL)
|
if (system == NULL)
|
||||||
system = _PATH_UNIX;
|
system = (char *)getbootfile();
|
||||||
accessmode = openfiles(system, kmemf, &kvmvars);
|
accessmode = openfiles(system, kmemf, &kvmvars);
|
||||||
mode = getprof(&kvmvars);
|
mode = getprof(&kvmvars);
|
||||||
if (hflag)
|
if (hflag)
|
||||||
|
@ -83,7 +83,7 @@ main(argc, argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
#define basename(cp) ((p = rindex((cp), '/')) != NULL ? p + 1 : (cp))
|
#define basename(cp) ((p = rindex((cp), '/')) != NULL ? p + 1 : (cp))
|
||||||
nlistpath = argc > 0 ? argv[0] : _PATH_UNIX;
|
nlistpath = argc > 0 ? argv[0] : (char *)getbootfile();
|
||||||
nlistname = basename(nlistpath);
|
nlistname = basename(nlistpath);
|
||||||
|
|
||||||
(void)snprintf(dbtemp, sizeof(dbtemp), "%skvm_%s.tmp",
|
(void)snprintf(dbtemp, sizeof(dbtemp), "%skvm_%s.tmp",
|
||||||
|
@ -66,7 +66,7 @@ testdb()
|
|||||||
if ((kd = open(_PATH_KMEM, O_RDONLY, 0)) < 0)
|
if ((kd = open(_PATH_KMEM, O_RDONLY, 0)) < 0)
|
||||||
goto close;
|
goto close;
|
||||||
|
|
||||||
uf = _PATH_UNIX;
|
uf = (char *)getbootfile();
|
||||||
if ((cp = rindex(uf, '/')) != 0)
|
if ((cp = rindex(uf, '/')) != 0)
|
||||||
uf = cp + 1;
|
uf = cp + 1;
|
||||||
(void) snprintf(dbname, sizeof(dbname), "%skvm_%s.db", _PATH_VARDB, uf);
|
(void) snprintf(dbname, sizeof(dbname), "%skvm_%s.db", _PATH_VARDB, uf);
|
||||||
|
@ -164,7 +164,7 @@ main(argc, argv)
|
|||||||
setgid(getgid());
|
setgid(getgid());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
system = _PATH_UNIX;
|
system = (char *)getbootfile();
|
||||||
|
|
||||||
if (nlist(system, nl) < 0 || !nl[0].n_value) {
|
if (nlist(system, nl) < 0 || !nl[0].n_value) {
|
||||||
fprintf(stderr, "trpt: %s: no namelist\n", system);
|
fprintf(stderr, "trpt: %s: no namelist\n", system);
|
||||||
|
@ -95,7 +95,7 @@ main(argc, argv)
|
|||||||
int i, mask = 0, npcbs = 0;
|
int i, mask = 0, npcbs = 0;
|
||||||
char *system, *core;
|
char *system, *core;
|
||||||
|
|
||||||
system = _PATH_UNIX;
|
system = (char *)getbootfile();
|
||||||
core = _PATH_KMEM;
|
core = _PATH_KMEM;
|
||||||
|
|
||||||
argc--, argv++;
|
argc--, argv++;
|
||||||
|
@ -420,9 +420,9 @@ getoffsets(filex, tick_off, tickadj_off, dosync_off, noprintf_off)
|
|||||||
{""},
|
{""},
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
static char *kernels[] = {
|
char *kernels[] = {
|
||||||
#ifdef _PATH_UNIX
|
#if __FreeBSD__ > 2
|
||||||
_PATH_UNIX,
|
(char *)getbootfile(),
|
||||||
#endif
|
#endif
|
||||||
"/vmunix",
|
"/vmunix",
|
||||||
"/unix",
|
"/unix",
|
||||||
|
Loading…
Reference in New Issue
Block a user