From 3f0a4a4e9b7563a0a7e45c25f5ea03a5b45b5434 Mon Sep 17 00:00:00 2001 From: Richard Dawe Date: Sat, 11 Mar 2006 17:15:25 +0000 Subject: [PATCH] Build a basic shared library on Linux; may not work! --- AUTHORS | 0 COPYING | 2 + ChangeLog | 0 Makefile.am | 21 ++++++++ NEWS | 0 README-alpha | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++ TODO | 17 ++++++ autogen.sh | 3 ++ configure.ac | 15 ++++++ sol_compat.h | 11 +++- umem_fail.c | 6 ++- vmem_mmap.c | 2 + 12 files changed, 217 insertions(+), 3 deletions(-) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README-alpha create mode 100644 TODO create mode 100755 autogen.sh create mode 100644 configure.ac diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..90f4490 --- /dev/null +++ b/COPYING @@ -0,0 +1,2 @@ +Please see COPYRIGHT and OPENSOLARIS.LICENSE for the copyright +and license details. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..239ca2c --- /dev/null +++ b/Makefile.am @@ -0,0 +1,21 @@ +lib_LTLIBRARIES = libumem.la +libumem_la_SOURCES = init_lib.c \ + umem_agent_support.c \ + umem_fail.c \ + umem_fork.c \ + umem_update_thread.c \ + vmem_mmap.c \ + vmem_sbrk.c \ + envvar.o \ + getpcstack.o \ + malloc.o \ + misc.o \ + vmem_base.o \ + umem.o \ + vmem.o + +# XXX: Standalone version? +# See + +# XXX: Non-i386: SPARC asm. x86_64? +# Convert this to GNU as format: i386_subr_sol.s diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README-alpha b/README-alpha new file mode 100644 index 0000000..53926ff --- /dev/null +++ b/README-alpha @@ -0,0 +1,143 @@ +This is the GNU mailutils package. +This document describes the actions needed to build the pre-release +or CVS version of the package. See end of file for copying conditions. + +* Introduction + + This is a *pre-release* version, and not ready for production use +yet. If you are taking source from CVS, you will need to have libtool, +automake, and autoconf installed to help contribute. See the chapter +`Building' for the detailed instructions. The script autogen.sh is +provided to help autoconfigure mailutils from the cvs src. After you +run autogen.sh, there should be a file 'INSTALL' with (generic) +installation instructions. Package-specific installation instructions +are set forth in the file README. + + Please, note that the accompanying documentation may be inaccurate +or incomplete. The ChangeLog file is the authoritative documentation of +all recent changes. + +Report bugs to + +* Checking Out the Sources + +The following instructions apply if you wish to obtain sources from +the CVS repository: + +To checkout the source tree from CVS issue the following command: + +CVS_RSH=ssh \ + cvs -d :ext:anoncvs@savannah.gnu.org:/cvsroot/mailutils checkout mailutils + +Make sure SSHv2 is used. + + This will give you read-only access. If you think you need write access, +contact the mailing list. + +* Building + + In order to build this you will first need to have right versions +of autotools and some auxiliary GNU programs. At the time of this +writing these are: + + Package Version (>=) + ======== ============ + automake 1.8.5 + autoconf 2.59 + libtool 1.5.8 + gettext 0.14.1 + gawk 3.1.3 + + You will also need bison (or yacc) and flex. The grammar sources +were written so that any version of yacc or bison should be able to +handle them, however using recent bison is anyway recommended. The lex +sources could theoretically be compiled with AT&T lex. I have not +tested this, however, so using flex is higly recommended. I use flex +2.5.4. + + To prepare the package for building run autogen.sh. Then run +./configure with the desired options (See INSTALL and README for the +detailed instructions). Finally, run make. Notice that the first make +of the package should be made in the source directory. Subsequent +makes can use build directory different from the source one. + +* Debugging + + To enable additional debugging information, configure the package +with --enable-debug option. + + Unless you compile mailutils statically, you will need to run +following command to debug any utility: + + libtool --mode execute gdb UTILITY-NAME + + Sometimes it is impossible or inconvenient to start a utility from +the debugger. In this case, use --HANG option, which is supported by +any of the mailutils programs. The option instructs the program to +sleep for a given number of seconds (3600 by default) right after +startup. For example, to debug `mimeview' utility, run + + mimeview --HANG [OTHER-OPTIONS] + +Then switch to another terminal, get the PID of the ivoked utility and +attach to it using gdb: + + gdb mimeview PID + +Once in gdb, issue the following command + + set _argp_hang=0 + +Now set your breakpoints and proceed as usual. + +* Importing gnulib files + + Mailutils imports several source files from gnulib. These go +mainly to the conventional library libmuaux (directory lib/), but +several of them are incorporated into the main library libmailutils +(directory mailbox/). The imported sources are kept in the CVS +repository to avoid using eventually unstable versions appearing in +the main gnulib CVS. Once in a time we update the sources. The update +procedure is quite straightforward: change to the root directory of +the mailutils tree and run `gnulib-sync' script: + + $ cd mailutils + $ scripts/gnulib-sync $HOME/src/gnulib + + The script takes a single argument: name of the directory with the +copy of gnulib source tree (see http://savannah.gnu.org/projects/gnulib +for information on how to obtain gnulib sources). After incorporating +the files, gnulib-sync leaves in the current directory two files named +gnulib.changelog and gnulib.cvs. The file gnulib.changelog contains +an entry to be prepended to ChangeLog, the file gnulib.cvs is a shell +script with the commands necessary to incorporate all the changes into +CVS. + + If you need to add more gnulib modules to mailutils, add their +names to gnulib.modules file, following the instructions in its +heading comment. Please avoid placing modules in :mailutils section, as +this may lead to unwanted name clashes when linking user programs with +libmailutils. + +* Copyright information: + +Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + + Permission is granted to anyone to make or distribute verbatim copies + of this document as received, in any medium, provided that the + copyright notice and this permission notice are preserved, + thus giving the recipient permission to redistribute in turn. + + Permission is granted to distribute modified versions + of this document, or of portions of it, + under the above conditions, provided also that they + carry prominent notices stating who last changed them. + + +Local Variables: +mode: outline +paragraph-separate: "[ ]*$" +version-control: never +End: + + diff --git a/TODO b/TODO new file mode 100644 index 0000000..8dd354d --- /dev/null +++ b/TODO @@ -0,0 +1,17 @@ +To-do List for the Linux port of umem +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Autconf'ery for in "sol_compat.h". + +* Fix #define wreakage for THR_RETURN, THR_API in "sol_compat.h". + +* Replace use of Ecelerity's portable atomic locking header with something + equivalent in "sol_compat.h". + +* ec_debug_vprintf -> something else? + +* doxygen'ate the headers/code, to produce reference docs. + +* rpm spec file. + +* test suite. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..b1defea --- /dev/null +++ b/autogen.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +autoreconf -f -i -s diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..5927632 --- /dev/null +++ b/configure.ac @@ -0,0 +1,15 @@ +AC_INIT([umem], [1.0], [], [umem]) +AM_INIT_AUTOMAKE + +AC_PROG_CC +AM_PROG_AS +AC_PROG_LIBTOOL + +AC_C_INLINE + +AC_CHECK_HEADERS([sys/mman.h sys/sysmacros.h]) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile]) + +AC_OUTPUT diff --git a/sol_compat.h b/sol_compat.h index 254a8b1..f369dc1 100644 --- a/sol_compat.h +++ b/sol_compat.h @@ -6,6 +6,15 @@ #ifndef _EC_UMEM_SOL_COMPAT_H_ #define _EC_UMEM_SOL_COMPAT_H_ +#include "config.h" + +#include +#include + +#define INLINE inline +#define THR_RETURN void * +#define THR_API + #if defined(__MACH__) || defined(_WIN32) #define NO_WEAK_SYMBOLS #define _umem_cache_alloc(a,b) umem_cache_alloc(a,b) @@ -89,7 +98,7 @@ static INLINE int thr_create(void *stack_base, # define RTLD_FIRST 0 #endif -#include "ec_atomic.h" +/*#include "ec_atomic.h"*/ #define P2PHASE(x, align) ((x) & ((align) - 1)) #define P2ALIGN(x, align) ((x) & -(align)) diff --git a/umem_fail.c b/umem_fail.c index ea952e8..ca110e0 100644 --- a/umem_fail.c +++ b/umem_fail.c @@ -38,9 +38,10 @@ #include #include #include +#include #include "misc.h" -#include "util.h" +/*#include "util.h"*/ static volatile int umem_exiting = 0; #define UMEM_EXIT_ABORT 1 @@ -126,7 +127,8 @@ umem_panic(const char *format, ...) umem_error_enter("\n"); va_start(va, format); - ec_debug_vprintf(DCRITICAL, DMEM, format, va); + /*ec_debug_vprintf(DCRITICAL, DMEM, format, va);*/ + fvprintf(stderr, format, va); va_end(va); print_stacktrace(); diff --git a/vmem_mmap.c b/vmem_mmap.c index 0779060..cbe9a2b 100644 --- a/vmem_mmap.c +++ b/vmem_mmap.c @@ -40,6 +40,8 @@ #include #endif +#include + #include "vmem_base.h" #define ALLOC_PROT PROT_READ | PROT_WRITE | PROT_EXEC