lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 03 May 2012 23:47:05 +0900
From:	Namhyung Kim <namhyung@...il.com>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc:	Namhyung Kim <namhyung.kim@....com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>
Subject: Re: [PATCH 09/13] perf target: Introduce perf_target_errno

Hi,

2012-05-02 (수), 15:59 -0300, Arnaldo Carvalho de Melo:
> Em Thu, Apr 26, 2012 at 02:15:23PM +0900, Namhyung Kim escreveu:
> > The perf_target_errno enumerations are used to indicate
> > specific error cases on perf target operations. It'd
> > help libperf being a more generic library.
> > 
> > Suggested-by: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
> > Signed-off-by: Namhyung Kim <namhyung.kim@....com>
> > +	/* UID and SYSTEM are mutually exclusive */
> > +	if (target->uid_str && target->system_wide) {
> > +		target->system_wide = false;
> > +		if (ret == PERF_TARGET__SUCCESS)
> > +			ret = PERF_TARGET__UID_OVERRIDE_SYSTEM;
> > +	}
> > +
> > +	return ret;
> >  }
> > diff --git a/tools/perf/util/target.h b/tools/perf/util/target.h
> > index 1348065ada5e..c3914c8a9890 100644
> > --- a/tools/perf/util/target.h
> > +++ b/tools/perf/util/target.h
> > @@ -12,6 +12,24 @@ struct perf_target {
> >  	bool	     system_wide;
> >  };
> >  
> > -void perf_target__validate(struct perf_target *target);
> > +enum perf_target_errno {
> > +	/*
> > +	 * XXX: Just choose an arbitrary big number standard errno can't have
> 
> Here I think its better for us to use _negative_ big numbers, because
> according to:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
> 
> <quote>
> Issue 6
> 
> The following new requirements on POSIX implementations derive from
> alignment with the Single UNIX Specification:
> 
> The majority of the error conditions previously marked as extensions are
> now mandatory, except for the STREAMS-related error conditions.
> 
> Values for errno are now required to be distinct positive values rather
> than non-zero values. This change is for alignment with the ISO/IEC
> 9899:1999 standard.
> </quote>
> 
> So system errno range is all positive, since our error enumeration is a
> superset of the system one, using negative values won't ever clash.
> 
> Also it would be better to have it as PERF_ERRNO__PID_OVERRIDE_CPU, etc.
> 
> Agreed?
> 

Agreed and thanks for the info. Will change the name of error constants
too.

Thanks,
Namhyung


> Anybody else with reasons not to use this ernno range scheme?
> 
> Ingo?
> 
> - Arnaldo
> 
> > +	 */
> > +	__PERF_TARGET__ERRNO_START		= 0x10000,
> > +
> > +	PERF_TARGET__SUCCESS			= __PERF_TARGET__ERRNO_START,
> > +
> > +	/* for perf_target__validate() */
> > +	PERF_TARGET__PID_OVERRIDE_CPU,
> > +	PERF_TARGET__PID_OVERRIDE_UID,
> > +	PERF_TARGET__UID_OVERRIDE_CPU,
> > +	PERF_TARGET__PID_OVERRIDE_SYSTEM,
> > +	PERF_TARGET__UID_OVERRIDE_SYSTEM,
> > +
> > +	__PERF_TARGET__ERRNO_END
> > +};
> > +
> > +enum perf_target_errno perf_target__validate(struct perf_target *target);
> >  
> >  #endif /* _PERF_TARGET_H */
> > -- 
> > 1.7.10


-- 
Regards,
Namhyung Kim


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ