diff options
Diffstat (limited to 'usr/src/lib/libcpc/common/libcpc.c')
-rw-r--r-- | usr/src/lib/libcpc/common/libcpc.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/usr/src/lib/libcpc/common/libcpc.c b/usr/src/lib/libcpc/common/libcpc.c index 8b0f3b48fd..bb18b2f090 100644 --- a/usr/src/lib/libcpc/common/libcpc.c +++ b/usr/src/lib/libcpc/common/libcpc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1077,7 +1076,22 @@ cpc_valid_event(cpc_t *cpc, uint_t pic, const char *ev) pr.name = ev; cpc_walk_events_pic(cpc, pic, &pr, ev_walker); - return (pr.found); + if (pr.found) + return (1); + + /* + * Before assuming this is an invalid event, see if we have been given + * a raw event code. An event code of '0' is not recognized, as it + * already has a corresponding event name in existing backends and it + * is the only reasonable way to know if strtol() succeeded. + */ + if (strtol(ev, NULL, 0) != 0) + /* + * Success - this is a valid raw code in hex, decimal, or octal. + */ + return (1); + + return (0); } static int |