Don't open the swap file. The open descriptor for it hasn't been used

for over 5 years since we switched to using procfs for kvm_uread().
This cleanup was motivated by recent breakage of the default swap file
(/dev/drum) when swapon() has not been called.
This commit is contained in:
Bruce Evans 1999-08-25 03:01:54 +00:00
parent 2053751093
commit 480bc7e108
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50331
2 changed files with 1 additions and 9 deletions

View File

@ -174,7 +174,6 @@ _kvm_open(kd, uf, mf, sf, flag, errout)
kd->vmfd = -1;
kd->pmfd = -1;
kd->swfd = -1;
kd->nlfd = -1;
kd->vmst = 0;
kd->db = 0;
@ -214,7 +213,6 @@ _kvm_open(kd, uf, mf, sf, flag, errout)
*/
if (strcmp(mf, _PATH_DEVNULL) == 0) {
kd->vmfd = open(_PATH_DEVNULL, O_RDONLY);
kd->swfd = open(_PATH_DEVNULL, O_RDONLY);
} else if (strcmp(mf, _PATH_MEM) != 0) {
_kvm_err(kd, kd->program,
"%s: not physical memory device", mf);
@ -224,10 +222,6 @@ _kvm_open(kd, uf, mf, sf, flag, errout)
_kvm_syserr(kd, kd->program, "%s", _PATH_KMEM);
goto failed;
}
if ((kd->swfd = open(sf, flag, 0)) < 0) {
_kvm_syserr(kd, kd->program, "%s", sf);
goto failed;
}
}
/*
* Open kvm nlist database. We go ahead and do this
@ -318,8 +312,6 @@ kvm_close(kd)
error |= close(kd->vmfd);
if (kd->nlfd >= 0)
error |= close(kd->nlfd);
if (kd->swfd >= 0)
error |= close(kd->swfd);
if (kd->db != 0)
error |= (kd->db->close)(kd->db);
if (kd->vmst)

View File

@ -50,7 +50,7 @@ struct __kvm {
#define ISALIVE(kd) ((kd)->vmfd >= 0)
int pmfd; /* physical memory file (or crashdump) */
int vmfd; /* virtual memory file (-1 if crashdump) */
int swfd; /* swap file (e.g., /dev/drum) */
int unused; /* was: swap file (e.g., /dev/drum) */
int nlfd; /* namelist file (e.g., /kernel) */
struct kinfo_proc *procbase;
char *argspc; /* (dynamic) storage for argv strings */