diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-18 17:45:34 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-18 17:45:34 -0400 |
commit | 3ecd3c8e3d6643986960d6266d71643df8f7c22e (patch) | |
tree | a1efd756838023645373b39bdfa34eb0ba81681b /src/dl/dlsym_reserved.go | |
parent | aecb837a5cf531d83aebe7666f400d56fa3ab1ed (diff) |
Massive documentation and copyright clean-up.
Diffstat (limited to 'src/dl/dlsym_reserved.go')
-rw-r--r-- | src/dl/dlsym_reserved.go | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/dl/dlsym_reserved.go b/src/dl/dlsym_reserved.go new file mode 100644 index 0000000..081e012 --- /dev/null +++ b/src/dl/dlsym_reserved.go @@ -0,0 +1,63 @@ +// The documentation for RTLD_DEFAULT and RTLD_NEXT is taken from the +// Linux Programmer's Manual page for dlsym(3). +// +// Copyright 1995 Yggdrasil Computing, Incorporated. +// Copyright 2003, 2015 Michael Kerrisk <mtk.manpages@gmail.com>. +// Copyright 2015 Luke Shumaker <lukeshu@sbcglobal.net>. +// +// This is free documentation; 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. +// +// The GNU General Public License's references to "object code" +// and "executables" are to be interpreted as the output of any +// document formatting or typesetting system, including +// intermediate and printed output. +// +// This manual 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 manual; if not, see +// <http://www.gnu.org/licenses/>. + +package dl + +import "unsafe" + +//#define _GNU_SOURCE +//#include <stdint.h> +//#include <dlfcn.h> +//const uintptr_t rtld_next = (uintptr_t)RTLD_NEXT; +//const uintptr_t rtld_default = (uintptr_t)RTLD_DEFAULT; +import "C" + +// These constant values for Handles are reserved by POSIX for future +// use with these meanings. They are available in GNU libdl if +// _GNU_SOURCE is defined. +var ( + // This Handle represents the default default shared object + // search order. The search will include global symbols in + // the executable and its dependencies, as well as symbols in + // shared objects that were dynamically loaded with the + // RTLD_GLOBAL flag. + RTLD_DEFAULT Handle + + // This Handle represents the shared object search order after + // the current object. This allows one to provide a wrapper + // around a function in another shared object, so that, for + // example, the definition of a function in a preloaded shared + // object (see LD_PRELOAD in ld.so(8)) can find and invoke the + // "real" function provided in another shared object (or for + // that matter, the "next" definition of the function in cases + // where there are multiple layers of preloading). + RTLD_NEXT Handle +) + +func init() { + RTLD_DEFAULT = Handle{c: unsafe.Pointer(uintptr(C.rtld_default)), o: 2} + RTLD_DEFAULT = Handle{c: unsafe.Pointer(uintptr(C.rtld_next)), o: 2} +} |