Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754054Ab2ECOrN (ORCPT ); Thu, 3 May 2012 10:47:13 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:61400 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754842Ab2ECOrM (ORCPT ); Thu, 3 May 2012 10:47:12 -0400 Subject: Re: [PATCH 09/13] perf target: Introduce perf_target_errno From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Namhyung Kim , Peter Zijlstra , Paul Mackerras , Ingo Molnar , LKML , David Ahern In-Reply-To: <20120502185913.GE5745@infradead.org> References: <1335417327-11796-1-git-send-email-namhyung.kim@lge.com> <1335417327-11796-10-git-send-email-namhyung.kim@lge.com> <20120502185913.GE5745@infradead.org> Content-Type: text/plain; charset="UTF-8" Date: Thu, 03 May 2012 23:47:05 +0900 Message-ID: <1336056425.1493.24.camel@leonhard> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3019 Lines: 104 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 > > Signed-off-by: Namhyung Kim > > + /* 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 > > > 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. > > > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/