Print this page
11626 introduce /etc/versions/build
11627 clean up UUID code for ::status

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/modsysfile.c
          +++ new/usr/src/uts/common/os/modsysfile.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   * Copyright 2017 Nexenta Systems, Inc.
       26 + * Copyright 2019 Joyent, Inc.
  26   27   */
  27   28  
  28   29  #include <sys/types.h>
  29   30  #include <sys/inttypes.h>
  30   31  #include <sys/param.h>
  31   32  #include <sys/systm.h>
  32   33  #include <sys/user.h>
  33   34  #include <sys/disp.h>
  34   35  #include <sys/conf.h>
  35   36  #include <sys/bootconf.h>
↓ open down ↓ 24 lines elided ↑ open up ↑
  60   61  #define CLASSFILE       "/etc/driver_classes"
  61   62  #define DACFFILE        "/etc/dacf.conf"
  62   63  
  63   64  static char class_file[] = CLASSFILE;
  64   65  static char dafile[] = DAFILE;
  65   66  static char dacffile[] = DACFFILE;
  66   67  
  67   68  char *self_assembly = "/etc/system.d/.self-assembly";
  68   69  char *systemfile = "/etc/system";       /* name of ascii system file */
  69   70  
       71 +#define BUILDVERSION_LEN (4096)
       72 +
       73 +char *versionfile = "/etc/versions/build";
       74 +char buildversion[BUILDVERSION_LEN];
       75 +
  70   76  static struct sysparam *sysparam_hd;    /* head of parameters list */
  71   77  static struct sysparam *sysparam_tl;    /* tail of parameters list */
  72   78  static vmem_t *mod_sysfile_arena;       /* parser memory */
  73   79  
  74   80  char obp_bootpath[BO_MAXOBJNAME];       /* bootpath from obp */
  75   81  
  76   82  #if defined(_PSM_MODULES)
  77   83  
  78   84  struct psm_mach {
  79   85          struct psm_mach *m_next;
↓ open down ↓ 724 lines elided ↑ open up ↑
 804  810                                  break;
 805  811                          }
 806  812                  }
 807  813                  kobj_close_file(file);
 808  814          }
 809  815  }
 810  816  
 811  817  void
 812  818  mod_read_system_file(int ask)
 813  819  {
      820 +        struct _buf *file;
      821 +
 814  822          mod_sysfile_arena = vmem_create("mod_sysfile", NULL, 0, 8,
 815  823              segkmem_alloc, segkmem_free, heap_arena, 0, VM_SLEEP);
 816  824  
 817  825          if (ask)
 818  826                  mod_askparams();
 819  827  
 820  828          /*
 821  829           * Read the user self-assembly file first
 822  830           * to preserve existing system settings.
 823  831           */
↓ open down ↓ 7 lines elided ↑ open up ↑
 831  839           * Sanity check of /etc/system.
 832  840           */
 833  841          check_system_file();
 834  842  
 835  843          param_preset();
 836  844          (void) mod_sysctl(SYS_SET_KVAR, NULL);
 837  845          param_check();
 838  846  
 839  847          if (ask == 0)
 840  848                  setparams();
      849 +
      850 +        /*
      851 +         * A convenient place to read in our build version string.
      852 +         */
      853 +
      854 +        if ((file = kobj_open_file(versionfile)) != (struct _buf *)-1) {
      855 +                if (kobj_read_file(file, buildversion,
      856 +                    sizeof (buildversion) - 1, 0) == -1) {
      857 +                        cmn_err(CE_WARN, "failed to read %s\n", versionfile);
      858 +                }
      859 +                kobj_close_file(file);
      860 +        }
 841  861  }
 842  862  
 843  863  /*
 844  864   * Search for a specific module variable assignment in /etc/system.  If
 845  865   * successful, 1 is returned and the value is stored in '*value'.
 846  866   * Otherwise 0 is returned and '*value' isn't modified.  If 'module' is
 847  867   * NULL we look for global definitions.
 848  868   *
 849  869   * This is useful if the value of an assignment is needed before a
 850  870   * module is loaded (e.g. to obtain a default privileged rctl limit).
↓ open down ↓ 2408 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX