diff options
| author | rab <none@none> | 2006-09-22 14:03:54 -0700 |
|---|---|---|
| committer | rab <none@none> | 2006-09-22 14:03:54 -0700 |
| commit | 5d3a5ad8d2a9319e80861563ceff0e6d8d530a32 (patch) | |
| tree | 5cef53e1478902ee1e73fb844fd1e699877c8d73 /usr/src/lib/libcpc | |
| parent | 014a7923f9b48f6ab3ba1a38049a3dacddc587cb (diff) | |
| download | illumos-joyent-5d3a5ad8d2a9319e80861563ceff0e6d8d530a32.tar.gz | |
5033325 x86 CPC backends should accept raw event codes
Diffstat (limited to 'usr/src/lib/libcpc')
| -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 |
