aboutsummaryrefslogtreecommitdiff
path: root/src/backend/port/ultrix4
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/port/ultrix4')
-rw-r--r--src/backend/port/ultrix4/dl.h143
-rw-r--r--src/backend/port/ultrix4/dynloader.c85
-rw-r--r--src/backend/port/ultrix4/port-protos.h24
-rw-r--r--src/backend/port/ultrix4/port.c8
-rw-r--r--src/backend/port/ultrix4/strdup.c14
5 files changed, 142 insertions, 132 deletions
diff --git a/src/backend/port/ultrix4/dl.h b/src/backend/port/ultrix4/dl.h
index 7855db38f30..56eab754bf4 100644
--- a/src/backend/port/ultrix4/dl.h
+++ b/src/backend/port/ultrix4/dl.h
@@ -1,40 +1,40 @@
/*-------------------------------------------------------------------------
*
* dl.h--
- *
+ *
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: dl.h,v 1.3 1996/11/26 03:18:46 bryanh Exp $
+ * $Id: dl.h,v 1.4 1997/09/07 04:47:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
- * Ultrix 4.x Dynamic Loader Library Version 1.0
+ * Ultrix 4.x Dynamic Loader Library Version 1.0
*
- * dl.h--
- * header file for the Dynamic Loader Library
+ * dl.h--
+ * header file for the Dynamic Loader Library
*
*
- * Copyright (c) 1993 Andrew K. Yu, University of California at Berkeley
- * All rights reserved.
+ * Copyright (c) 1993 Andrew K. Yu, University of California at Berkeley
+ * All rights reserved.
*
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for educational, research, and non-profit purposes and
- * without fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation. Permission
- * to incorporate this software into commercial products can be obtained
- * from the author. The University of California and the author make
- * no representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for educational, research, and non-profit purposes and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation. Permission
+ * to incorporate this software into commercial products can be obtained
+ * from the author. The University of California and the author make
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
*
*/
#ifndef _DL_HEADER_
#define _DL_HEADER_
-#include <stdio.h> /* needed to declare FILE for ldfcn.h */
+#include <stdio.h> /* needed to declare FILE for ldfcn.h */
#include <filehdr.h>
#include <syms.h>
#include <ldfcn.h>
@@ -42,77 +42,82 @@
#include <scnhdr.h>
-typedef long CoreAddr;
+typedef long CoreAddr;
-typedef struct ScnInfo {
- CoreAddr addr; /* starting address of the section */
- SCNHDR hdr; /* section header */
- RELOC *relocEntries; /* relocation entries */
-} ScnInfo;
+typedef struct ScnInfo
+{
+ CoreAddr addr; /* starting address of the section */
+ SCNHDR hdr; /* section header */
+ RELOC *relocEntries; /* relocation entries */
+} ScnInfo;
-typedef enum {
- DL_NEEDRELOC, /* still need relocation */
- DL_RELOCATED, /* no relocation necessary */
- DL_INPROG /* relocation in progress */
-} dlRStatus;
+typedef enum
+{
+ DL_NEEDRELOC, /* still need relocation */
+ DL_RELOCATED, /* no relocation necessary */
+ DL_INPROG /* relocation in progress */
+} dlRStatus;
-typedef struct JmpTbl {
- char *block; /* the jump table memory block */
- struct JmpTbl *next; /* next block */
-} JmpTbl;
+typedef struct JmpTbl
+{
+ char *block; /* the jump table memory block */
+ struct JmpTbl *next; /* next block */
+} JmpTbl;
-typedef struct dlFile {
- char *filename; /* file name of the object file */
+typedef struct dlFile
+{
+ char *filename; /* file name of the object file */
- int textSize; /* used by mprotect */
- CoreAddr textAddress; /* start addr of text section */
- long textVaddr; /* vaddr of text section in obj file */
- CoreAddr rdataAddress; /* start addr of rdata section */
- long rdataVaddr; /* vaddr of text section in obj file */
- CoreAddr dataAddress; /* start addr of data section */
- long dataVaddr; /* vaddr of text section in obj file */
- CoreAddr bssAddress; /* start addr of bss section */
- long bssVaddr; /* vaddr of text section in obj file */
+ int textSize; /* used by mprotect */
+ CoreAddr textAddress;/* start addr of text section */
+ long textVaddr; /* vaddr of text section in obj file */
+ CoreAddr rdataAddress; /* start addr of rdata section */
+ long rdataVaddr; /* vaddr of text section in obj file */
+ CoreAddr dataAddress;/* start addr of data section */
+ long dataVaddr; /* vaddr of text section in obj file */
+ CoreAddr bssAddress; /* start addr of bss section */
+ long bssVaddr; /* vaddr of text section in obj file */
- int nsect; /* number of sections */
- ScnInfo *sect; /* details of each section (array) */
+ int nsect; /* number of sections */
+ ScnInfo *sect; /* details of each section (array) */
- int issExtMax; /* size of string space */
- char *extss; /* extern sym string space (in core) */
- int iextMax; /* maximum number of Symbols */
- pEXTR extsyms; /* extern syms */
+ int issExtMax; /* size of string space */
+ char *extss; /* extern sym string space (in core) */
+ int iextMax; /* maximum number of Symbols */
+ pEXTR extsyms; /* extern syms */
- dlRStatus relocStatus; /* what relocation needed? */
- int needReloc;
+ dlRStatus relocStatus;/* what relocation needed? */
+ int needReloc;
- JmpTbl *jmptable; /* the jump table for R_JMPADDR */
+ JmpTbl *jmptable; /* the jump table for R_JMPADDR */
- struct dlFile *next; /* next member of the archive */
-} dlFile;
+ struct dlFile *next; /* next member of the archive */
+} dlFile;
-typedef struct dlSymbol {
- char *name; /* name of the symbol */
- long addr; /* address of the symbol */
- dlFile *objFile; /* from which file */
-} dlSymbol;
+typedef struct dlSymbol
+{
+ char *name; /* name of the symbol */
+ long addr; /* address of the symbol */
+ dlFile *objFile; /* from which file */
+} dlSymbol;
/*
* prototypes for the dl* interface
*/
-extern void *dl_open(/* char *filename, int mode */);
-extern void *dl_sym(/* void *handle, char *name */);
-extern void dl_close(/* void *handle */);
-extern char *dl_error(/* void */);
+extern void *dl_open( /* char *filename, int mode */ );
+extern void *dl_sym( /* void *handle, char *name */ );
+extern void dl_close( /* void *handle */ );
+extern char *dl_error( /* void */ );
-#define DL_LAZY 0 /* lazy resolution */
-#define DL_NOW 1 /* immediate resolution */
+#define DL_LAZY 0 /* lazy resolution */
+#define DL_NOW 1 /* immediate resolution */
/*
* Miscellaneous utility routines:
*/
-extern char **dl_undefinedSymbols(/* int *count */);
-extern void dl_printAllSymbols(/* void *handle */);
-extern void dl_setLibraries(/* char *libs */);
+extern char **dl_undefinedSymbols( /* int *count */ );
+extern void dl_printAllSymbols( /* void *handle */ );
+extern void dl_setLibraries( /* char *libs */ );
-#endif /* _DL_HEADER_ */
+#endif /* _DL_HEADER_ */
diff --git a/src/backend/port/ultrix4/dynloader.c b/src/backend/port/ultrix4/dynloader.c
index 1acc54260a1..d896eebf901 100644
--- a/src/backend/port/ultrix4/dynloader.c
+++ b/src/backend/port/ultrix4/dynloader.c
@@ -1,15 +1,15 @@
/*-------------------------------------------------------------------------
*
* dynloader.c--
- * This dynamic loader uses Andrew Yu's libdl-1.0 package for Ultrix 4.x.
- * (Note that pg_dlsym and pg_dlclose are actually macros defined in
- * "port-protos.h".)
- *
+ * This dynamic loader uses Andrew Yu's libdl-1.0 package for Ultrix 4.x.
+ * (Note that pg_dlsym and pg_dlclose are actually macros defined in
+ * "port-protos.h".)
+ *
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/dynloader.c,v 1.3 1996/11/26 03:18:50 bryanh Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/dynloader.c,v 1.4 1997/09/07 04:47:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,49 +22,54 @@
#include "port-protos.h"
#include "utils/elog.h"
-extern char pg_pathname[];
+extern char pg_pathname[];
-void *
+void *
pg_dlopen(char *filename)
{
- static int dl_initialized= 0;
- void *handle;
+ static int dl_initialized = 0;
+ void *handle;
- /*
- * initializes the dynamic loader with the executable's pathname.
- * (only needs to do this the first time pg_dlopen is called.)
- */
- if (!dl_initialized) {
- if (!dl_init(pg_pathname)) {
- return NULL;
- }
/*
- * if there are undefined symbols, we want dl to search from the
- * following libraries also.
+ * initializes the dynamic loader with the executable's pathname.
+ * (only needs to do this the first time pg_dlopen is called.)
*/
- dl_setLibraries("/usr/lib/libm_G0.a:/usr/lib/libc_G0.a");
- dl_initialized= 1;
- }
+ if (!dl_initialized)
+ {
+ if (!dl_init(pg_pathname))
+ {
+ return NULL;
+ }
- /*
- * open the file. We do the symbol resolution right away so that we
- * will know if there are undefined symbols. (This is in fact the
- * same semantics as "ld -A". ie. you cannot have undefined symbols.
- */
- if ((handle=dl_open(filename, DL_NOW))==NULL) {
- int count;
- char **list= dl_undefinedSymbols(&count);
+ /*
+ * if there are undefined symbols, we want dl to search from the
+ * following libraries also.
+ */
+ dl_setLibraries("/usr/lib/libm_G0.a:/usr/lib/libc_G0.a");
+ dl_initialized = 1;
+ }
- /* list the undefined symbols, if any */
- if(count) {
- elog(NOTICE, "dl: Undefined:");
- while(*list) {
- elog(NOTICE, " %s", *list);
- list++;
- }
+ /*
+ * open the file. We do the symbol resolution right away so that we
+ * will know if there are undefined symbols. (This is in fact the same
+ * semantics as "ld -A". ie. you cannot have undefined symbols.
+ */
+ if ((handle = dl_open(filename, DL_NOW)) == NULL)
+ {
+ int count;
+ char **list = dl_undefinedSymbols(&count);
+
+ /* list the undefined symbols, if any */
+ if (count)
+ {
+ elog(NOTICE, "dl: Undefined:");
+ while (*list)
+ {
+ elog(NOTICE, " %s", *list);
+ list++;
+ }
+ }
}
- }
- return (void *)handle;
+ return (void *) handle;
}
-
diff --git a/src/backend/port/ultrix4/port-protos.h b/src/backend/port/ultrix4/port-protos.h
index 4d4346f16b5..25f49db393d 100644
--- a/src/backend/port/ultrix4/port-protos.h
+++ b/src/backend/port/ultrix4/port-protos.h
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* port-protos.h--
- * prototypes for Ultrix-specific routines
+ * prototypes for Ultrix-specific routines
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: port-protos.h,v 1.5 1997/02/13 09:53:57 scrappy Exp $
+ * $Id: port-protos.h,v 1.6 1997/09/07 04:47:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,8 +17,8 @@
* Externals in libc that need prototypes (or at least declarations)
*/
-extern char *ecvt(double, int, int*, int*);
-extern char *fcvt(double, int, int*, int*);
+extern char *ecvt(double, int, int *, int *);
+extern char *fcvt(double, int, int *, int *);
/* dynloader.c */
/*
@@ -27,21 +27,21 @@ extern char *fcvt(double, int, int*, int*);
* This dynamic loader uses Andrew Yu's libdl-1.0 package for Ultrix 4.x.
* (Note that pg_dlsym and pg_dlclose are actually macros defined in
* "port-protos.h".)
- */
+ */
#define pg_dlsym(h, f) ((func_ptr)dl_sym(h, f))
#define pg_dlclose(h) dl_close(h)
-#define pg_dlerror() dl_error()
-extern int dl_init(char *);
+#define pg_dlerror() dl_error()
+extern int dl_init(char *);
/* port.c */
-extern int syscall();
+extern int syscall();
-extern void init_address_fixup(void);
+extern void init_address_fixup(void);
/* strdup.c: strdup() is not part of libc on Ultrix */
-extern char* strdup(char const*);
+extern char *strdup(char const *);
/* inet_aton() is not part of libc on Ultrix. The following is from
backend/port/inet_aton.h
@@ -49,6 +49,6 @@ extern char* strdup(char const*);
struct in_addr;
int
-inet_aton(const char *cp, struct in_addr *addr);
+ inet_aton(const char *cp, struct in_addr * addr);
-#endif /* PORT_PORTOS_H */
+#endif /* PORT_PORTOS_H */
diff --git a/src/backend/port/ultrix4/port.c b/src/backend/port/ultrix4/port.c
index 4e6e19bdd0d..b009073f788 100644
--- a/src/backend/port/ultrix4/port.c
+++ b/src/backend/port/ultrix4/port.c
@@ -1,13 +1,13 @@
/*-------------------------------------------------------------------------
*
* port.c--
- * Ultrix-specific routines
+ * Ultrix-specific routines
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/port.c,v 1.2 1997/02/13 09:53:59 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/port.c,v 1.3 1997/09/07 04:47:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,6 +21,6 @@ void
init_address_fixup()
{
#ifdef NOFIXADE
- syscall(SYS_sysmips, MIPS_FIXADE, 0, NULL, NULL, NULL);
-#endif /* NOFIXADE */
+ syscall(SYS_sysmips, MIPS_FIXADE, 0, NULL, NULL, NULL);
+#endif /* NOFIXADE */
}
diff --git a/src/backend/port/ultrix4/strdup.c b/src/backend/port/ultrix4/strdup.c
index 882f0047e63..a738e1611ef 100644
--- a/src/backend/port/ultrix4/strdup.c
+++ b/src/backend/port/ultrix4/strdup.c
@@ -1,13 +1,13 @@
/*-------------------------------------------------------------------------
*
* strdup.c--
- * copies a null-terminated string.
+ * copies a null-terminated string.
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/strdup.c,v 1.2 1996/11/26 03:19:04 bryanh Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/strdup.c,v 1.3 1997/09/07 04:47:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,11 +17,11 @@
#include "port-protos.h"
-char *
-strdup(char const *string)
+char *
+strdup(char const * string)
{
- char *nstr;
+ char *nstr;
- nstr = strcpy((char *)palloc(strlen(string)+1), string);
- return nstr;
+ nstr = strcpy((char *) palloc(strlen(string) + 1), string);
+ return nstr;
}