603 return (add_stuff(cpl, line, attr_res_scope_cmds, word_end)); |
618 return (add_stuff(cpl, line, attr_res_scope_cmds, word_end)); |
604 case RT_DATASET: |
619 case RT_DATASET: |
605 return (add_stuff(cpl, line, dataset_res_scope_cmds, word_end)); |
620 return (add_stuff(cpl, line, dataset_res_scope_cmds, word_end)); |
606 case RT_DCPU: |
621 case RT_DCPU: |
607 return (add_stuff(cpl, line, pset_res_scope_cmds, word_end)); |
622 return (add_stuff(cpl, line, pset_res_scope_cmds, word_end)); |
|
623 case RT_PCAP: |
|
624 return (add_stuff(cpl, line, pcap_res_scope_cmds, word_end)); |
608 case RT_MCAP: |
625 case RT_MCAP: |
609 return (add_stuff(cpl, line, mcap_res_scope_cmds, word_end)); |
626 return (add_stuff(cpl, line, mcap_res_scope_cmds, word_end)); |
610 } |
627 } |
611 return (0); |
628 return (0); |
612 } |
629 } |
1001 gettext("<unsigned integer | range>")); |
1018 gettext("<unsigned integer | range>")); |
1002 (void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET), |
1019 (void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET), |
1003 pt_to_str(PT_IMPORTANCE), |
1020 pt_to_str(PT_IMPORTANCE), |
1004 gettext("<unsigned integer>")); |
1021 gettext("<unsigned integer>")); |
1005 break; |
1022 break; |
|
1023 case RT_PCAP: |
|
1024 (void) fprintf(fp, gettext("The '%s' resource scope is " |
|
1025 "used to set an upper limit (a cap) on the\n" |
|
1026 "percentage of CPU that can be used by this zone. " |
|
1027 "A '%s' value of 1\ncorresponds to one cpu. The " |
|
1028 "value can be set higher than 1, up to the total\n" |
|
1029 "number of CPUs on the system. The value can " |
|
1030 "also be less than 1,\nrepresenting a fraction of " |
|
1031 "a cpu.\n"), |
|
1032 rt_to_str(resource_scope), pt_to_str(PT_NCPUS)); |
|
1033 (void) fprintf(fp, gettext("Valid commands:\n")); |
|
1034 (void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET), |
|
1035 pt_to_str(PT_NCPUS), gettext("<unsigned decimal>")); |
|
1036 break; |
1006 case RT_MCAP: |
1037 case RT_MCAP: |
1007 (void) fprintf(fp, gettext("The '%s' resource scope is " |
1038 (void) fprintf(fp, gettext("The '%s' resource scope is " |
1008 "used to set an upper limit (a cap) on the\n" |
1039 "used to set an upper limit (a cap) on the\n" |
1009 "amount of physical memory, swap space and locked " |
1040 "amount of physical memory, swap space and locked " |
1010 "memory that can be used by\nthis zone.\n"), |
1041 "memory that can be used by\nthis zone.\n"), |
1076 (void) fprintf(fp, |
1107 (void) fprintf(fp, |
1077 gettext("<hostname> := [A-Za-z0-9][A-Za-z0-9-.]*\n")); |
1108 gettext("<hostname> := [A-Za-z0-9][A-Za-z0-9-.]*\n")); |
1078 } |
1109 } |
1079 if (flags & HELP_RESOURCES) { |
1110 if (flags & HELP_RESOURCES) { |
1080 (void) fprintf(fp, "<%s> := %s | %s | %s | %s | %s | %s |\n\t" |
1111 (void) fprintf(fp, "<%s> := %s | %s | %s | %s | %s | %s |\n\t" |
1081 "%s | %s | %s\n\n", |
1112 "%s | %s | %s | %s\n\n", |
1082 gettext("resource type"), rt_to_str(RT_FS), |
1113 gettext("resource type"), rt_to_str(RT_FS), |
1083 rt_to_str(RT_IPD), rt_to_str(RT_NET), rt_to_str(RT_DEVICE), |
1114 rt_to_str(RT_IPD), rt_to_str(RT_NET), rt_to_str(RT_DEVICE), |
1084 rt_to_str(RT_RCTL), rt_to_str(RT_ATTR), |
1115 rt_to_str(RT_RCTL), rt_to_str(RT_ATTR), |
1085 rt_to_str(RT_DATASET), rt_to_str(RT_DCPU), |
1116 rt_to_str(RT_DATASET), rt_to_str(RT_DCPU), |
1086 rt_to_str(RT_MCAP)); |
1117 rt_to_str(RT_PCAP), rt_to_str(RT_MCAP)); |
1087 } |
1118 } |
1088 if (flags & HELP_PROPS) { |
1119 if (flags & HELP_PROPS) { |
1089 (void) fprintf(fp, gettext("For resource type ... there are " |
1120 (void) fprintf(fp, gettext("For resource type ... there are " |
1090 "property types ...:\n")); |
1121 "property types ...:\n")); |
1091 (void) fprintf(fp, "\t%s\t%s\n", gettext("(global)"), |
1122 (void) fprintf(fp, "\t%s\t%s\n", gettext("(global)"), |
1135 pt_to_str(PT_VALUE)); |
1166 pt_to_str(PT_VALUE)); |
1136 (void) fprintf(fp, "\t%s\t\t%s\n", rt_to_str(RT_DATASET), |
1167 (void) fprintf(fp, "\t%s\t\t%s\n", rt_to_str(RT_DATASET), |
1137 pt_to_str(PT_NAME)); |
1168 pt_to_str(PT_NAME)); |
1138 (void) fprintf(fp, "\t%s\t%s, %s\n", rt_to_str(RT_DCPU), |
1169 (void) fprintf(fp, "\t%s\t%s, %s\n", rt_to_str(RT_DCPU), |
1139 pt_to_str(PT_NCPUS), pt_to_str(PT_IMPORTANCE)); |
1170 pt_to_str(PT_NCPUS), pt_to_str(PT_IMPORTANCE)); |
|
1171 (void) fprintf(fp, "\t%s\t%s\n", rt_to_str(RT_PCAP), |
|
1172 pt_to_str(PT_NCPUS)); |
1140 (void) fprintf(fp, "\t%s\t%s, %s, %s\n", rt_to_str(RT_MCAP), |
1173 (void) fprintf(fp, "\t%s\t%s, %s, %s\n", rt_to_str(RT_MCAP), |
1141 pt_to_str(PT_PHYSICAL), pt_to_str(PT_SWAP), |
1174 pt_to_str(PT_PHYSICAL), pt_to_str(PT_SWAP), |
1142 pt_to_str(PT_LOCKED)); |
1175 pt_to_str(PT_LOCKED)); |
1143 } |
1176 } |
1144 if (need_to_close) |
1177 if (need_to_close) |
1833 (void) fprintf(of, "%s %s=%s\n", cmd_to_str(CMD_SET), |
1866 (void) fprintf(of, "%s %s=%s\n", cmd_to_str(CMD_SET), |
1834 pt_to_str(PT_PHYSICAL), buf); |
1867 pt_to_str(PT_PHYSICAL), buf); |
1835 (void) fprintf(of, "%s\n", cmd_to_str(CMD_END)); |
1868 (void) fprintf(of, "%s\n", cmd_to_str(CMD_END)); |
1836 } |
1869 } |
1837 |
1870 |
|
1871 /* |
|
1872 * There is nothing to export for pcap since this resource is just |
|
1873 * a container for an rctl alias. |
|
1874 */ |
|
1875 |
1838 done: |
1876 done: |
1839 if (need_to_close) |
1877 if (need_to_close) |
1840 (void) fclose(of); |
1878 (void) fclose(of); |
1841 } |
1879 } |
1842 |
1880 |
1906 add_resource(cmd_t *cmd) |
1944 add_resource(cmd_t *cmd) |
1907 { |
1945 { |
1908 int type; |
1946 int type; |
1909 struct zone_psettab tmp_psettab; |
1947 struct zone_psettab tmp_psettab; |
1910 struct zone_mcaptab tmp_mcaptab; |
1948 struct zone_mcaptab tmp_mcaptab; |
|
1949 uint64_t tmp; |
1911 uint64_t tmp_mcap; |
1950 uint64_t tmp_mcap; |
1912 char pool[MAXNAMELEN]; |
1951 char pool[MAXNAMELEN]; |
1913 |
1952 |
1914 if ((type = cmd->cmd_res_type) == RT_UNKNOWN) { |
1953 if ((type = cmd->cmd_res_type) == RT_UNKNOWN) { |
1915 long_usage(CMD_ADD, TRUE); |
1954 long_usage(CMD_ADD, TRUE); |
1949 return; |
1988 return; |
1950 case RT_DATASET: |
1989 case RT_DATASET: |
1951 bzero(&in_progress_dstab, sizeof (in_progress_dstab)); |
1990 bzero(&in_progress_dstab, sizeof (in_progress_dstab)); |
1952 return; |
1991 return; |
1953 case RT_DCPU: |
1992 case RT_DCPU: |
1954 /* Make sure there isn't already a cpu-set entry. */ |
1993 /* Make sure there isn't already a cpu-set or cpu-cap entry. */ |
1955 if (zonecfg_lookup_pset(handle, &tmp_psettab) == Z_OK) { |
1994 if (zonecfg_lookup_pset(handle, &tmp_psettab) == Z_OK) { |
1956 zerr(gettext("The %s resource already exists."), |
1995 zerr(gettext("The %s resource already exists."), |
1957 rt_to_str(RT_DCPU)); |
1996 rt_to_str(RT_DCPU)); |
|
1997 goto bad; |
|
1998 } |
|
1999 if (zonecfg_get_aliased_rctl(handle, ALIAS_CPUCAP, &tmp) != |
|
2000 Z_NO_ENTRY) { |
|
2001 zerr(gettext("The %s resource already exists."), |
|
2002 rt_to_str(RT_PCAP)); |
1958 goto bad; |
2003 goto bad; |
1959 } |
2004 } |
1960 |
2005 |
1961 /* Make sure the pool property isn't set. */ |
2006 /* Make sure the pool property isn't set. */ |
1962 if (zonecfg_get_pool(handle, pool, sizeof (pool)) == Z_OK && |
2007 if (zonecfg_get_pool(handle, pool, sizeof (pool)) == Z_OK && |
1967 pt_to_str(PT_POOL), rt_to_str(RT_DCPU)); |
2012 pt_to_str(PT_POOL), rt_to_str(RT_DCPU)); |
1968 goto bad; |
2013 goto bad; |
1969 } |
2014 } |
1970 |
2015 |
1971 bzero(&in_progress_psettab, sizeof (in_progress_psettab)); |
2016 bzero(&in_progress_psettab, sizeof (in_progress_psettab)); |
|
2017 return; |
|
2018 case RT_PCAP: |
|
2019 /* |
|
2020 * Make sure there isn't already a cpu-set or incompatible |
|
2021 * cpu-cap rctls. |
|
2022 */ |
|
2023 if (zonecfg_lookup_pset(handle, &tmp_psettab) == Z_OK) { |
|
2024 zerr(gettext("The %s resource already exists."), |
|
2025 rt_to_str(RT_DCPU)); |
|
2026 goto bad; |
|
2027 } |
|
2028 |
|
2029 switch (zonecfg_get_aliased_rctl(handle, ALIAS_CPUCAP, &tmp)) { |
|
2030 case Z_ALIAS_DISALLOW: |
|
2031 zone_perror(rt_to_str(RT_PCAP), Z_ALIAS_DISALLOW, |
|
2032 FALSE); |
|
2033 goto bad; |
|
2034 |
|
2035 case Z_OK: |
|
2036 zerr(gettext("The %s resource already exists."), |
|
2037 rt_to_str(RT_PCAP)); |
|
2038 goto bad; |
|
2039 |
|
2040 default: |
|
2041 break; |
|
2042 } |
1972 return; |
2043 return; |
1973 case RT_MCAP: |
2044 case RT_MCAP: |
1974 /* |
2045 /* |
1975 * Make sure there isn't already a mem-cap entry or max-swap |
2046 * Make sure there isn't already a mem-cap entry or max-swap |
1976 * or max-locked rctl. |
2047 * or max-locked rctl. |
2965 else |
3036 else |
2966 need_to_commit = TRUE; |
3037 need_to_commit = TRUE; |
2967 } |
3038 } |
2968 |
3039 |
2969 static void |
3040 static void |
|
3041 remove_pcap() |
|
3042 { |
|
3043 int err; |
|
3044 uint64_t tmp; |
|
3045 |
|
3046 if (zonecfg_get_aliased_rctl(handle, ALIAS_CPUCAP, &tmp) != Z_OK) { |
|
3047 zerr("%s %s: %s", cmd_to_str(CMD_REMOVE), rt_to_str(RT_PCAP), |
|
3048 zonecfg_strerror(Z_NO_RESOURCE_TYPE)); |
|
3049 saw_error = TRUE; |
|
3050 return; |
|
3051 } |
|
3052 |
|
3053 if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_CPUCAP)) != Z_OK) |
|
3054 z_cmd_rt_perror(CMD_REMOVE, RT_PCAP, err, TRUE); |
|
3055 else |
|
3056 need_to_commit = TRUE; |
|
3057 } |
|
3058 |
|
3059 static void |
2970 remove_mcap() |
3060 remove_mcap() |
2971 { |
3061 { |
2972 int err, res1, res2, res3; |
3062 int err, res1, res2, res3; |
2973 uint64_t tmp; |
3063 uint64_t tmp; |
2974 struct zone_mcaptab mcaptab; |
3064 struct zone_mcaptab mcaptab; |
3490 z_cmd_rt_perror(CMD_SELECT, RT_DCPU, err, TRUE); |
3584 z_cmd_rt_perror(CMD_SELECT, RT_DCPU, err, TRUE); |
3491 global_scope = TRUE; |
3585 global_scope = TRUE; |
3492 } |
3586 } |
3493 bcopy(&old_psettab, &in_progress_psettab, |
3587 bcopy(&old_psettab, &in_progress_psettab, |
3494 sizeof (struct zone_psettab)); |
3588 sizeof (struct zone_psettab)); |
|
3589 return; |
|
3590 case RT_PCAP: |
|
3591 if ((err = zonecfg_get_aliased_rctl(handle, ALIAS_CPUCAP, &tmp)) |
|
3592 != Z_OK) { |
|
3593 z_cmd_rt_perror(CMD_SELECT, RT_PCAP, err, TRUE); |
|
3594 global_scope = TRUE; |
|
3595 } |
3495 return; |
3596 return; |
3496 case RT_MCAP: |
3597 case RT_MCAP: |
3497 /* if none of these exist, there is no resource to select */ |
3598 /* if none of these exist, there is no resource to select */ |
3498 if ((res = zonecfg_lookup_mcap(handle, &old_mcaptab)) != Z_OK && |
3599 if ((res = zonecfg_lookup_mcap(handle, &old_mcaptab)) != Z_OK && |
3499 zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, &limit) |
3600 zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, &limit) |
3706 boolean_t autoboot; |
3807 boolean_t autoboot; |
3707 zone_iptype_t iptype; |
3808 zone_iptype_t iptype; |
3708 boolean_t force_set = FALSE; |
3809 boolean_t force_set = FALSE; |
3709 size_t physmem_size = sizeof (in_progress_mcaptab.zone_physmem_cap); |
3810 size_t physmem_size = sizeof (in_progress_mcaptab.zone_physmem_cap); |
3710 uint64_t mem_cap, mem_limit; |
3811 uint64_t mem_cap, mem_limit; |
|
3812 float cap; |
|
3813 char *unitp; |
3711 struct zone_psettab tmp_psettab; |
3814 struct zone_psettab tmp_psettab; |
3712 bool arg_err = FALSE; |
3815 bool arg_err = FALSE; |
3713 |
3816 |
3714 if (zone_is_read_only(CMD_SET)) |
3817 if (zone_is_read_only(CMD_SET)) |
3715 return; |
3818 return; |
4198 } |
4301 } |
4199 zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE, TRUE); |
4302 zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE, TRUE); |
4200 long_usage(CMD_SET, TRUE); |
4303 long_usage(CMD_SET, TRUE); |
4201 usage(FALSE, HELP_PROPS); |
4304 usage(FALSE, HELP_PROPS); |
4202 return; |
4305 return; |
|
4306 case RT_PCAP: |
|
4307 if (prop_type != PT_NCPUS) { |
|
4308 zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE, |
|
4309 TRUE); |
|
4310 long_usage(CMD_SET, TRUE); |
|
4311 usage(FALSE, HELP_PROPS); |
|
4312 return; |
|
4313 } |
|
4314 |
|
4315 /* |
|
4316 * We already checked that an rctl alias is allowed in |
|
4317 * the add_resource() function. |
|
4318 */ |
|
4319 |
|
4320 if ((cap = strtof(prop_id, &unitp)) <= 0 || *unitp != '\0' || |
|
4321 (int)(cap * 100) < 1) { |
|
4322 zerr(gettext("%s property is out of range."), |
|
4323 pt_to_str(PT_NCPUS)); |
|
4324 saw_error = TRUE; |
|
4325 return; |
|
4326 } |
|
4327 |
|
4328 if ((err = zonecfg_set_aliased_rctl(handle, ALIAS_CPUCAP, |
|
4329 (int)(cap * 100))) != Z_OK) |
|
4330 zone_perror(zone, err, TRUE); |
|
4331 else |
|
4332 need_to_commit = TRUE; |
|
4333 return; |
4203 case RT_MCAP: |
4334 case RT_MCAP: |
4204 switch (prop_type) { |
4335 switch (prop_type) { |
4205 case PT_PHYSICAL: |
4336 case PT_PHYSICAL: |
4206 if (!zonecfg_valid_memlimit(prop_id, &mem_cap)) { |
4337 if (!zonecfg_valid_memlimit(prop_id, &mem_cap)) { |
4207 zerr(gettext("A positive number with a " |
4338 zerr(gettext("A positive number with a " |
4788 if (zonecfg_getpsetent(handle, &lookup) == Z_OK) |
4919 if (zonecfg_getpsetent(handle, &lookup) == Z_OK) |
4789 output_pset(fp, &lookup); |
4920 output_pset(fp, &lookup); |
4790 } |
4921 } |
4791 |
4922 |
4792 static void |
4923 static void |
|
4924 output_pcap(FILE *fp) |
|
4925 { |
|
4926 uint64_t cap; |
|
4927 |
|
4928 if (zonecfg_get_aliased_rctl(handle, ALIAS_CPUCAP, &cap) == Z_OK) { |
|
4929 float scaled = (float)cap / 100; |
|
4930 (void) fprintf(fp, "%s:\n", rt_to_str(RT_PCAP)); |
|
4931 (void) fprintf(fp, "\t[%s: %.2f]\n", pt_to_str(PT_NCPUS), |
|
4932 scaled); |
|
4933 } |
|
4934 } |
|
4935 |
|
4936 static void |
|
4937 info_pcap(FILE *fp) |
|
4938 { |
|
4939 output_pcap(fp); |
|
4940 } |
|
4941 |
|
4942 |
|
4943 static void |
4793 info_aliased_rctl(zone_dochandle_t handle, FILE *fp, char *alias) |
4944 info_aliased_rctl(zone_dochandle_t handle, FILE *fp, char *alias) |
4794 { |
4945 { |
4795 uint64_t limit; |
4946 uint64_t limit; |
4796 |
4947 |
4797 if (zonecfg_get_aliased_rctl(handle, alias, &limit) == Z_OK) { |
4948 if (zonecfg_get_aliased_rctl(handle, alias, &limit) == Z_OK) { |
4929 case RT_DATASET: |
5080 case RT_DATASET: |
4930 output_ds(fp, &in_progress_dstab); |
5081 output_ds(fp, &in_progress_dstab); |
4931 break; |
5082 break; |
4932 case RT_DCPU: |
5083 case RT_DCPU: |
4933 output_pset(fp, &in_progress_psettab); |
5084 output_pset(fp, &in_progress_psettab); |
|
5085 break; |
|
5086 case RT_PCAP: |
|
5087 output_pcap(fp); |
4934 break; |
5088 break; |
4935 case RT_MCAP: |
5089 case RT_MCAP: |
4936 res1 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, |
5090 res1 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, |
4937 &swap_limit); |
5091 &swap_limit); |
4938 res2 = zonecfg_get_aliased_rctl(handle, |
5092 res2 = zonecfg_get_aliased_rctl(handle, |
4984 info_fs(handle, fp, cmd); |
5138 info_fs(handle, fp, cmd); |
4985 info_net(handle, fp, cmd); |
5139 info_net(handle, fp, cmd); |
4986 info_dev(handle, fp, cmd); |
5140 info_dev(handle, fp, cmd); |
4987 } |
5141 } |
4988 info_pset(handle, fp); |
5142 info_pset(handle, fp); |
|
5143 info_pcap(fp); |
4989 info_mcap(handle, fp); |
5144 info_mcap(handle, fp); |
4990 if (!global_zone) { |
5145 if (!global_zone) { |
4991 info_attr(handle, fp, cmd); |
5146 info_attr(handle, fp, cmd); |
4992 info_ds(handle, fp, cmd); |
5147 info_ds(handle, fp, cmd); |
4993 } |
5148 } |
5060 info_ds(handle, fp, cmd); |
5215 info_ds(handle, fp, cmd); |
5061 break; |
5216 break; |
5062 case RT_DCPU: |
5217 case RT_DCPU: |
5063 info_pset(handle, fp); |
5218 info_pset(handle, fp); |
5064 break; |
5219 break; |
|
5220 case RT_PCAP: |
|
5221 info_pcap(fp); |
|
5222 break; |
5065 case RT_MCAP: |
5223 case RT_MCAP: |
5066 info_mcap(handle, fp); |
5224 info_mcap(handle, fp); |
5067 break; |
5225 break; |
5068 default: |
5226 default: |
5069 zone_perror(rt_to_str(cmd->cmd_res_type), Z_NO_RESOURCE_TYPE, |
5227 zone_perror(rt_to_str(cmd->cmd_res_type), Z_NO_RESOURCE_TYPE, |
5201 struct zone_psettab psettab; |
5359 struct zone_psettab psettab; |
5202 char zonepath[MAXPATHLEN]; |
5360 char zonepath[MAXPATHLEN]; |
5203 char sched[MAXNAMELEN]; |
5361 char sched[MAXNAMELEN]; |
5204 char brand[MAXNAMELEN]; |
5362 char brand[MAXNAMELEN]; |
5205 int err, ret_val = Z_OK, arg; |
5363 int err, ret_val = Z_OK, arg; |
|
5364 int pset_res; |
5206 bool save = FALSE; |
5365 bool save = FALSE; |
5207 bool arg_err = FALSE; |
5366 bool arg_err = FALSE; |
5208 zone_iptype_t iptype; |
5367 zone_iptype_t iptype; |
5209 boolean_t has_cpu_shares = B_FALSE; |
5368 boolean_t has_cpu_shares = B_FALSE; |
|
5369 boolean_t has_cpu_cap = B_FALSE; |
5210 |
5370 |
5211 optind = 0; |
5371 optind = 0; |
5212 while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?")) != EOF) { |
5372 while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?")) != EOF) { |
5213 switch (arg) { |
5373 switch (arg) { |
5214 case '?': |
5374 case '?': |
5331 &ret_val); |
5491 &ret_val); |
5332 |
5492 |
5333 if (strcmp(rctltab.zone_rctl_name, "zone.cpu-shares") == 0) |
5493 if (strcmp(rctltab.zone_rctl_name, "zone.cpu-shares") == 0) |
5334 has_cpu_shares = B_TRUE; |
5494 has_cpu_shares = B_TRUE; |
5335 |
5495 |
|
5496 if (strcmp(rctltab.zone_rctl_name, "zone.cpu-cap") == 0) |
|
5497 has_cpu_cap = B_TRUE; |
|
5498 |
5336 if (rctltab.zone_rctl_valptr == NULL) { |
5499 if (rctltab.zone_rctl_valptr == NULL) { |
5337 zerr(gettext("%s: no %s specified"), |
5500 zerr(gettext("%s: no %s specified"), |
5338 rt_to_str(RT_RCTL), pt_to_str(PT_VALUE)); |
5501 rt_to_str(RT_RCTL), pt_to_str(PT_VALUE)); |
5339 saw_error = TRUE; |
5502 saw_error = TRUE; |
5340 if (ret_val == Z_OK) |
5503 if (ret_val == Z_OK) |
5343 zonecfg_free_rctl_value_list(rctltab.zone_rctl_valptr); |
5506 zonecfg_free_rctl_value_list(rctltab.zone_rctl_valptr); |
5344 } |
5507 } |
5345 } |
5508 } |
5346 (void) zonecfg_endrctlent(handle); |
5509 (void) zonecfg_endrctlent(handle); |
5347 |
5510 |
5348 if (zonecfg_lookup_pset(handle, &psettab) == Z_OK && has_cpu_shares) { |
5511 if ((pset_res = zonecfg_lookup_pset(handle, &psettab)) == Z_OK && |
|
5512 has_cpu_shares) { |
5349 zerr(gettext("%s zone.cpu-shares and %s are incompatible."), |
5513 zerr(gettext("%s zone.cpu-shares and %s are incompatible."), |
5350 rt_to_str(RT_RCTL), rt_to_str(RT_DCPU)); |
5514 rt_to_str(RT_RCTL), rt_to_str(RT_DCPU)); |
5351 saw_error = TRUE; |
5515 saw_error = TRUE; |
5352 if (ret_val == Z_OK) |
5516 if (ret_val == Z_OK) |
5353 ret_val = Z_INCOMPATIBLE; |
5517 ret_val = Z_INCOMPATIBLE; |
5357 sizeof (sched)) == Z_OK && strlen(sched) > 0 && |
5521 sizeof (sched)) == Z_OK && strlen(sched) > 0 && |
5358 strcmp(sched, "FSS") != 0) { |
5522 strcmp(sched, "FSS") != 0) { |
5359 zerr(gettext("WARNING: %s zone.cpu-shares and %s=%s are " |
5523 zerr(gettext("WARNING: %s zone.cpu-shares and %s=%s are " |
5360 "incompatible"), |
5524 "incompatible"), |
5361 rt_to_str(RT_RCTL), rt_to_str(RT_SCHED), sched); |
5525 rt_to_str(RT_RCTL), rt_to_str(RT_SCHED), sched); |
|
5526 saw_error = TRUE; |
|
5527 if (ret_val == Z_OK) |
|
5528 ret_val = Z_INCOMPATIBLE; |
|
5529 } |
|
5530 |
|
5531 if (pset_res == Z_OK && has_cpu_cap) { |
|
5532 zerr(gettext("%s zone.cpu-cap and the %s are incompatible."), |
|
5533 rt_to_str(RT_RCTL), rt_to_str(RT_DCPU)); |
5362 saw_error = TRUE; |
5534 saw_error = TRUE; |
5363 if (ret_val == Z_OK) |
5535 if (ret_val == Z_OK) |
5364 ret_val = Z_INCOMPATIBLE; |
5536 ret_val = Z_INCOMPATIBLE; |
5365 } |
5537 } |
5366 |
5538 |
5560 struct zone_attrtab tmp_attrtab; |
5732 struct zone_attrtab tmp_attrtab; |
5561 struct zone_dstab tmp_dstab; |
5733 struct zone_dstab tmp_dstab; |
5562 int err, arg, res1, res2, res3; |
5734 int err, arg, res1, res2, res3; |
5563 uint64_t swap_limit; |
5735 uint64_t swap_limit; |
5564 uint64_t locked_limit; |
5736 uint64_t locked_limit; |
|
5737 uint64_t proc_cap; |
5565 |
5738 |
5566 assert(cmd != NULL); |
5739 assert(cmd != NULL); |
5567 |
5740 |
5568 optind = 0; |
5741 optind = 0; |
5569 while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?")) != EOF) { |
5742 while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?")) != EOF) { |
5885 if (end_op == CMD_ADD) { |
6058 if (end_op == CMD_ADD) { |
5886 err = zonecfg_add_pset(handle, &in_progress_psettab); |
6059 err = zonecfg_add_pset(handle, &in_progress_psettab); |
5887 } else { |
6060 } else { |
5888 err = zonecfg_modify_pset(handle, &in_progress_psettab); |
6061 err = zonecfg_modify_pset(handle, &in_progress_psettab); |
5889 } |
6062 } |
|
6063 break; |
|
6064 case RT_PCAP: |
|
6065 /* Make sure everything was filled in. */ |
|
6066 if (zonecfg_get_aliased_rctl(handle, ALIAS_CPUCAP, &proc_cap) |
|
6067 != Z_OK) { |
|
6068 zerr(gettext("%s not specified"), pt_to_str(PT_NCPUS)); |
|
6069 saw_error = TRUE; |
|
6070 validation_failed = TRUE; |
|
6071 return; |
|
6072 } |
|
6073 err = Z_OK; |
5890 break; |
6074 break; |
5891 case RT_MCAP: |
6075 case RT_MCAP: |
5892 /* Make sure everything was filled in. */ |
6076 /* Make sure everything was filled in. */ |
5893 res1 = strlen(in_progress_mcaptab.zone_physmem_cap) == 0 ? |
6077 res1 = strlen(in_progress_mcaptab.zone_physmem_cap) == 0 ? |
5894 Z_ERR : Z_OK; |
6078 Z_ERR : Z_OK; |