Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
b5d29299
Commit
b5d29299
authored
Jul 10, 2018
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove obsolete darwin dynloader code
not needed since macOS 10.3 (2003)
parent
3ebdd21b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
103 deletions
+0
-103
src/backend/port/dynloader/darwin.c
src/backend/port/dynloader/darwin.c
+0
-103
No files found.
src/backend/port/dynloader/darwin.c
View file @
b5d29299
/*
/*
* Dynamic loading support for macOS (Darwin)
* Dynamic loading support for macOS (Darwin)
*
*
* If dlopen() is available (Darwin 10.3 and later), we just use it.
* Otherwise we emulate it with the older, now deprecated, NSLinkModule API.
*
* src/backend/port/dynloader/darwin.c
* src/backend/port/dynloader/darwin.c
*/
*/
#include "postgres.h"
#include "postgres.h"
#ifdef HAVE_DLOPEN
#include <dlfcn.h>
#include <dlfcn.h>
#else
#include <mach-o/dyld.h>
#endif
#include "dynloader.h"
#include "dynloader.h"
#ifdef HAVE_DLOPEN
void
*
void
*
pg_dlopen
(
const
char
*
filename
)
pg_dlopen
(
const
char
*
filename
)
{
{
...
@@ -34,7 +25,6 @@ pg_dlclose(void *handle)
...
@@ -34,7 +25,6 @@ pg_dlclose(void *handle)
PGFunction
PGFunction
pg_dlsym
(
void
*
handle
,
const
char
*
funcname
)
pg_dlsym
(
void
*
handle
,
const
char
*
funcname
)
{
{
/* Do not prepend an underscore: see dlopen(3) */
return
dlsym
(
handle
,
funcname
);
return
dlsym
(
handle
,
funcname
);
}
}
...
@@ -43,96 +33,3 @@ pg_dlerror(void)
...
@@ -43,96 +33,3 @@ pg_dlerror(void)
{
{
return
dlerror
();
return
dlerror
();
}
}
#else
/* !HAVE_DLOPEN */
/*
* These routines were taken from the Apache source, but were made
* available with a PostgreSQL-compatible license. Kudos Wilfredo
* Sánchez <wsanchez@apple.com>.
*/
static
NSObjectFileImageReturnCode
cofiff_result
=
NSObjectFileImageFailure
;
void
*
pg_dlopen
(
const
char
*
filename
)
{
NSObjectFileImage
image
;
cofiff_result
=
NSCreateObjectFileImageFromFile
(
filename
,
&
image
);
if
(
cofiff_result
!=
NSObjectFileImageSuccess
)
return
NULL
;
return
NSLinkModule
(
image
,
filename
,
NSLINKMODULE_OPTION_BINDNOW
|
NSLINKMODULE_OPTION_RETURN_ON_ERROR
);
}
void
pg_dlclose
(
void
*
handle
)
{
NSUnLinkModule
(
handle
,
NSUNLINKMODULE_OPTION_NONE
);
}
PGFunction
pg_dlsym
(
void
*
handle
,
const
char
*
funcname
)
{
NSSymbol
symbol
;
char
*
symname
=
(
char
*
)
malloc
(
strlen
(
funcname
)
+
2
);
if
(
!
symname
)
return
NULL
;
sprintf
(
symname
,
"_%s"
,
funcname
);
if
(
NSIsSymbolNameDefined
(
symname
))
{
symbol
=
NSLookupAndBindSymbol
(
symname
);
free
(
symname
);
return
(
PGFunction
)
NSAddressOfSymbol
(
symbol
);
}
else
{
free
(
symname
);
return
NULL
;
}
}
char
*
pg_dlerror
(
void
)
{
NSLinkEditErrors
c
;
int
errorNumber
;
const
char
*
fileName
;
const
char
*
errorString
=
NULL
;
switch
(
cofiff_result
)
{
case
NSObjectFileImageSuccess
:
/* must have failed in NSLinkModule */
NSLinkEditError
(
&
c
,
&
errorNumber
,
&
fileName
,
&
errorString
);
if
(
errorString
==
NULL
||
*
errorString
==
'\0'
)
errorString
=
"unknown link-edit failure"
;
break
;
case
NSObjectFileImageFailure
:
errorString
=
"failed to open object file"
;
break
;
case
NSObjectFileImageInappropriateFile
:
errorString
=
"inappropriate object file"
;
break
;
case
NSObjectFileImageArch
:
errorString
=
"object file is for wrong architecture"
;
break
;
case
NSObjectFileImageFormat
:
errorString
=
"object file has wrong format"
;
break
;
case
NSObjectFileImageAccess
:
errorString
=
"insufficient permissions for object file"
;
break
;
default:
errorString
=
"unknown failure to open object file"
;
break
;
}
return
(
char
*
)
errorString
;
}
#endif
/* HAVE_DLOPEN */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment