Back to index

glibc  2.9
dlldr.h
Go to the documentation of this file.
00001 /* Copyright (C) 2001 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 
00020 /*
00021 
00022  int __loadx(flag, module, arg1, arg2, arg3)
00023 
00024  The __loadx() is a call to ld_loadutil() kernel function, which 
00025  does the real work. Note ld_loadutil() is not exported an cannot be
00026  called directly from user space.
00027 
00028  void *ld_loadutil() call is a utility function used for loader extensions
00029  supporting run-time linking and dl*() functions.
00030 
00031  void *   - will return the modules entry point if it succeds of NULL
00032                 on failure.
00033 
00034  int flag - the flag field performas a dual role: the top 8 bits specify
00035             the work for __loadx() to perform, the bottom 8 bits are
00036             used to pass flags to the work routines, all other bits are
00037             reserved.
00038 
00039 */
00040 
00041 #define DL_LOAD       0x1000000 /* __loadx(flag,buf, buf_len, filename, libr_path) */
00042 #define DL_POSTLOADQ  0x2000000 /* __loadx(flag,buf, buf_len, module_handle) */
00043 #define DL_EXECQ      0x3000000 /* __loadx(flag,buf, buf_len) */
00044 #define DL_EXITQ      0x4000000 /* __loadx(flag,buf, buf_len) */
00045 #define DL_PREUNLOADQ 0x5000000 /* __loadx(flag,buf, buf_len, module_handle) */
00046 #define DL_INIT       0x6000000 /* __loadx(flag,NULL) */
00047 #define DL_GETSYM     0x7000000 /* __loadx(flag,symbol, index, modules_data_origin) */
00048 #define DL_SETDEPEND  0x8000000 /* __loadx(flag,import_data_org, import_index, */
00049                                 /*              export_data_org, export_index) */
00050 #define DL_DELDEPEND  0x9000000 /* __loadx(flag,import_data_org, import_index, */
00051                                 /*              export_data_org, export_index) */
00052 #define DL_GLOBALSYM  0xA000000 /* __loadx(flag,symbol_name, ptr_to_rec_index, */
00053                                 /*                        ptr_to_rec_data_org) */
00054 #define DL_UNIX_SYSCALL 0xB000000 /* __loadx(flag,syscall_symbol_name) */
00055 
00056 #define DL_FUNCTION_MASK 0xFF000000
00057 #define DL_SRCHDEPENDS   0x00100000
00058 #define DL_SRCHMODULE    0x00080000
00059 #define DL_SRCHLOADLIST  0x00040000
00060 #define DL_LOAD_LDX1     0x00040000
00061 #define DL_LOAD_RTL      0x00020000
00062 #define DL_HASHSTRING    0x00020000
00063 #define DL_INFO_OK       0x00010000
00064 #define DL_LOAD_DLINFO   0x00010000
00065 #define DL_UNLOADED      0x00020000
00066 
00067 typedef union _dl_info
00068 {
00069   struct {
00070            uint      _xflags;   /* flag bits in the array         */
00071            uint      _size;     /* size of this structure         */
00072            uint      _arraylen; /* number of following elements   */
00073          } _dl_stat;
00074   struct {
00075            caddr_t   _textorg;  /* start of loaded program image  */
00076            caddr_t   _dataorg;  /* start of data instance         */
00077            uint      _datasize; /* size of data instance          */
00078            ushort    _index;    /* index of this le in la_dynlist */
00079            ushort    _mflags;   /* info about module from load()  */
00080          } _dl_array;
00081 } DL_INFO;
00082 
00083 #define dlinfo_xflags   _dl_stat._xflags
00084 #define dlinfo_arraylen _dl_stat._arraylen
00085 #define dlinfo_size     _dl_stat._size
00086 
00087 #define dlinfo_textorg  _dl_array._textorg
00088 #define dlinfo_datasize _dl_array._datasize
00089 #define dlinfo_dataorg  _dl_array._dataorg
00090 #define dlinfo_index    _dl_array._index
00091 #define dlinfo_flags    _dl_array._mflags
00092 
00093 #define DL_HAS_RTINIT  0x1  /* indicates the module __rtinit symbols */
00094 #define DL_IS_NEW      0x2  /* indicates that the module is newly loaded */
00095 
00096 struct _xArgs
00097 {
00098    char    *libpath;
00099    DL_INFO *info;
00100    uint     infosize;
00101 };
00102 
00103 /* Shared Object DATA used for dl-open,dl-sym & dl-close support */
00104 typedef struct
00105 {
00106   void   *handle;         /* handle for __loadx    */
00107   uint    type;           /* type of __loadx flag  */
00108   ushort  index;          /* dlinfo_index          */
00109   caddr_t dataorg;        /* dlinfo_dataorg        */
00110 } DL_SODATA;
00111