~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/dlcompat/dladdr.3

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.\"
 
2
.\" Copyright (c) 1998 John D. Polstra
 
3
.\" All rights reserved.
 
4
.\"
 
5
.\" Redistribution and use in source and binary forms, with or without
 
6
.\" modification, are permitted provided that the following conditions
 
7
.\" are met:
 
8
.\" 1. Redistributions of source code must retain the above copyright
 
9
.\"    notice, this list of conditions and the following disclaimer.
 
10
.\" 2. Redistributions in binary form must reproduce the above copyright
 
11
.\"    notice, this list of conditions and the following disclaimer in the
 
12
.\"    documentation and/or other materials provided with the distribution.
 
13
.\"
 
14
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 
15
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
16
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
17
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 
18
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
19
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 
20
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
21
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
22
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 
23
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
24
.\" SUCH DAMAGE.
 
25
.\"
 
26
.\" $FreeBSD: /repoman/r/ncvs/src/lib/libc/gen/dladdr.3,v 1.3.2.4 2003/03/15 15:11:05 trhodes Exp $
 
27
.\"
 
28
.Dd June 8, 2003
 
29
.Os
 
30
.Dt DLADDR 3
 
31
.Sh NAME
 
32
.Nm dladdr
 
33
.Nd find the shared object containing a given address
 
34
.Sh SYNOPSIS
 
35
.In dlfcn.h
 
36
.Ft int
 
37
.Fn dladdr "const void *addr" "Dl_info *info"
 
38
.Sh DESCRIPTION
 
39
The
 
40
.Fn dladdr
 
41
function
 
42
queries the dynamic linker for information about the shared object
 
43
containing the address
 
44
.Fa addr .
 
45
The information is returned in the structure specified by
 
46
.Fa info .
 
47
The structure contains at least the following members:
 
48
.Bl -tag -width "XXXconst char *dli_fname"
 
49
.It Li "const char *dli_fname"
 
50
The pathname of the shared object containing the address.
 
51
.It Li "void *dli_fbase"
 
52
The base address at which the shared object is mapped into the
 
53
address space of the calling process.
 
54
.It Li "const char *dli_sname"
 
55
The name of the nearest run-time symbol with a value less than or
 
56
equal to
 
57
.Fa addr .
 
58
.Pp
 
59
If no symbol with a suitable value is found, both this field and
 
60
.Va dli_saddr
 
61
are set to
 
62
.Dv NULL .
 
63
.It Li "void *dli_saddr"
 
64
The value of the symbol returned in
 
65
.Li dli_sname .
 
66
.El
 
67
.Pp
 
68
The
 
69
.Fn dladdr
 
70
function
 
71
is available only in dynamically linked programs.
 
72
.Sh ERRORS
 
73
If a mapped shared object containing
 
74
.Fa addr
 
75
cannot be found,
 
76
.Fn dladdr
 
77
returns 0.
 
78
.Pp
 
79
On success, a non-zero value is returned.
 
80
.Sh SEE ALSO
 
81
.Xr dyld 3 ,
 
82
.Xr dlopen 3
 
83
.Sh HISTORY
 
84
The
 
85
.Fn dladdr
 
86
function first appeared in the Solaris operating system.
 
87
.Sh AUTHORS
 
88
The dlcompat package was written by Jorge Acereda 
 
89
<jacereda@users.sourceforge.net> and
 
90
Peter O'Gorman <ogorman@users.sourceforge.net>
 
91
.Pp
 
92
Some of the code for this particular function was borrowed from
 
93
a post to the darwin development list by Douglas Davidson.
 
94
.Pp
 
95
This man page was borrowed from FreeBSD and modified.
 
96
.Sh BUGS
 
97
This implementation is almost bug-compatible with the Solaris
 
98
implementation.  The following bugs are present:
 
99
.Bl -bullet
 
100
.It
 
101
If
 
102
.Fa addr
 
103
lies in the main executable rather than in a shared library, the
 
104
pathname returned in
 
105
.Va dli_fname
 
106
may not be correct.  The pathname is taken directly from
 
107
.Va argv[0]
 
108
of the calling process.  When executing a program specified by its
 
109
full pathname, most shells set
 
110
.Va argv[0]
 
111
to the pathname.  But this is not required of shells or guaranteed
 
112
by the operating system.
 
113
.It
 
114
.Fn dlerror
 
115
can not be used to get the error string if 
 
116
.Fn dladdr
 
117
fails.
 
118
.It
 
119
The symbol returned has an underscore if it is a C symbol, and can
 
120
not be used as input to 
 
121
.Fn dlsym
 
122
as
 
123
.Fn dlsym 
 
124
in a default dlcompat installation takes symbol names as they appear
 
125
in C source code (no underscore).
 
126
.It
 
127
Returning 0 as an indication of failure goes against long-standing
 
128
Unix tradition.
 
129
.El