// fillPlatformInfo fills the platform related info.
968951
func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo) {
	v.MemoryLimit = sysInfo.MemoryLimit
	v.SwapLimit = sysInfo.SwapLimit
	v.KernelMemory = sysInfo.KernelMemory
	v.KernelMemoryTCP = sysInfo.KernelMemoryTCP
	v.OomKillDisable = sysInfo.OomKillDisable
	v.CPUCfsPeriod = sysInfo.CPUCfsPeriod
	v.CPUCfsQuota = sysInfo.CPUCfsQuota
	v.CPUShares = sysInfo.CPUShares
	v.CPUSet = sysInfo.Cpuset
	v.PidsLimit = sysInfo.PidsLimit
	v.Runtimes = daemon.configStore.GetAllRuntimes()
	v.DefaultRuntime = daemon.configStore.GetDefaultRuntimeName()
	v.InitBinary = daemon.configStore.GetInitPath()

	defaultRuntimeBinary := daemon.configStore.GetRuntime(v.DefaultRuntime).Path
	if rv, err := exec.Command(defaultRuntimeBinary, "--version").Output(); err == nil {
		if _, commit, err := parseRuncVersion(string(rv)); err != nil {
			logrus.Warnf("failed to parse %s version: %v", defaultRuntimeBinary, err)
			v.RuncCommit.ID = "N/A"
		} else {
			v.RuncCommit.ID = commit
		}
	} else {
		logrus.Warnf("failed to retrieve %s version: %v", defaultRuntimeBinary, err)
		v.RuncCommit.ID = "N/A"
	}

	// runc is now shipped as a separate package. Set "expected" to same value
	// as "ID" to prevent clients from reporting a version-mismatch
	v.RuncCommit.Expected = v.RuncCommit.ID

	if rv, err := daemon.containerd.Version(context.Background()); err == nil {
		v.ContainerdCommit.ID = rv.Revision
	} else {
		logrus.Warnf("failed to retrieve containerd version: %v", err)
		v.ContainerdCommit.ID = "N/A"
	}

	// containerd is now shipped as a separate package. Set "expected" to same
	// value as "ID" to prevent clients from reporting a version-mismatch
	v.ContainerdCommit.Expected = v.ContainerdCommit.ID

	// TODO is there still a need to check the expected version for tini?
	// if not, we can change this, and just set "Expected" to v.InitCommit.ID
	v.InitCommit.Expected = dockerversion.InitCommitID

	defaultInitBinary := daemon.configStore.GetInitPath()
	if rv, err := exec.Command(defaultInitBinary, "--version").Output(); err == nil {
		if _, commit, err := parseInitVersion(string(rv)); err != nil {
			logrus.Warnf("failed to parse %s version: %s", defaultInitBinary, err)
			v.InitCommit.ID = "N/A"
		} else {
			v.InitCommit.ID = commit
			v.InitCommit.Expected = dockerversion.InitCommitID[0:len(commit)]
		}
	} else {
		logrus.Warnf("failed to retrieve %s version: %s", defaultInitBinary, err)
		v.InitCommit.ID = "N/A"
	}

	if !v.MemoryLimit {
		v.Warnings = append(v.Warnings, "WARNING: No memory limit support")
	}
	if !v.SwapLimit {
		v.Warnings = append(v.Warnings, "WARNING: No swap limit support")
	}
	if !v.KernelMemory {
		v.Warnings = append(v.Warnings, "WARNING: No kernel memory limit support")
	}
	if !v.KernelMemoryTCP {
		v.Warnings = append(v.Warnings, "WARNING: No kernel memory TCP limit support")
	}
	if !v.OomKillDisable {
		v.Warnings = append(v.Warnings, "WARNING: No oom kill disable support")
	}
	if !v.CPUCfsQuota {
		v.Warnings = append(v.Warnings, "WARNING: No cpu cfs quota support")
	}
	if !v.CPUCfsPeriod {
		v.Warnings = append(v.Warnings, "WARNING: No cpu cfs period support")
	}
	if !v.CPUShares {
		v.Warnings = append(v.Warnings, "WARNING: No cpu shares support")
	}
	if !v.CPUSet {
		v.Warnings = append(v.Warnings, "WARNING: No cpuset support")
	}
	if !v.IPv4Forwarding {
		v.Warnings = append(v.Warnings, "WARNING: IPv4 forwarding is disabled")
	}
	if !v.BridgeNfIptables {
		v.Warnings = append(v.Warnings, "WARNING: bridge-nf-call-iptables is disabled")
	}
	if !v.BridgeNfIP6tables {
		v.Warnings = append(v.Warnings, "WARNING: bridge-nf-call-ip6tables is disabled")
	}
}
723500
func (s *App) SetPlatform(v string) *App {
	s.Platform = &v
	return s
}
1349310
func printPlatforms(tsv bool, platforms ...*crimson.Platform) {
	if len(platforms) > 0 {
		p := newStdoutPrinter(tsv)
		defer p.Flush()
		if !tsv {
			p.Row("Name", "Description", "Manufacturer")
		}
		for _, plat := range platforms {
			p.Row(plat.Name, plat.Description, plat.Manufacturer)
		}
	}
}
52517
func (s *DescribeSigningJobOutput) SetPlatformId(v string) *DescribeSigningJobOutput {
	s.PlatformId = &v
	return s
}
671269
func (s *UpdateAppInput) SetPlatform(v string) *UpdateAppInput {
	s.Platform = &v
	return s
}
1247894
func (s *InstanceInformation) SetPlatformVersion(v string) *InstanceInformation {
	s.PlatformVersion = &v
	return s
}
201775
func (s *PlatformDescription) SetPlatformStatus(v string) *PlatformDescription {
	s.PlatformStatus = &v
	return s
}
949910
func (s *Bundle) SetSupportedPlatforms(v []*string) *Bundle {
	s.SupportedPlatforms = v
	return s
}
764439
func (s *PlatformDescription) SetPlatformVersion(v string) *PlatformDescription {
	s.PlatformVersion = &v
	return s
}
211691
func (s *UpdateServiceInput) SetPlatformVersion(v string) *UpdateServiceInput {
	s.PlatformVersion = &v
	return s
}
1049678
func (s *EnvironmentPlatform) SetPlatform(v string) *EnvironmentPlatform {
	s.Platform = &v
	return s
}
1036112
func (s *InstanceDetails) SetPlatform(v string) *InstanceDetails {
	s.Platform = &v
	return s
}
1345827
func (s *CreatePlatformApplicationInput) SetPlatform(v string) *CreatePlatformApplicationInput {
	s.Platform = &v
	return s
}
493936
func (s *CreateServiceInput) SetPlatformVersion(v string) *CreateServiceInput {
	s.PlatformVersion = &v
	return s
}
1332370
func (s *EC2InstanceDetails) SetPlatform(v string) *EC2InstanceDetails {
	s.Platform = &v
	return s
}
1074182
func EnsurePlatforms(c context.Context, cfgs []*config.Platform) (map[string]int64, error) {
	t := &PlatformsTable{}
	if err := t.fetch(c); err != nil {
		return nil, errors.Annotate(err, "failed to fetch platforms").Err()
	}
	t.computeChanges(c, cfgs)
	if err := t.add(c); err != nil {
		return nil, errors.Annotate(err, "failed to add platforms").Err()
	}
	if err := t.remove(c); err != nil {
		return nil, errors.Annotate(err, "failed to remove platforms").Err()
	}
	if err := t.update(c); err != nil {
		return nil, errors.Annotate(err, "failed to update platforms").Err()
	}
	return t.ids(c), nil
}
848870
func WithPlatform(platform string) RemoteOpt {
	if platform == "" {
		platform = platforms.DefaultString()
	}
	return func(_ *Client, c *RemoteContext) error {
		for _, p := range c.Platforms {
			if p == platform {
				return nil
			}
		}

		c.Platforms = append(c.Platforms, platform)
		return nil
	}
}