Print this page
11657 Remove old ctf tools

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/ctfmerge/ctfmerge.c
          +++ new/usr/src/cmd/ctfmerge/ctfmerge.c
↓ open down ↓ 37 lines elided ↑ open up ↑
  38   38  static char *g_progname;
  39   39  static char *g_unique;
  40   40  static char *g_outfile;
  41   41  static uint_t g_nctf;
  42   42  
  43   43  #define CTFMERGE_OK     0
  44   44  #define CTFMERGE_FATAL  1
  45   45  #define CTFMERGE_USAGE  2
  46   46  
  47   47  #define CTFMERGE_DEFAULT_NTHREADS       8
  48      -#define CTFMERGE_ALTEXEC        "CTFMERGE_ALTEXEC"
  49   48  
  50   49  static void __attribute__((__noreturn__))
  51   50  ctfmerge_fatal(const char *fmt, ...)
  52   51  {
  53   52          va_list ap;
  54   53  
  55   54          (void) fprintf(stderr, "%s: ", g_progname);
  56   55          va_start(ap, fmt);
  57   56          (void) vfprintf(stderr, fmt, ap);
  58   57          va_end(ap);
↓ open down ↓ 246 lines elided ↑ open up ↑
 305  304              "\n"
 306  305              "\t-d  uniquify merged output against uniqfile\n"
 307  306              "\t-j  use nthrs threads to perform the merge\n"
 308  307              "\t-l  set output container's label to specified value\n"
 309  308              "\t-L  set output container's label to value from environment\n"
 310  309              "\t-m  allow C-based input files to not have CTF\n"
 311  310              "\t-o  file to add CTF data to\n",
 312  311              g_progname);
 313  312  }
 314  313  
 315      -static void
 316      -ctfmerge_altexec(char **argv)
 317      -{
 318      -        const char *alt;
 319      -        char *altexec;
 320      -
 321      -        alt = getenv(CTFMERGE_ALTEXEC);
 322      -        if (alt == NULL || *alt == '\0')
 323      -                return;
 324      -
 325      -        altexec = strdup(alt);
 326      -        if (altexec == NULL)
 327      -                ctfmerge_fatal("failed to allocate memory for altexec\n");
 328      -        if (unsetenv(CTFMERGE_ALTEXEC) != 0)
 329      -                ctfmerge_fatal("failed to unset %s from environment: %s\n",
 330      -                    CTFMERGE_ALTEXEC, strerror(errno));
 331      -
 332      -        (void) execv(altexec, argv);
 333      -        ctfmerge_fatal("failed to execute alternate program %s: %s",
 334      -            altexec, strerror(errno));
 335      -}
 336      -
 337  314  int
 338  315  main(int argc, char *argv[])
 339  316  {
 340  317          int err, i, c, ofd;
 341  318          uint_t nthreads = CTFMERGE_DEFAULT_NTHREADS;
 342  319          char *tmpfile = NULL, *label = NULL;
 343  320          int wflags = CTF_ELFWRITE_F_COMPRESS;
 344  321          uint_t flags = 0;
 345  322          ctf_merge_t *cmh;
 346  323          ctf_file_t *ofp;
 347  324          long argj;
 348  325          char *eptr;
 349  326  
 350  327          g_progname = basename(argv[0]);
 351  328  
 352      -        ctfmerge_altexec(argv);
 353      -
 354  329          /*
 355  330           * We support a subset of the old CTF merge flags, mostly for
 356  331           * compatibility.
 357  332           */
 358  333          while ((c = getopt(argc, argv, ":d:fgj:l:L:mo:t")) != -1) {
 359  334                  switch (c) {
 360  335                  case 'd':
 361  336                          g_unique = optarg;
 362  337                          break;
 363  338                  case 'f':
↓ open down ↓ 126 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX