Print this page
2445 savecore fails with dump archive but return EXIT_OK

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/savecore/savecore.c
          +++ new/usr/src/cmd/savecore/savecore.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  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) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
       24 +/*
       25 + * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
       26 + */
  24   27  
  25   28  #include <stdio.h>
  26   29  #include <stdlib.h>
  27   30  #include <stdarg.h>
  28   31  #include <unistd.h>
  29   32  #include <fcntl.h>
  30   33  #include <errno.h>
  31   34  #include <string.h>
  32   35  #include <deflt.h>
  33   36  #include <time.h>
↓ open down ↓ 177 lines elided ↑ open up ↑
 211  214  
 212  215          switch (flags & _SC_ALLEXIT) {
 213  216          case 0:
 214  217                  return;
 215  218  
 216  219          case SC_EXIT_OK:
 217  220                  code = 0;
 218  221                  break;
 219  222  
 220  223          case SC_EXIT_PEND:
      224 +                /*
      225 +                 * Raise an ireport saying why we are exiting.  Do not
      226 +                 * raise if run as savecore -m.  If something in the
      227 +                 * raise_event codepath calls logprint avoid recursion.
      228 +                 */
      229 +                if (!mflag && logprint_raised++ == 0)
      230 +                        raise_event(SC_EVENT_SAVECORE_FAILURE, buf);
 221  231                  code = 2;
 222  232                  break;
 223  233  
 224  234          case SC_EXIT_FM:
 225  235                  code = 3;
 226  236                  break;
 227  237  
 228  238          case SC_EXIT_ERR:
 229  239          default:
 230      -                /*
 231      -                 * Raise an ireport saying why we are exiting.  Do not
 232      -                 * raise if run as savecore -m.  If something in the
 233      -                 * raise_event codepath calls logprint avoid recursion.
 234      -                 */
 235  240                  if (!mflag && logprint_raised++ == 0)
 236  241                          raise_event(SC_EVENT_SAVECORE_FAILURE, buf);
 237  242                  code = 1;
 238  243                  break;
 239  244          }
 240  245  
 241  246          exit(code);
 242  247  }
 243  248  
 244  249  /*
↓ open down ↓ 104 lines elided ↑ open up ↑
 349  354                  dumpfd = Open(dumpfile, O_RDONLY, 0644);
 350  355          else
 351  356                  dumpfd = Open(dumpfile, O_RDWR | O_DSYNC, 0644);
 352  357          endoff = llseek(dumpfd, -DUMP_OFFSET, SEEK_END) & -DUMP_OFFSET;
 353  358          Pread(dumpfd, &dumphdr, sizeof (dumphdr), endoff);
 354  359          Pread(dumpfd, &datahdr, sizeof (datahdr), endoff + sizeof (dumphdr));
 355  360  
 356  361          pagesize = dumphdr.dump_pagesize;
 357  362  
 358  363          if (dumphdr.dump_magic != DUMP_MAGIC)
 359      -                logprint(SC_SL_NONE | SC_EXIT_OK, "bad magic number %x",
      364 +                logprint(SC_SL_NONE | SC_EXIT_PEND, "bad magic number %x",
 360  365                      dumphdr.dump_magic);
 361  366  
 362  367          if ((dumphdr.dump_flags & DF_VALID) == 0 && !disregard_valid_flag)
 363  368                  logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_OK,
 364  369                      "dump already processed");
 365  370  
 366  371          if (dumphdr.dump_version != DUMP_VERSION)
 367      -                logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_OK,
      372 +                logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_PEND,
 368  373                      "dump version (%d) != %s version (%d)",
 369  374                      dumphdr.dump_version, progname, DUMP_VERSION);
 370  375  
 371  376          if (dumphdr.dump_wordsize != DUMP_WORDSIZE)
 372      -                logprint(SC_SL_NONE | SC_EXIT_OK,
      377 +                logprint(SC_SL_NONE | SC_EXIT_PEND,
 373  378                      "dump is from %u-bit kernel - cannot save on %u-bit kernel",
 374  379                      dumphdr.dump_wordsize, DUMP_WORDSIZE);
 375  380  
 376  381          if (datahdr.dump_datahdr_magic == DUMP_DATAHDR_MAGIC) {
 377  382                  if (datahdr.dump_datahdr_version != DUMP_DATAHDR_VERSION)
 378      -                        logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_OK,
      383 +                        logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_PEND,
 379  384                              "dump data version (%d) != %s data version (%d)",
 380  385                              datahdr.dump_datahdr_version, progname,
 381  386                              DUMP_DATAHDR_VERSION);
 382  387          } else {
 383  388                  (void) memset(&datahdr, 0, sizeof (datahdr));
 384  389                  datahdr.dump_maxcsize = pagesize;
 385  390          }
 386  391  
 387  392          /*
 388  393           * Read the initial header, clear the valid bits, and compare headers.
↓ open down ↓ 1580 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX