savecore.c (92086) | savecore.c (92806) |
---|---|
1/*- 2 * Copyright (c) 1986, 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94"; 43#endif 44static const char rcsid[] = | 1/*- 2 * Copyright (c) 1986, 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94"; 43#endif 44static const char rcsid[] = |
45 "$FreeBSD: head/sbin/savecore/savecore.c 92086 2002-03-11 11:23:48Z des $"; | 45 "$FreeBSD: head/sbin/savecore/savecore.c 92806 2002-03-20 17:55:10Z obrien $"; |
46#endif /* not lint */ 47 48#include <sys/param.h> 49#include <sys/stat.h> 50#include <sys/mount.h> 51#include <sys/syslog.h> 52#include <sys/sysctl.h> 53 --- 308 unchanged lines hidden (view full) --- 362#define BLOCKMASK (~(BLOCKSIZE-1)) 363 364/* 365 * Save the core dump. 366 */ 367void 368save_core() 369{ | 46#endif /* not lint */ 47 48#include <sys/param.h> 49#include <sys/stat.h> 50#include <sys/mount.h> 51#include <sys/syslog.h> 52#include <sys/sysctl.h> 53 --- 308 unchanged lines hidden (view full) --- 362#define BLOCKMASK (~(BLOCKSIZE-1)) 363 364/* 365 * Save the core dump. 366 */ 367void 368save_core() 369{ |
370 register FILE *fp; 371 register int bounds, ifd, nr, nw; | 370 FILE *fp; 371 int bounds, ifd, nr, nw; |
372 int hs, he; /* start and end of hole */ 373 char path[MAXPATHLEN]; 374 mode_t oumask; 375 376 /* 377 * Get the current number and update the bounds file. Do the update 378 * now, because may fail later and don't want to overwrite anything. 379 */ --- 133 unchanged lines hidden (view full) --- 513 514/* 515 * Verify that the specified device node exists and matches the 516 * specified device. 517 */ 518int 519verify_dev(name, dev) 520 char *name; | 372 int hs, he; /* start and end of hole */ 373 char path[MAXPATHLEN]; 374 mode_t oumask; 375 376 /* 377 * Get the current number and update the bounds file. Do the update 378 * now, because may fail later and don't want to overwrite anything. 379 */ --- 133 unchanged lines hidden (view full) --- 513 514/* 515 * Verify that the specified device node exists and matches the 516 * specified device. 517 */ 518int 519verify_dev(name, dev) 520 char *name; |
521 register dev_t dev; | 521 dev_t dev; |
522{ 523 struct stat sb; 524 525 if (lstat(name, &sb) == -1) 526 return (-1); 527 if (!S_ISCHR(sb.st_mode) || sb.st_rdev != dev) 528 return (-1); 529 return (0); 530} 531 532/* 533 * Find the dump device. 534 * 535 * 1) try devname(3); see if it returns something sensible 536 * 2) scan /dev for the desired node 537 * 3) as a last resort, try to create the node we need 538 */ 539void 540find_dev(dev) | 522{ 523 struct stat sb; 524 525 if (lstat(name, &sb) == -1) 526 return (-1); 527 if (!S_ISCHR(sb.st_mode) || sb.st_rdev != dev) 528 return (-1); 529 return (0); 530} 531 532/* 533 * Find the dump device. 534 * 535 * 1) try devname(3); see if it returns something sensible 536 * 2) scan /dev for the desired node 537 * 3) as a last resort, try to create the node we need 538 */ 539void 540find_dev(dev) |
541 register dev_t dev; | 541 dev_t dev; |
542{ 543 struct dirent *ent; 544 char *dn, *dnp; 545 DIR *d; 546 547 strcpy(ddname, _PATH_DEV); 548 dnp = ddname + sizeof _PATH_DEV - 1; 549 if ((dn = devname(dev, S_IFCHR)) != NULL) { --- 59 unchanged lines hidden (view full) --- 609 610/* 611 * Check that sufficient space is available on the disk that holds the 612 * save directory. 613 */ 614int 615check_space() 616{ | 542{ 543 struct dirent *ent; 544 char *dn, *dnp; 545 DIR *d; 546 547 strcpy(ddname, _PATH_DEV); 548 dnp = ddname + sizeof _PATH_DEV - 1; 549 if ((dn = devname(dev, S_IFCHR)) != NULL) { --- 59 unchanged lines hidden (view full) --- 609 610/* 611 * Check that sufficient space is available on the disk that holds the 612 * save directory. 613 */ 614int 615check_space() 616{ |
617 register FILE *fp; | 617 FILE *fp; |
618 const char *tkernel; 619 off_t minfree, spacefree, totfree, kernelsize, needed; 620 struct stat st; 621 struct statfs fsbuf; 622 char buf[100], path[MAXPATHLEN]; 623 624 tkernel = kernel ? kernel : getbootfile(); 625 if (stat(tkernel, &st) < 0) { --- 169 unchanged lines hidden --- | 618 const char *tkernel; 619 off_t minfree, spacefree, totfree, kernelsize, needed; 620 struct stat st; 621 struct statfs fsbuf; 622 char buf[100], path[MAXPATHLEN]; 623 624 tkernel = kernel ? kernel : getbootfile(); 625 if (stat(tkernel, &st) < 0) { --- 169 unchanged lines hidden --- |