diff options
| author | Marcel Moolenaar <marcel@FreeBSD.org> | 2002-05-27 07:54:43 +0000 |
|---|---|---|
| committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2002-05-27 07:54:43 +0000 |
| commit | 6db5f8a79ec0a22ceae686e7a5470a3046a36841 (patch) | |
| tree | ee163d4e73cf9ba53996a3e9aa01f62a04e87cc7 | |
| parent | 66f9c15fcf7229a1fcac3ac8a15c1a185d945f69 (diff) | |
Notes
| -rw-r--r-- | sbin/savecore/savecore.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index 2571334c33e4..56ee2423c650 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -205,8 +205,8 @@ check_space(char *savedir, off_t dumpsize) static void DoFile(char *savedir, const char *device) { + static char *buf = NULL; struct kerneldumpheader kdhf, kdhl; - char buf[1024 * 1024]; off_t mediasize, dumpsize, firsthd, lasthd, dmpcnt; FILE *info, *fp; int fd, fdinfo, error, wl; @@ -218,6 +218,20 @@ DoFile(char *savedir, const char *device) dmpcnt = 0; mediasize = 0; + /* + * XXX On ia64 something breaks when the buffer is put on the + * stack. When the buffer is roughly larger than 128K the read() + * below simply fails with errno=14 (EFAULT). We work around + * this by doing a on-time allocation... + */ + if (buf == NULL) { + buf = malloc(1024 * 1024); + if (buf == NULL) { + syslog(LOG_ERR, "%m"); + return; + } + } + if (verbose) printf("checking for kernel dump on device %s\n", device); @@ -226,6 +240,7 @@ DoFile(char *savedir, const char *device) syslog(LOG_ERR, "%s: %m", device); return; } + error = ioctl(fd, DIOCGMEDIASIZE, &mediasize); if (!error) error = ioctl(fd, DIOCGSECTORSIZE, §orsize); |
