Print this page
4839 3294 generated elfdump struct layouts by hand, shouldn't have

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c
          +++ new/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  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  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  27      -
  28   26  
  29   27  #include <stdlib.h>
  30   28  #include <stddef.h>
  31   29  #include <stdio.h>
  32   30  #include <string.h>
  33   31  #include <fcntl.h>
  34   32  #include <sys/types.h>
  35   33  #include <sys/stat.h>
  36   34  #include <unistd.h>
  37   35  #include <sys/sysmacros.h>
↓ open down ↓ 511 lines elided ↑ open up ↑
 549  547  
 550  548          ARRAY_FIELD(struct utsname,     sysname,        0);
 551  549          ARRAY_FIELD(struct utsname,     nodename,       0);
 552  550          ARRAY_FIELD(struct utsname,     release,        0);
 553  551          ARRAY_FIELD(struct utsname,     version,        0);
 554  552          ARRAY_FIELD(struct utsname,     machine,        0);
 555  553  
 556  554          END;
 557  555  }
 558  556  
      557 +static void
      558 +gen_prfdinfo(void)
      559 +{
      560 +        START(prfdinfo, prfdinfo_t);
      561 +
      562 +        SCALAR_FIELD(prfdinfo_t,        pr_fd,          0);
      563 +        SCALAR_FIELD(prfdinfo_t,        pr_mode,        0);
      564 +        SCALAR_FIELD(prfdinfo_t,        pr_uid,         0);
      565 +        SCALAR_FIELD(prfdinfo_t,        pr_gid,         0);
      566 +        SCALAR_FIELD(prfdinfo_t,        pr_major,       0);
      567 +        SCALAR_FIELD(prfdinfo_t,        pr_minor,       0);
      568 +        SCALAR_FIELD(prfdinfo_t,        pr_rmajor,      0);
      569 +        SCALAR_FIELD(prfdinfo_t,        pr_rminor,      0);
      570 +        SCALAR_FIELD(prfdinfo_t,        pr_ino,         0);
      571 +        SCALAR_FIELD(prfdinfo_t,        pr_offset,      0);
      572 +        SCALAR_FIELD(prfdinfo_t,        pr_size,        0);
      573 +        SCALAR_FIELD(prfdinfo_t,        pr_fileflags,   0);
      574 +        SCALAR_FIELD(prfdinfo_t,        pr_fdflags,     0);
      575 +        ARRAY_FIELD(prfdinfo_t,         pr_path,        0);
      576 +
      577 +        END;
      578 +}
      579 +
 559  580  
 560  581  /*ARGSUSED*/
 561  582  int
 562  583  main(int argc, char *argv[])
 563  584  {
 564  585          const char *fmt = "\t&%s_layout,\n";
 565  586  
 566  587          printf("#include <struct_layout.h>\n");
 567  588  
 568  589          gen_auxv();
↓ open down ↓ 8 lines elided ↑ open up ↑
 577  598          gen_prpriv();
 578  599          gen_priv_impl_info();
 579  600          gen_fltset();
 580  601          gen_siginfo();
 581  602          gen_sigset();
 582  603          gen_sigaction();
 583  604          gen_stack();
 584  605          gen_sysset();
 585  606          gen_timestruc();
 586  607          gen_utsname();
      608 +        gen_prfdinfo();
 587  609  
 588  610  
 589  611          /*
 590  612           * Generate the full arch_layout description
 591  613           */
 592  614          (void) printf(
 593  615              "\n\n\n\nstatic const sl_arch_layout_t layout_%s = {\n",
 594  616              MACH);
 595  617          (void) printf(fmt, "auxv");
 596  618          (void) printf(fmt, "fltset");
↓ open down ↓ 7 lines elided ↑ open up ↑
 604  626          (void) printf(fmt, "prgregset");
 605  627          (void) printf(fmt, "prpsinfo");
 606  628          (void) printf(fmt, "prstatus");
 607  629          (void) printf(fmt, "sigaction");
 608  630          (void) printf(fmt, "siginfo");
 609  631          (void) printf(fmt, "sigset");
 610  632          (void) printf(fmt, "stack");
 611  633          (void) printf(fmt, "sysset");
 612  634          (void) printf(fmt, "timestruc");
 613  635          (void) printf(fmt, "utsname");
      636 +        (void) printf(fmt, "prfdinfo");
 614  637          (void) printf("};\n");
 615  638  
 616  639          /*
 617  640           * A public function, to make the information available
 618  641           */
 619  642          (void) printf("\n\nconst sl_arch_layout_t *\n");
 620  643          (void) printf("struct_layout_%s(void)\n", MACH);
 621  644          (void) printf("{\n\treturn (&layout_%s);\n}\n", MACH);
 622  645  
 623  646          return (0);
 624  647  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX