Print this page
11657 Remove old ctf tools

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/ctfconvert/ctfconvert.c
          +++ new/usr/src/cmd/ctfconvert/ctfconvert.c
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13      - * Copyright (c) 2019, Joyent, Inc.
       13 + * Copyright 2019 Joyent, Inc.
  14   14   */
  15   15  
  16   16  /*
  17   17   * Create CTF from extant debugging information
  18   18   */
  19   19  
  20   20  #include <stdio.h>
  21   21  #include <unistd.h>
  22   22  #include <stdlib.h>
  23   23  #include <stdarg.h>
↓ open down ↓ 8 lines elided ↑ open up ↑
  32   32  #include <limits.h>
  33   33  #include <strings.h>
  34   34  #include <sys/debug.h>
  35   35  
  36   36  #define CTFCONVERT_OK           0
  37   37  #define CTFCONVERT_FATAL        1
  38   38  #define CTFCONVERT_USAGE        2
  39   39  
  40   40  #define CTFCONVERT_DEFAULT_NTHREADS     4
  41   41  
  42      -#define CTFCONVERT_ALTEXEC      "CTFCONVERT_ALTEXEC"
  43      -
  44   42  static char *ctfconvert_progname;
  45   43  
  46   44  static void
  47   45  ctfconvert_fatal(const char *fmt, ...)
  48   46  {
  49   47          va_list ap;
  50   48  
  51   49          (void) fprintf(stderr, "%s: ", ctfconvert_progname);
  52   50          va_start(ap, fmt);
  53   51          (void) vfprintf(stderr, fmt, ap);
↓ open down ↓ 161 lines elided ↑ open up ↑
 215  213          }
 216  214  
 217  215          if (ctf_update(fp) == CTF_ERR) {
 218  216                  ctfconvert_fatal("failed to update output file: %s\n",
 219  217                      ctf_errmsg(ctf_errno(fp)));
 220  218          }
 221  219  
 222  220          VERIFY(ctf_type_size(fp, cpuid) == sz);
 223  221  }
 224  222  
 225      -static void
 226      -ctfconvert_altexec(char **argv)
 227      -{
 228      -        const char *alt;
 229      -        char *altexec;
 230      -
 231      -        alt = getenv(CTFCONVERT_ALTEXEC);
 232      -        if (alt == NULL || *alt == '\0')
 233      -                return;
 234      -
 235      -        altexec = strdup(alt);
 236      -        if (altexec == NULL)
 237      -                ctfconvert_fatal("failed to allocate memory for altexec\n");
 238      -        if (unsetenv(CTFCONVERT_ALTEXEC) != 0)
 239      -                ctfconvert_fatal("failed to unset %s from environment: %s\n",
 240      -                    CTFCONVERT_ALTEXEC, strerror(errno));
 241      -
 242      -        (void) execv(altexec, argv);
 243      -        ctfconvert_fatal("failed to execute alternate program %s: %s",
 244      -            altexec, strerror(errno));
 245      -}
 246      -
 247  223  int
 248  224  main(int argc, char *argv[])
 249  225  {
 250  226          int c, ifd, err;
 251  227          boolean_t keep = B_FALSE;
 252  228          uint_t flags = 0;
 253  229          uint_t nthreads = CTFCONVERT_DEFAULT_NTHREADS;
 254  230          const char *outfile = NULL;
 255  231          const char *label = NULL;
 256  232          const char *infile = NULL;
 257  233          char *tmpfile;
 258  234          ctf_file_t *ofp;
 259  235          long argj;
 260  236          char *eptr;
 261  237          char buf[4096];
 262  238          boolean_t optx = B_FALSE;
 263  239          boolean_t ignore_non_c = B_FALSE;
 264  240  
 265  241          ctfconvert_progname = basename(argv[0]);
 266  242  
 267      -        ctfconvert_altexec(argv);
 268      -
 269  243          while ((c = getopt(argc, argv, ":ij:kl:L:mo:X")) != -1) {
 270  244                  switch (c) {
 271  245                  case 'i':
 272  246                          ignore_non_c = B_TRUE;
 273  247                          break;
 274  248                  case 'j':
 275  249                          errno = 0;
 276  250                          argj = strtol(optarg, &eptr, 10);
 277  251                          if (errno != 0 || argj == LONG_MAX ||
 278  252                              argj > 1024 || *eptr != '\0') {
↓ open down ↓ 128 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX