// NewLimits returns the current soft limits of the process.
432809
func (p Proc) NewLimits() (ProcLimits, error) {
	f, err := os.Open(p.path("limits"))
	if err != nil {
		return ProcLimits{}, err
	}
	defer f.Close()

	var (
		l = ProcLimits{}
		s = bufio.NewScanner(f)
	)
	for s.Scan() {
		fields := limitsDelimiter.Split(s.Text(), limitsFields)
		if len(fields) != limitsFields {
			return ProcLimits{}, fmt.Errorf(
				"couldn't parse %s line %s", f.Name(), s.Text())
		}

		switch fields[0] {
		case "Max cpu time":
			l.CPUTime, err = parseInt(fields[1])
		case "Max file size":
			l.FileSize, err = parseInt(fields[1])
		case "Max data size":
			l.DataSize, err = parseInt(fields[1])
		case "Max stack size":
			l.StackSize, err = parseInt(fields[1])
		case "Max core file size":
			l.CoreFileSize, err = parseInt(fields[1])
		case "Max resident set":
			l.ResidentSet, err = parseInt(fields[1])
		case "Max processes":
			l.Processes, err = parseInt(fields[1])
		case "Max open files":
			l.OpenFiles, err = parseInt(fields[1])
		case "Max locked memory":
			l.LockedMemory, err = parseInt(fields[1])
		case "Max address space":
			l.AddressSpace, err = parseInt(fields[1])
		case "Max file locks":
			l.FileLocks, err = parseInt(fields[1])
		case "Max pending signals":
			l.PendingSignals, err = parseInt(fields[1])
		case "Max msgqueue size":
			l.MsqqueueSize, err = parseInt(fields[1])
		case "Max nice priority":
			l.NicePriority, err = parseInt(fields[1])
		case "Max realtime priority":
			l.RealtimePriority, err = parseInt(fields[1])
		case "Max realtime timeout":
			l.RealtimeTimeout, err = parseInt(fields[1])
		}
		if err != nil {
			return ProcLimits{}, err
		}
	}

	return l, s.Err()
}
1373887
func (s *GetGatewayResponsesInput) SetLimit(v int64) *GetGatewayResponsesInput {
	s.Limit = &v
	return s
}
36353
func checkLimits(current, newCount, max int) error {
	if newCount > max {
		return fmt.Errorf("Adding specified prefixes would result in too many prefix lengths (current: %d, result: %d, max: %d)",
			current, newCount, max)
	}
	return nil
}
195816
func (s *ListScriptsInput) SetLimit(v int64) *ListScriptsInput {
	s.Limit = &v
	return s
}
970989
func (s *ListIPSetsInput) SetLimit(v int64) *ListIPSetsInput {
	s.Limit = &v
	return s
}
1104912
func (s *GetModelsInput) SetLimit(v int64) *GetModelsInput {
	s.Limit = &v
	return s
}
706060
func (g *Generator) AddProcessRlimits(rType string, rHard uint64, rSoft uint64) {
	g.initConfigProcess()
	for i, rlimit := range g.Config.Process.Rlimits {
		if rlimit.Type == rType {
			g.Config.Process.Rlimits[i].Hard = rHard
			g.Config.Process.Rlimits[i].Soft = rSoft
			return
		}
	}

	newRlimit := rspec.POSIXRlimit{
		Type: rType,
		Hard: rHard,
		Soft: rSoft,
	}
	g.Config.Process.Rlimits = append(g.Config.Process.Rlimits, newRlimit)
}
438615
func (s *CampaignResponse) SetLimits(v *CampaignLimits) *CampaignResponse {
	s.Limits = v
	return s
}
975843
func (s *ListGatewaysInput) SetLimit(v int64) *ListGatewaysInput {
	s.Limit = &v
	return s
}
80587
func (s *DescribeSharedDirectoriesInput) SetLimit(v int64) *DescribeSharedDirectoriesInput {
	s.Limit = &v
	return s
}
363612
func (s *ListGeoMatchSetsInput) SetLimit(v int64) *ListGeoMatchSetsInput {
	s.Limit = &v
	return s
}
949524
func (s *AdminListGroupsForUserInput) SetLimit(v int64) *AdminListGroupsForUserInput {
	s.Limit = &v
	return s
}
343105
func (s *DescribeFolderContentsInput) SetLimit(v int64) *DescribeFolderContentsInput {
	s.Limit = &v
	return s
}
581271
func (s *DescribeActivitiesInput) SetLimit(v int64) *DescribeActivitiesInput {
	s.Limit = &v
	return s
}
1241160
func (s *ListJobsInput) SetLimit(v string) *ListJobsInput {
	s.Limit = &v
	return s
}
1115760
func newLimitRanges(c *CoreClient, namespace string) *limitRanges {
	return &limitRanges{
		client: c,
		ns:     namespace,
	}
}
819469
func (w *Writer) SetLimit(new int64) (old int64) {
	old, w.limit = w.limit, new
	return
}