pcsc-lite 1.9.9
dyn_hpux.c
1/*
2 * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
3 *
4 * Copyright (C) 2001
5 * David Corcoran <corcoran@musclecard.com>
6 * Copyright (C) 2002-2010
7 * Ludovic Rousseau <ludovic.rousseau@free.fr>
8 *
9Redistribution and use in source and binary forms, with or without
10modification, are permitted provided that the following conditions
11are met:
12
131. Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
152. Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in the
17 documentation and/or other materials provided with the distribution.
183. The name of the author may not be used to endorse or promote products
19 derived from this software without specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/*
34 * @file
35 * @brief This abstracts dynamic library loading functions and timing.
36 */
37
38#include "config.h"
39#include <string.h>
40#ifdef HAVE_DL_H
41#include <dl.h>
42#include <errno.h>
43
44#include "pcsclite.h"
45#include "debuglog.h"
46#include "dyn_generic.h"
47
48LONG DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
49{
50
51 shl_t myHandle;
52
53 *pvLHandle = 0;
54 myHandle =
55 shl_load(pcLibrary, BIND_IMMEDIATE | BIND_VERBOSE | BIND_NOSTART,
56 0L);
57
58 if (myHandle == 0)
59 {
60 Log3(PCSC_LOG_ERROR, "%s: %s", pcLibrary, strerror(errno));
62 }
63
64 *pvLHandle = (void *) myHandle;
65 return SCARD_S_SUCCESS;
66}
67
68LONG DYN_CloseLibrary(void **pvLHandle)
69{
70
71 int rv;
72
73 rv = shl_unload((shl_t) * pvLHandle);
74 *pvLHandle = 0;
75
76 if (rv == -1)
77 {
78 Log2(PCSC_LOG_ERROR, "%s", strerror(errno));
80 }
81
82 return SCARD_S_SUCCESS;
83}
84
85LONG DYN_GetAddress(void *pvLHandle, void **pvFHandle, const char *pcFunction,
86 bool mayfail)
87{
88 int rv;
89
90 *pvFHandle = 0;
91 rv = shl_findsym((shl_t *) & pvLHandle, pcFunction, TYPE_PROCEDURE,
92 pvFHandle);
93
94 if (rv == -1)
95 {
96 Log3(mayfail ? PCSC_LOG_INFO : PCSC_LOG_ERROR, "%s: %s",
97 pcFunction, strerror(errno));
99 }
100 else
101 rv = SCARD_S_SUCCESS;
102
103 return rv;
104}
105
106#endif /* HAVE_DL_H */
107
This handles debugging.
This abstracts dynamic library loading functions.
#define SCARD_F_UNKNOWN_ERROR
An internal error has been detected, but the source is unknown.
Definition pcsclite.h:147
#define SCARD_S_SUCCESS
No error was encountered.
Definition pcsclite.h:107
This keeps a list of defines for pcsc-lite.