Print this page
5819 want dumpadm(1m) option to print estimated dump size

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/dumpadm/dconf.c
          +++ new/usr/src/cmd/dumpadm/dconf.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  23   24   */
  24   25  
  25   26  #include <sys/types.h>
  26   27  #include <sys/stat.h>
  27   28  #include <sys/swap.h>
  28   29  #include <sys/dumpadm.h>
  29   30  #include <sys/utsname.h>
  30   31  
  31   32  #include <unistd.h>
  32   33  #include <string.h>
↓ open down ↓ 479 lines elided ↑ open up ↑
 512  513          uuid_unparse(uu, uuidstr);
 513  514  
 514  515          err = ioctl(dcp->dc_dump_fd, DIOCSETUUID, uuidstr);
 515  516  
 516  517          if (err)
 517  518                  warn(gettext("kernel image uuid write failed"));
 518  519  
 519  520          return (err == 0);
 520  521  }
 521  522  
      523 +int
      524 +dconf_get_dumpsize(dumpconf_t *dcp)
      525 +{
      526 +        char buf[32];
      527 +        uint64_t d;
      528 +
      529 +        if (ioctl(dcp->dc_dump_fd, DIOCGETDUMPSIZE, &d) == -1) {
      530 +                warn(gettext("failed to get kernel dump size"));
      531 +                return (-1);
      532 +        }
      533 +
      534 +        zfs_nicenum(d, buf, sizeof (buf));
      535 +
      536 +        (void) printf(gettext("Estimated dump size: %s\n"), buf);
      537 +        return (0);
      538 +}
      539 +
 522  540  void
 523  541  dconf_print(dumpconf_t *dcp, FILE *fp)
 524  542  {
 525  543          u_longlong_t min;
 526  544          char *content;
 527  545  
 528  546          if (dcp->dc_cflags & DUMP_ALL)
 529  547                  content = gettext("all");
 530  548          else if (dcp->dc_cflags & DUMP_CURPROC)
 531  549                  content = gettext("kernel and current process");
↓ open down ↓ 163 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX