~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/backend/port/dynloader/ultrix4.c

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * ultrix4.c
 
4
 *        This dynamic loader uses Andrew Yu's libdl-1.0 package for Ultrix 4.x.
 
5
 *
 
6
 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
 
7
 * Portions Copyright (c) 1994, Regents of the University of California
 
8
 *
 
9
 *
 
10
 * IDENTIFICATION
 
11
 *        $PostgreSQL: pgsql/src/backend/port/dynloader/ultrix4.c,v 1.22 2004-12-31 22:00:32 pgsql Exp $
 
12
 *
 
13
 *-------------------------------------------------------------------------
 
14
 */
 
15
#include "postgres.h"
 
16
 
 
17
#include "dl.h"
 
18
#include "utils/dynamic_loader.h"
 
19
 
 
20
extern char my_exec_path[];
 
21
 
 
22
void *
 
23
pg_dlopen(char *filename)
 
24
{
 
25
        static int      dl_initialized = 0;
 
26
        void       *handle;
 
27
 
 
28
        /*
 
29
         * initializes the dynamic loader with the executable's pathname.
 
30
         * (only needs to do this the first time pg_dlopen is called.)
 
31
         */
 
32
        if (!dl_initialized)
 
33
        {
 
34
                if (!dl_init(my_exec_path))
 
35
                        return NULL;
 
36
 
 
37
                /*
 
38
                 * if there are undefined symbols, we want dl to search from the
 
39
                 * following libraries also.
 
40
                 */
 
41
                dl_setLibraries("/usr/lib/libm_G0.a:/usr/lib/libc_G0.a");
 
42
                dl_initialized = 1;
 
43
        }
 
44
 
 
45
        /*
 
46
         * open the file. We do the symbol resolution right away so that we
 
47
         * will know if there are undefined symbols. (This is in fact the same
 
48
         * semantics as "ld -A". ie. you cannot have undefined symbols.
 
49
         */
 
50
        if ((handle = dl_open(filename, DL_NOW)) == NULL)
 
51
        {
 
52
                int                     count;
 
53
                char      **list = dl_undefinedSymbols(&count);
 
54
 
 
55
                /* list the undefined symbols, if any */
 
56
                if (count)
 
57
                {
 
58
                        while (*list)
 
59
                        {
 
60
                                elog(WARNING, "\"%s\" is undefined", *list);
 
61
                                list++;
 
62
                        }
 
63
                }
 
64
        }
 
65
 
 
66
        return (void *) handle;
 
67
}