// IsExitStatusErrorStr ...
348400
func IsExitStatusErrorStr(errString string) bool {
	// example exit status error string: exit status 1
	var rex = regexp.MustCompile(`^exit status [0-9]{1,3}$`)
	return rex.MatchString(errString)
}
148123
func ErrUnprocessableUser(err error) *influxdb.Error {
	return &influxdb.Error{
		Code: influxdb.EUnprocessableEntity,
		Msg:  "user could not be marshalled",
		Err:  err,
		Op:   "kv/MarshalUser",
	}
}
1131013
func GetExitStatus(err error) (int, error) {
	if err == nil {
		return 0, nil
	}
	if exiterr, ok := err.(*exec.ExitError); ok {
		// the program has exited with an exit code != 0
		if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
			return status.ExitStatus(), nil
		}
	}
	return -1, err
}
903897
func IsError(err error, code int) bool {
	if e, ok := err.(*errorBox); ok {
		return e.code == code
	}
	return false
}
1225200
func IsUserAbortedError(err error) bool {
	_, ok := errors.Cause(err).(userAbortedError)
	return ok
}
1121889
func IsErrNoData(err error) bool {
	if err_, ok := err.(cmn.Error); ok {
		_, ok := err_.Data().(errNoData)
		return ok
	}
	return false
}
1253931
func UserErrorf(format string, a ...interface{}) Error {
	return WrapSkipping(errors.New(""), 1).WithUserMessagef(format, a...)
}
747772
func IsNoRoutesError(err error) bool {
	if err == nil {
		return false
	}
	switch err.(type) {
	case noRoutesError:
		return true
	default:
		return false
	}
}
788764
func IsDatasetHasChildrenError(e error) bool {
	lines := strings.SplitN(e.Error(), "\n", 2)
	return strings.HasSuffix(lines[0], "has children")
}
1264534
func IsErrorThrottle(err error) bool {
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			return isCodeThrottle(aerr.Code())
		}
	}
	return false
}
709410
func ExitStatus(err error) int {
	if err == nil {
		return 0
	}
	if e, ok := err.(exitStatus); ok {
		return e.ExitStatus()
	}
	if e, ok := err.(*exec.ExitError); ok {
		if ex, ok := e.Sys().(exitStatus); ok {
			return ex.ExitStatus()
		}
	}
	return 1
}
269756
func validateUser(r *http.Request, event *common.EventInfo) error {

	// Find the calling user.
	parts := strings.Split(r.RemoteAddr, ":")
	if len(parts) != 3 {
		return fmt.Errorf("Invalid user context")
	}

	// Accept all requests from root users
	if parts[0] == "0" {
		return nil
	}

	// The target process must be valid.
	p, err := process.NewProcess(event.PID)
	if err != nil {
		return fmt.Errorf("Process not found")
	}

	// The UID of the calling process must match the UID of the target process.
	uids, err := p.Uids()
	if err != nil {
		return fmt.Errorf("Unknown user ID")
	}

	match := false
	for _, uid := range uids {
		if strconv.Itoa(int(uid)) == parts[0] {
			match = true
		}
	}

	if !match {
		return fmt.Errorf("Invalid user - no access to this process: %+v PARTS: %+v", event, parts)
	}

	return nil
}
801231
func UserAlreadyExistsError(n string) *influxdb.Error {
	return &influxdb.Error{
		Code: influxdb.EConflict,
		Msg:  fmt.Sprintf("user with name %s already exists", n),
	}
}
903446
func IsExifError(err error) bool {
	if te, ok := err.(tiffErrors); ok {
		_, isExif := te[loadExif]
		return isExif
	}
	return false
}
93867
func ResolveExitStatus(err error) *ExitStatus {
	es := &ExitStatus{
		invoked:  true,
		err:      err,
		exitCode: -1,
	}
	if es.err == nil {
		es.exitCode = 0
		return es
	}

	eerr, ok := es.err.(*exec.ExitError)
	es.invoked = ok
	if !es.invoked {
		switch {
		case os.IsPermission(err), IsExecFormatError(err):
			es.exitCode = ExitCommandNotInvoked
		case os.IsNotExist(err), IsNotFoundInPATH(err):
			es.exitCode = ExitCommandNotFound
		default:
			es.exitCode = ExitUnknownErr
		}
		return es
	}

	w, ok := eerr.Sys().(syscall.WaitStatus)
	if !ok {
		return es
	}
	es.signaled = w.Signaled()
	es.signal = w.Signal()
	es.exitCode = waitStatusToExitCode(w)

	return es
}
797141
func IsNeverLoggedInError(err error) bool {
	_, ok := errors.Cause(err).(NeverLoggedInError)
	return ok
}
910589
func (l *State) IsUserData(index int) bool {
	_, ok := l.indexToValue(index).(*userData)
	return ok
}