+#if CONFIG_THREAD_GROUPS
+static int
+coalition_info_set_name_internal(coalition_t coal, user_addr_t buffer, user_size_t bufsize)
+{
+ int error;
+ char name[THREAD_GROUP_MAXNAME];
+
+ if (coalition_type(coal) != COALITION_TYPE_JETSAM) {
+ return EINVAL;
+ }
+ bzero(name, sizeof(name));
+ error = copyin(buffer, name, MIN(bufsize, sizeof(name) - 1));
+ if (error) {
+ return error;
+ }
+ struct thread_group *tg = coalition_get_thread_group(coal);
+ thread_group_set_name(tg, name);
+ thread_group_release(tg);
+ return error;
+}
+
+#else /* CONFIG_THREAD_GROUPS */
+#define coalition_info_set_name_internal(...) 0
+#endif /* CONFIG_THREAD_GROUPS */
+
+static int
+coalition_info_efficiency(coalition_t coal, user_addr_t buffer, user_size_t bufsize)
+{
+ int error = 0;
+ if (coalition_type(coal) != COALITION_TYPE_JETSAM) {
+ return EINVAL;
+ }
+ uint64_t flags = 0;
+ error = copyin(buffer, &flags, MIN(bufsize, sizeof(flags)));
+ if (error) {
+ return error;
+ }
+ if ((flags & COALITION_EFFICIENCY_VALID_FLAGS) == 0) {
+ return EINVAL;
+ }
+ if (flags & COALITION_FLAGS_EFFICIENT) {
+ coalition_set_efficient(coal);
+#if CONFIG_THREAD_GROUPS
+ struct thread_group *tg = coalition_get_thread_group(coal);
+ thread_group_set_flags(tg, THREAD_GROUP_FLAGS_EFFICIENT);
+ thread_group_release(tg);
+#endif /* CONFIG_THREAD_GROUPS */
+ }
+ return error;
+}
+
+static int
+coalition_ledger_logical_writes_limit(coalition_t coal, user_addr_t buffer, user_size_t bufsize)
+{
+ int error = 0;
+ int64_t limit = 0;
+
+ if (coalition_type(coal) != COALITION_TYPE_RESOURCE) {
+ error = EINVAL;
+ goto out;
+ }
+ error = copyin(buffer, &limit, MIN(bufsize, sizeof(limit)));
+ if (error) {
+ goto out;
+ }
+
+
+ error = coalition_ledger_set_logical_writes_limit(coal, limit);
+out:
+ return error;
+}
+
+int
+coalition_info(proc_t p, struct coalition_info_args *uap, __unused int32_t *retval)