fmev_util.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 2N/A * Subscription event access interfaces. 2N/A * Thread and handle specific data. 2N/A * Called only from fmev_shdl_init. Check we are opening a valid version 2N/A * On entry to other libfmevent API members we call fmev_api_enter. 2N/A * Some thread-specific data is used to keep a per-thread error value. 2N/A * The version opened must be no greater than the latest version but can 2N/A * be older. The ver_intro is the api version at which the interface 2N/A * was added - the caller must have opened at least this version. 2N/A /* Initialize key on first visit */ 2N/A * Allocate TSD for error value for this thread. It is only 2N/A return (0);
/* no error set, but what can we do */ 2N/A return (
1);
/* special case from fmev_api_init only */ 2N/A /* Enforce version adherence. */ 2N/A * Called on any fmev_shdl_fini. Free the TSD for this thread. If this 2N/A * thread makes other API calls for other open handles, or opens a new 2N/A * handle, then TSD will be allocated again in fmev_api_enter. 2N/A * To return an error condition an API member first sets the error type 2N/A * with a call to fmev_seterr and then returns NULL or whatever it wants. 2N/A * The caller can then retrieve the per-thread error type using fmev_errno 2N/A * or format it with fmev_strerr. 2N/A * fmev_errno is a macro defined in terms of the following function. It 2N/A * can be used to dereference the last error value on the current thread; 2N/A * it must not be used to assign to fmev_errno.