From f3b412fbd6dd94d64eb6a63d88baef2816891c29 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 23 Sep 2005 00:38:22 +0000 Subject: r10438: Move portability functions to lib/replace/; replace now simply ensures that a given set of (working) POSIX functions are available (without prefixes to their names, etc). See lib/replace/README for a list. Functions that behave different from their POSIX specification (such as sys_select, sys_read, etc) have kept the sys_ prefix. (This used to be commit 29919a71059b29fa27a49b1f5b84bb8881de65fc) --- source4/lib/replace/dlfcn.c | 71 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 source4/lib/replace/dlfcn.c (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c new file mode 100644 index 0000000000..7a9e7230de --- /dev/null +++ b/source4/lib/replace/dlfcn.c @@ -0,0 +1,71 @@ +/* + Unix SMB/CIFS implementation. + Samba system utilities + Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Jeremy Allison 1998-2002 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* + Unix SMB/CIFS implementation. + Samba system utilities + Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Jeremy Allison 1998-2002 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +#ifndef HAVE_DLOPEN +void *dlopen(const char *name, int flags) +{ + return NULL; +} +#endif + +#ifndef HAVE_DLSYM +void *dlsym(void *handle, const char *symbol) +{ + return NULL; +} +#endif + +#ifndef HAVE_DLERROR +const char *dlerror(void) +{ + return "dynamic loading of objects not supported on this platform"; +} +#endif + +#ifndef HAVE_DLCLOSE +int dlclose(void *handle) +{ + return 0; +} +#endif -- cgit From aba4d018b4b9091789a47d1e40fc15c5e848794b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 23 Sep 2005 07:53:58 +0000 Subject: r10449: remove double copyright header metze (This used to be commit f6bd76fa154de6ed7f7ef3257be9572f13f3ec48) --- source4/lib/replace/dlfcn.c | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 7a9e7230de..6df57cd60c 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -19,27 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* - Unix SMB/CIFS implementation. - Samba system utilities - Copyright (C) Andrew Tridgell 1992-1998 - Copyright (C) Jeremy Allison 1998-2002 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - #include "includes.h" #ifndef HAVE_DLOPEN -- cgit From 38fdde5d9bf15b10caa60ee216d278ba8d870c2e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 4 Sep 2006 12:21:42 +0000 Subject: r18031: Merge my replace fixes: * libreplace can now build stand-alone * add stub testsuite for libreplace * make talloc/tdb/ldb use libreplace (This used to be commit fe7ca4b1454e01a33ed0d53791ebffdd349298b4) --- source4/lib/replace/dlfcn.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 6df57cd60c..79005c0d2b 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -3,23 +3,28 @@ Samba system utilities Copyright (C) Andrew Tridgell 1992-1998 Copyright (C) Jeremy Allison 1998-2002 + + ** NOTE! The following LGPL license applies to the replace + ** library. This does NOT imply that all of Samba is released + ** under the LGPL - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "includes.h" +#include "replace.h" +#include #ifndef HAVE_DLOPEN void *dlopen(const char *name, int flags) -- cgit From 3ca73facc59ed8a97abbc28c1b4bedde87e109a6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 6 Sep 2006 11:31:59 +0000 Subject: r18160: - pread and pwrite replacements need to be non-static - replacing rename() is pointless - all platforms have it (and the #define of rename breaks some code) - use system/locale.h in snprintf.c - fix passwd.h for initgroups - stdlib is in replace.h, not needed elsewhere - fix the initgroups replacement - fix mapping of dl functions to rep_* (This used to be commit 57cd0ca176387d6a3acabf9fedeef4f2a3a3dad7) --- source4/lib/replace/dlfcn.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 79005c0d2b..e25ac9dfe5 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -24,7 +24,6 @@ */ #include "replace.h" -#include #ifndef HAVE_DLOPEN void *dlopen(const char *name, int flags) @@ -41,7 +40,7 @@ void *dlsym(void *handle, const char *symbol) #endif #ifndef HAVE_DLERROR -const char *dlerror(void) +char *dlerror(void) { return "dynamic loading of objects not supported on this platform"; } -- cgit From 9044f4aa905882485bf2b5c72d9836bdaa14c37a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 21 Oct 2006 09:42:46 +0000 Subject: r19440: merged from samba3 (This used to be commit c22fb040234d0cb808fb36e1b4b7ea7bfd45c8cb) --- source4/lib/replace/dlfcn.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index e25ac9dfe5..22f9f8bf79 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -26,28 +26,28 @@ #include "replace.h" #ifndef HAVE_DLOPEN -void *dlopen(const char *name, int flags) +void *rep_dlopen(const char *name, int flags) { return NULL; } #endif #ifndef HAVE_DLSYM -void *dlsym(void *handle, const char *symbol) +void *rep_dlsym(void *handle, const char *symbol) { return NULL; } #endif #ifndef HAVE_DLERROR -char *dlerror(void) +char *rep_dlerror(void) { return "dynamic loading of objects not supported on this platform"; } #endif #ifndef HAVE_DLCLOSE -int dlclose(void *handle) +int rep_dlclose(void *handle) { return 0; } -- cgit From 867f7f4b7499c810adf3d5b391966321709e864d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 29 May 2007 15:18:20 +0000 Subject: r23208: on some HP-UX boxes dlfcn.h is available and use unsigned int flags for dlopen but no library contains the function... metze (This used to be commit 0c7e3ed9625d512522a0cc7278e705fbbfc316f4) --- source4/lib/replace/dlfcn.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 22f9f8bf79..55b38bb9eb 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -26,7 +26,11 @@ #include "replace.h" #ifndef HAVE_DLOPEN +#ifdef DLOPEN_TAKES_UNSIGNED_FLAGS +void *rep_dlopen(const char *name, unsigned int flags) +#else void *rep_dlopen(const char *name, int flags) +#endif { return NULL; } -- cgit From b8d69a7ea2505b706ff7c74d7c97bc89d82dfa07 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:46:15 +0000 Subject: r23795: more v2->v3 conversion (This used to be commit 84b468b2f8f2dffda89593f816e8bc6a8b6d42ac) --- source4/lib/replace/dlfcn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 55b38bb9eb..3e2232ce80 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -11,7 +11,7 @@ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. + version 3 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- cgit From 6c973f4e8ccbcb6c9275f8a54e26abb19df7e15a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 03:42:26 +0000 Subject: r23798: updated old Temple Place FSF addresses to new URL (This used to be commit 40c0919aaa9c1b14bbaebb95ecce53eb0380fdbb) --- source4/lib/replace/dlfcn.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 3e2232ce80..46aaaa4087 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -19,8 +19,7 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + License along with this library; if not, see . */ #include "replace.h" -- cgit From 3d6d80daba81a6cea396798dfe801c8d36c4685f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 6 Nov 2007 04:26:52 +0100 Subject: r25859: Wrap native HPUX functions in dl implementation. (This used to be commit bf1685faa1c941d3ca56b29a1e15b8a134d02068) --- source4/lib/replace/dlfcn.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 46aaaa4087..42848848e8 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -23,6 +23,9 @@ */ #include "replace.h" +#ifdef HAVE_DL_H +#include +#endif #ifndef HAVE_DLOPEN #ifdef DLOPEN_TAKES_UNSIGNED_FLAGS @@ -31,13 +34,22 @@ void *rep_dlopen(const char *name, unsigned int flags) void *rep_dlopen(const char *name, int flags) #endif { +#ifdef HAVE_SHL_LOAD + return (void *)shl_load(name, flags, 0); +#else return NULL; +#endif } #endif #ifndef HAVE_DLSYM void *rep_dlsym(void *handle, const char *symbol) { +#ifdef HAVE_SHL_FINDSYM + void *sym_addr; + if (!shl_findsym((shl_t *)&handle, symbol, TYPE_UNDEFINED, &sym_addr)) + return sym_addr; +#endif return NULL; } #endif @@ -52,6 +64,10 @@ char *rep_dlerror(void) #ifndef HAVE_DLCLOSE int rep_dlclose(void *handle) { +#ifdef HAVE_SHL_CLOSE + return shl_unload((shl_t)handle); +#else return 0; +#endif } #endif -- cgit From 910a1cafdf253255510d3aff7cc2385da43331dd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 20:05:51 +0100 Subject: Support dlopen(NULL, ...) on HPUX. (This used to be commit 53c70b5f77a3b9abaab783590e66278129173d5f) --- source4/lib/replace/dlfcn.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib/replace/dlfcn.c') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 42848848e8..3b109d7e40 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -35,6 +35,8 @@ void *rep_dlopen(const char *name, int flags) #endif { #ifdef HAVE_SHL_LOAD + if (name == NULL) + return PROG_HANDLE; return (void *)shl_load(name, flags, 0); #else return NULL; -- cgit