Index: ossp-pkg/mm/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/mm/ChangeLog,v rcsdiff -q -kk '-r1.39' '-r1.40' -u '/v/ossp/cvs/ossp-pkg/mm/ChangeLog,v' 2>/dev/null --- ChangeLog 2002/12/19 09:13:24 1.39 +++ ChangeLog 2002/12/19 09:14:58 1.40 @@ -1,19 +1,22 @@ - _ __ ___ _ __ ___ - | '_ ` _ \| '_ ` _ \ + _ __ ___ _ __ ___ + | '_ ` _ \| '_ ` _ \ | | | | | | | | | | | |_| |_| |_|_| |_| |_| - + OSSP mm - Shared Memory Allocation ChangeLog ========= - _ ____ - / | |___ \ + _ ____ + / | |___ \ | | __) | - | |_ / __/ + | |_ / __/ __|_(_)_____|______________________________________________________ - - Changes between 1.2.1 and 1.2.2 (28-Jul-2002 to xx-Dec-2002) + + Changes between 1.2.1 and 1.2.2 (28-Jul-2002 to 19-Dec-2002) + + *) Stripped trailing whitespaces from all files in source tree. + [Ralf S. Engelschall] *) Upgraded build environment to GNU Shtool 1.6.2, Libtool 1.4.3 and Autoconf 2.57. @@ -77,7 +80,7 @@ *) Fixed initializations of fdxxx variables in mm_core.c [Alexander Farber ] - *) Added $(DESTDIR) support to Makefile.in. This makes life easier + *) Added $(DESTDIR) support to Makefile.in. This makes life easier for RPM package building. [Brad , Ralf S. Engelschall] @@ -86,18 +89,18 @@ [Alexander Farber ] *) Added required "(void *)" cast to MAP_FAILED in Autoconf stuff. - [Albert Chin-A-Young , + [Albert Chin-A-Young , Joe Orton ] Changes between 1.1.2 and 1.1.3 (21-May-2000 to 01-Jul-2000) - *) Upgraded to GNU libtool from version 1.3.4 to 1.3.5 + *) Upgraded to GNU libtool from version 1.3.4 to 1.3.5 and upgraded GNU shtool from version 1.4.9 to 1.5.0 [Ralf S. Engelschall] *) Added OS/390 support to config.sub. [Greg Ames ] - + *) Fixed type-warnings related to `char' vs. `unsigned char' in mm_test.c [Ralf S. Engelschall] @@ -112,7 +115,7 @@ [Ralf S. Engelschall] Changes between 1.1.1 and 1.1.2 (30-Apr-2000 to 21-May-2000) - + *) Fixed some logic in mm's configuration that removes -g from CFLAGS. It incorrectly collapsed " -g " to "", which leaded to invalid CFLAGS. [Jeff Trawick ] @@ -145,10 +148,10 @@ *) Fixed pointer arithmentic in memset/memcpy replacements by casting `void *' arguments to `char *'. [Sascha Schumann ] - + *) Added BS2000 support for stuff. [Martin Kraemer ] - + *) Added an include for to maximum shared mem segment size check in aclocal.m4. This especially fixes compile problems under for Solaris 8. @@ -160,11 +163,11 @@ *) Added support for IBM OS/390 [Jeff Trawick ] - *) Upgraded to GNU libtool from version 1.3.3 to 1.3.4 + *) Upgraded to GNU libtool from version 1.3.3 to 1.3.4 and upgraded GNU shtool from version 1.4.6 to 1.4.9 [Ralf S. Engelschall] - *) Upgraded config.guess to GNU Pth's version and + *) Upgraded config.guess to GNU Pth's version and use "/sbin/sysctl" under FreeBSD instead of just "sysctl" [Jeff Trawick ] @@ -189,14 +192,14 @@ *) Splitted README into README, PORTING and THANKS document. [Ralf S. Engelschall] - _ ___ - / | / _ \ + _ ___ + / | / _ \ | || | | | | || |_| | __|_(_)___/________________________________________________________ Changes between 1.0.11 and 1.0.12 (06-Sep-1999 to 28-Sep-1999) - + *) Recreated configure with latest Autoconf 2.13.1 (snapshot) *) Always use --mode=xxx for libtool calls to avoid problems under situations where $CC doesn't allow libtool to guess the mode @@ -233,7 +236,7 @@ *) Fixed `make test' Changes between 1.0.7 and 1.0.8 (22-Jun-1999 to 24-Jun-1999) - + *) Added important MAP_FAILED fallback also to Autoconf stuff *) Upgraded to latest shtool 1.3.0-dev to fix two Awk problems @@ -253,7 +256,7 @@ *) Fixed mm_malloc() function: it returned the wrong pointer when a chunk was reused and forgot to lock/unlock the data structures. - *) Fixed internal best-fit algorithm for finding a free memory chunk: + *) Fixed internal best-fit algorithm for finding a free memory chunk: - things got inserted out of order in the list - when chunk is found which matches size exactly it stops immediately - lowered chunk splitting threshold to MIN(2*size,128) @@ -265,7 +268,7 @@ *) Fixed output of configure --help *) Upgraded to GNU libtool 1.3.2 *) Upgraded to shtool 1.2.9 - *) Made libtool calls visible but use --quiet + *) Made libtool calls visible but use --quiet *) Hint user to send feedback only on errors or for new platform *) Removed unnecessary "elf" hint for FreeBSD from config.guess Index: ossp-pkg/mm/INSTALL RCS File: /v/ossp/cvs/ossp-pkg/mm/INSTALL,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/mm/INSTALL,v' | diff -u /dev/null - -L'ossp-pkg/mm/INSTALL' 2>/dev/null --- ossp-pkg/mm/INSTALL +++ - 2024-05-12 13:27:40.742854282 +0200 @@ -0,0 +1,22 @@ + __ __ __ __ + | \/ | \/ | + | |\/| | |\/| | + | | | | | | | + |_| |_|_| |_| + + MM - Shared Memory Library + + INSTALL + ======= + + To install the MM library into /path/to/mm/{bin,lib,include,man}/ perform + the following steps in your shell: + + $ ./configure --prefix=/path/to/mm + $ make + $ make test + $ make install + + This installs at least a static variant of the MM library and when your + platforms support it, also a shared library variant of the MM library. + Index: ossp-pkg/mm/LICENSE RCS File: /v/ossp/cvs/ossp-pkg/mm/LICENSE,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/mm/LICENSE,v' 2>/dev/null --- LICENSE 2002/07/26 09:59:34 1.4 +++ LICENSE 2002/12/19 09:14:58 1.5 @@ -1,29 +1,29 @@ ==================================================================== Copyright (c) 1999-2002 Ralf S. Engelschall. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + 3. All advertising materials mentioning features or use of this software must display the following acknowledgment: "This product includes software developed by Ralf S. Engelschall ." - + 4. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by Ralf S. Engelschall ." - + THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR Index: ossp-pkg/mm/Makefile.in RCS File: /v/ossp/cvs/ossp-pkg/mm/Makefile.in,v rcsdiff -q -kk '-r1.30' '-r1.31' -u '/v/ossp/cvs/ossp-pkg/mm/Makefile.in,v' 2>/dev/null --- Makefile.in 2002/08/01 12:59:07 1.30 +++ Makefile.in 2002/12/19 09:14:58 1.31 @@ -6,7 +6,7 @@ ## are met: ## ## 1. Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. +## notice, this list of conditions and the following disclaimer. ## ## 2. Redistributions in binary form must reproduce the above copyright ## notice, this list of conditions and the following disclaimer in Index: ossp-pkg/mm/PORTING RCS File: /v/ossp/cvs/ossp-pkg/mm/PORTING,v rcsdiff -q -kk '-r1.23' '-r1.24' -u '/v/ossp/cvs/ossp-pkg/mm/PORTING,v' 2>/dev/null --- PORTING 2001/01/29 19:53:41 1.23 +++ PORTING 2002/12/19 09:14:58 1.24 @@ -1,9 +1,9 @@ - __ __ __ __ + __ __ __ __ | \/ | \/ | | |\/| | |\/| | | | | | | | | |_| |_|_| |_| - + MM - Shared Memory Library PORTING Index: ossp-pkg/mm/README RCS File: /v/ossp/cvs/ossp-pkg/mm/README,v rcsdiff -q -kk '-r1.72' '-r1.73' -u '/v/ossp/cvs/ossp-pkg/mm/README,v' 2>/dev/null --- README 2002/07/28 08:00:11 1.72 +++ README 2002/12/19 09:14:58 1.73 @@ -1,8 +1,8 @@ - _ __ ___ _ __ ___ - | '_ ` _ \| '_ ` _ \ + _ __ ___ _ __ ___ + | '_ ` _ \| '_ ` _ \ | | | | | | | | | | | |_| |_| |_|_| |_| |_| - + OSSP mm - Shared Memory Allocation Copyright (c) 1999-2002 Ralf S. Engelschall Copyright (c) 1999-2002 The OSSP Project @@ -14,7 +14,7 @@ dependent implementation details (allocation and locking) when dealing with shared memory segments and on the second (higher) layer it provides a high-level malloc(3)-style API for a convenient and well known way to work - with data-structures inside those shared memory segments. + with data-structures inside those shared memory segments. This library was successfully tested on FreeBSD, OpenBSD, NetBSD, BSDI, Linux, SunOS, Solaris, Tru64, AIX, A/UX, HP-UX, ReliantUNIX, IRIX, UnixWare Index: ossp-pkg/mm/THANKS RCS File: /v/ossp/cvs/ossp-pkg/mm/THANKS,v rcsdiff -q -kk '-r1.13' '-r1.14' -u '/v/ossp/cvs/ossp-pkg/mm/THANKS,v' 2>/dev/null --- THANKS 2002/07/28 07:54:41 1.13 +++ THANKS 2002/12/19 09:14:58 1.14 @@ -1,9 +1,9 @@ - __ __ __ __ + __ __ __ __ | \/ | \/ | | |\/| | |\/| | | | | | | | | |_| |_|_| |_| - + MM - Shared Memory Library THANKS @@ -48,7 +48,7 @@ o Thomas J. Menini o Joe Orton o Patrick - o Charles Randall + o Charles Randall o David Rees o Martin Rosenbach o David Reid Index: ossp-pkg/mm/aclocal.m4 RCS File: /v/ossp/cvs/ossp-pkg/mm/aclocal.m4,v rcsdiff -q -kk '-r1.25' '-r1.26' -u '/v/ossp/cvs/ossp-pkg/mm/aclocal.m4,v' 2>/dev/null --- aclocal.m4 2002/07/26 13:04:39 1.25 +++ aclocal.m4 2002/12/19 09:14:58 1.26 @@ -6,7 +6,7 @@ ## are met: ## ## 1. Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. +## notice, this list of conditions and the following disclaimer. ## ## 2. Redistributions in binary form must reproduce the above copyright ## notice, this list of conditions and the following disclaimer in @@ -241,7 +241,7 @@ #define KERNEL 1 #endif #ifdef MM_OS_BS2000 -#define _KMEMUSER +#define _KMEMUSER #endif #include #include @@ -276,7 +276,7 @@ return 0; if (ftruncate(fd, size) == -1) return 0; - if ((segment = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, + if ((segment = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == (void *)MAP_FAILED) { close(fd); return 0; @@ -297,7 +297,7 @@ #endif #ifdef TEST_BEOS area_id id; - id = create_area("mm_test", (void*)&segment, B_ANY_ADDRESS, size, + id = create_area("mm_test", (void*)&segment, B_ANY_ADDRESS, size, B_LAZY_LOCK, B_READ_AREA|B_WRITE_AREA); if (id < 0) return 0; @@ -308,7 +308,7 @@ #define ABS(n) ((n) >= 0 ? (n) : (-(n))) -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { int t, m, b; int d; Index: ossp-pkg/mm/configure.ac RCS File: /v/ossp/cvs/ossp-pkg/mm/configure.ac,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/mm/configure.ac,v' 2>/dev/null --- configure.ac 2002/07/26 13:21:31 1.3 +++ configure.ac 2002/12/19 09:14:58 1.4 @@ -52,7 +52,7 @@ AC_CONFIGURE_PART(Platform Environment) -AC_HAVE_HEADERS(stdio.h stdlib.h string.h dnl +AC_HAVE_HEADERS(stdio.h stdlib.h string.h dnl errno.h limits.h unistd.h fcntl.h dnl sys/stat.h sys/types.h) AC_BEGIN_DECISION([mandatory system headers]) @@ -93,12 +93,12 @@ AH_TEMPLATE([MM_VMPS_SYSCONF], [memory page size determination: POSIX.1 sysconf(_SC_PAGESIZE)]) AH_TEMPLATE([MM_VMPS_BEOS], [memory page size determination: BeOS B_PAGE_SIZE]) AC_BEGIN_DECISION([memory page size determination]) -AC_IFALLYES(header:unistd.h func:getpagesize, +AC_IFALLYES(header:unistd.h func:getpagesize, AC_DECIDE(MM_VMPS_GETPAGESIZE, [4.2BSD getpagesize()])) -AC_IFALLYES(header:unistd.h func:sysconf define:_SC_PAGESIZE, +AC_IFALLYES(header:unistd.h func:sysconf define:_SC_PAGESIZE, AC_DECIDE(MM_VMPS_SYSCONF, [POSIX.1 sysconf(_SC_PAGESIZE)])) AC_IFALLYES(header:kernel/OS.h define:B_PAGE_SIZE, - AC_DECIDE(MM_VMPS_BEOS, [BeOS B_PAGE_SIZE])) + AC_DECIDE(MM_VMPS_BEOS, [BeOS B_PAGE_SIZE])) AC_END_DECISION AC_DEFINE_UNQUOTED($ac_decision) @@ -126,16 +126,16 @@ AC_BEGIN_DECISION([shared memory allocation method]) AC_IFALLYES(header:kernel/OS.h func:create_area, AC_DECIDE(MM_SHMT_BEOS, [BeOS areas])) -AC_IFALLYES(header:sys/mman.h func:mmap func:munmap, +AC_IFALLYES(header:sys/mman.h func:mmap func:munmap, AC_DECIDE(MM_SHMT_MMFILE, [Classical mmap() on temporary file])) -AC_IFALLYES(header:sys/mman.h func:mmap func:munmap func:shm_open func:shm_unlink, +AC_IFALLYES(header:sys/mman.h func:mmap func:munmap func:shm_open func:shm_unlink, AC_DECIDE(MM_SHMT_MMPOSX, [mmap() via POSIX.1 shm_open() on temporary file])) -AC_IFALLYES(header:sys/mman.h func:mmap func:munmap file:/dev/zero, +AC_IFALLYES(header:sys/mman.h func:mmap func:munmap file:/dev/zero, AC_DECIDE(MM_SHMT_MMZERO, [SVR4-style mmap() on /dev/zero])) AC_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl func:shmget func:shmat func:shmdt func:shmctl, AC_DECIDE(MM_SHMT_IPCSHM, [SysV IPC shmget()])) -AC_IFALLYES(header:sys/mman.h func:mmap func:munmap define:MAP_ANON, +AC_IFALLYES(header:sys/mman.h func:mmap func:munmap define:MAP_ANON, AC_DECIDE(MM_SHMT_MMANON, [4.4BSD-style mmap() via MAP_ANON])) case $PLATFORM in *-*-linux* ) @@ -155,7 +155,7 @@ # Should be supported in Linux 2.3, but still hangs there. # Will be supported from Linux 2.4 on the first time really. # MM_SHMT_MMFILE: - # Works on Linux versions. + # Works on Linux versions. case $PLATFORM in *-linux1* ) AC_DECISION_FORCE(MM_SHMT_MMFILE) @@ -221,12 +221,12 @@ AH_TEMPLATE([MM_SEMT_FCNTL], [mutex implementation method: SVR4-style fcntl() on temporary file]) AH_TEMPLATE([MM_SEMT_BEOS], [mutex implementation method: BeOS semaphores]) AC_BEGIN_DECISION([mutex implementation method]) -AC_IFALLYES(header:sys/file.h define:LOCK_EX, +AC_IFALLYES(header:sys/file.h define:LOCK_EX, AC_DECIDE(MM_SEMT_FLOCK, [4.2BSD-style flock() on temporary file])) AC_IFALLYES(header:sys/ipc.h header:sys/sem.h header:sys/file.h dnl func:semget func:semctl, AC_DECIDE(MM_SEMT_IPCSEM, [SysV IPC semget()])) -AC_IFALLYES(header:fcntl.h define:F_SETLK, +AC_IFALLYES(header:fcntl.h define:F_SETLK, AC_DECIDE(MM_SEMT_FCNTL, [SVR4-style fcntl() on temporary file])) AC_IFALLYES(header:kernel/OS.h func:create_sem, AC_DECIDE(MM_SEMT_BEOS, [BeOS semaphores])) Index: ossp-pkg/mm/devtool.conf RCS File: /v/ossp/cvs/ossp-pkg/mm/devtool.conf,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/mm/devtool.conf,v' 2>/dev/null --- devtool.conf 2002/12/19 09:13:24 1.3 +++ devtool.conf 2002/12/19 09:14:58 1.4 @@ -22,7 +22,7 @@ %version ./shtool version -l c -n "OSSP mm" -p mm_ -e mm_vers.c V=`./shtool version -l c -d long mm_vers.c` - sed -e "s/Version .*(.*)/Version $V/g" README.n + sed -e "s/Version .*(.*)/Version $V/g" README.n mv README.n README %dist Index: ossp-pkg/mm/mm-config.in RCS File: /v/ossp/cvs/ossp-pkg/mm/mm-config.in,v rcsdiff -q -kk '-r1.8' '-r1.9' -u '/v/ossp/cvs/ossp-pkg/mm/mm-config.in,v' 2>/dev/null --- mm-config.in 2002/07/26 09:59:34 1.8 +++ mm-config.in 2002/12/19 09:14:58 1.9 @@ -10,7 +10,7 @@ ## are met: ## ## 1. Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. +## notice, this list of conditions and the following disclaimer. ## ## 2. Redistributions in binary form must reproduce the above copyright ## notice, this list of conditions and the following disclaimer in @@ -41,7 +41,7 @@ ## OF THE POSSIBILITY OF SUCH DAMAGE. ## ==================================================================== -DIFS=' +DIFS=' ' prefix="@prefix@" @@ -82,7 +82,7 @@ *) optarg='' ;; esac case "$option" in - --help|-h) + --help|-h) echo "Usage: $usage" echo "Report bugs to rse@engelschall.com" exit 0 @@ -106,7 +106,7 @@ output="$output -lmm" output_extra="$output_extra $mm_libs" ;; - * ) + * ) echo "mm-config:Error: Invalid option" 1>&2 echo "mm-config:Usage: $usage" 1>&2 exit 1; Index: ossp-pkg/mm/mm-config.pod RCS File: /v/ossp/cvs/ossp-pkg/mm/mm-config.pod,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/mm/mm-config.pod,v' 2>/dev/null --- mm-config.pod 2002/07/26 13:04:40 1.6 +++ mm-config.pod 2002/12/19 09:14:58 1.7 @@ -6,7 +6,7 @@ ## are met: ## ## 1. Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. +## notice, this list of conditions and the following disclaimer. ## ## 2. Redistributions in binary form must reproduce the above copyright ## notice, this list of conditions and the following disclaimer in @@ -53,7 +53,7 @@ =head1 SYNOPSIS -B +B [B<--help>] [B<--version>] [B<--cflags>] @@ -65,7 +65,7 @@ The B program is a little helper utility for easy configuring and building applications based on the mm(3) library. It can be used to query the C compiler and linker flags which are required to correctly compile and link -the application against the mm(3) library. +the application against the mm(3) library. =head1 OPTIONS @@ -107,7 +107,7 @@ CFLAGS=-O `mm-config --cflags` LDFLAGS=`mm-config --ldflags` LIBS=-lm `mm-config --libs` - + all: foo foo: foo.o $(CC) $(LDFLAGS) -o foo foo.o $(LIBS) Index: ossp-pkg/mm/mm.h RCS File: /v/ossp/cvs/ossp-pkg/mm/mm.h,v rcsdiff -q -kk '-r1.25' '-r1.26' -u '/v/ossp/cvs/ossp-pkg/mm/mm.h,v' 2>/dev/null --- mm.h 2002/07/26 13:21:31 1.25 +++ mm.h 2002/12/19 09:14:58 1.26 @@ -6,7 +6,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -62,7 +62,7 @@ #include #include -typedef enum { +typedef enum { MM_LOCK_RD, MM_LOCK_RW } mm_lock_mode; @@ -119,7 +119,7 @@ #define offset_of(type,member) ((size_t)(&((type *)0)->member)) #endif -#if !defined(HAVE_MEMCPY) +#if !defined(HAVE_MEMCPY) #if defined(HAVE_BCOPY) #define memcpy(to,from,len) bcopy(from,to,len) #else @@ -135,7 +135,7 @@ #define ERR(type,str) mm_lib_error_set(type,str) #define FAIL(type,str) { ERR(type,str); goto cus; } #define BEGIN_FAILURE cus: -#define END_FAILURE +#define END_FAILURE #if defined(HAVE_PATH_MAX) #define MM_MAXPATH PATH_MAX @@ -175,7 +175,7 @@ #define KERNEL 1 #endif #ifdef MM_OS_BS2000 -#define _KMEMUSER +#define _KMEMUSER #endif #include #ifdef MM_OS_SUNOS @@ -211,7 +211,7 @@ #include #endif -#define MM_ALLOC_MINSIZE (1024*8) +#define MM_ALLOC_MINSIZE (1024*8) #define MM_CORE_FILEMODE (S_IRUSR|S_IWUSR) #define MM_CORE_DEFAULT_PAGESIZE (1024*8) #define MM_CORE_DEFAULT_FILE "/tmp/mm.core.%d" /* %d is PID */ @@ -220,7 +220,7 @@ #define MM_ERR_CORE 2 #define MM_ERR_SYSTEM 4 -/* +/* * Define a union with types which are likely to have the longest * *relevant* CPU-specific memory word alignment restrictions... */ Index: ossp-pkg/mm/mm.pod RCS File: /v/ossp/cvs/ossp-pkg/mm/mm.pod,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/mm/mm.pod,v' 2>/dev/null --- mm.pod 2002/07/26 13:04:40 1.19 +++ mm.pod 2002/12/19 09:14:58 1.20 @@ -6,7 +6,7 @@ ## are met: ## ## 1. Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. +## notice, this list of conditions and the following disclaimer. ## ## 2. Redistributions in binary form must reproduce the above copyright ## notice, this list of conditions and the following disclaimer in @@ -116,12 +116,12 @@ dependent implementation details (allocation and locking) when dealing with shared memory segments and on the second (higher) layer it provides a high-level malloc(3)-style API for a convenient and well known way to work -with data-structures inside those shared memory segments. +with data-structures inside those shared memory segments. The abbreviation B is historically and originally comes from the phrase ``I'' as used by the POSIX.1 mmap(2) function. Because this facility is internally used by this library on most platforms to establish the -shared memory segments. +shared memory segments. =head2 LIBRARY STRUCTURE @@ -249,13 +249,13 @@ If a chunk of memory has to be allocated, the internal list of free chunks is searched for a minimal-size chunk which is larger or equal than the size of -the to be allocated chunk (a I strategy). +the to be allocated chunk (a I strategy). If a chunk is found which matches this best-fit criteria, but is still a lot larger than the requested size, it is split into two chunks: One with exactly the requested size (which is the resulting chunk given back) and one with the remaining size (which is immediately re-inserted into the list of free -chunks). +chunks). If no fitting chunk is found at all in the list of free chunks, a new one is created from the spare area of the shared memory segment until the segment is @@ -267,7 +267,7 @@ into the internal list of free chunks. The insertion operation automatically merges the chunk with a previous and/or a next free chunk if possible, i.e. if the free chunks stay physically seamless (one after another) in memory, to -automatically form larger free chunks out of smaller ones. +automatically form larger free chunks out of smaller ones. This way the shared memory segment is automatically defragmented when memory is deallocated. @@ -275,7 +275,7 @@ =back This strategy reduces memory waste and fragmentation caused by small and -frequent allocations and deallocations to a minimum. +frequent allocations and deallocations to a minimum. The internal implementation of the list of free chunks is not specially optimized (for instance by using binary search trees or even I trees, @@ -464,7 +464,7 @@ =item size_t B(MM *I); -Returns the amount in bytes of still available (free) memory in the +Returns the amount in bytes of still available (free) memory in the shared memory pool I. =item char *B(void); @@ -524,7 +524,7 @@ This returns the size in bytes of I. This size is exactly the size which was used for creating the shared memory area via mm_core_create(3). The function is provided just for convenience reasons to not require the -application to remember the memory size behind I itself. +application to remember the memory size behind I itself. =item size_t B(void); @@ -587,7 +587,7 @@ currently the high-level malloc(3)-style API just uses a single shared memory segment as the underlaying data structure for an C object which means that the maximum amount of memory an C object represents also depends on the -platform. +platform. This could be changed in later versions by allowing at least the high-level malloc(3)-style API to internally use multiple shared memory Index: ossp-pkg/mm/mm_alloc.c RCS File: /v/ossp/cvs/ossp-pkg/mm/mm_alloc.c,v rcsdiff -q -kk '-r1.16' '-r1.17' -u '/v/ossp/cvs/ossp-pkg/mm/mm_alloc.c,v' 2>/dev/null --- mm_alloc.c 2002/07/26 09:59:34 1.16 +++ mm_alloc.c 2002/12/19 09:14:58 1.17 @@ -6,7 +6,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -111,7 +111,7 @@ } /* - * Lock a memory pool + * Lock a memory pool */ int mm_lock(MM *mm, mm_lock_mode mode) { @@ -121,7 +121,7 @@ } /* - * Unlock a memory pool + * Unlock a memory pool */ int mm_unlock(MM *mm) { @@ -155,7 +155,7 @@ fprintf(stderr, " memory size = %d\n", mm->mp_size); fprintf(stderr, " memory offset = %d\n", mm->mp_offset); fprintf(stderr, " bytes spare = %d\n", mm->mp_size-mm->mp_offset); - fprintf(stderr, " bytes free = %d (%d chunk%s)\n", + fprintf(stderr, " bytes free = %d (%d chunk%s)\n", nFree, mm->mp_freechunks.mc_usize, mm->mp_freechunks.mc_usize == 1 ? "" : "s"); fprintf(stderr, " bytes allocated = %d\n", nAlloc); @@ -166,7 +166,7 @@ i = 1; while (mc->mc_u.mc_next != NULL) { mc = mc->mc_u.mc_next; - fprintf(stderr, " chunk #%03d: 0x%lx-0x%lx (%d bytes)\n", + fprintf(stderr, " chunk #%03d: 0x%lx-0x%lx (%d bytes)\n", i++, (unsigned long)mc, (unsigned long)(mc+mc->mc_size), mc->mc_size); } } @@ -188,7 +188,7 @@ mem_chunk *mc; mem_chunk *mcPrev; mem_chunk *mcNext; - + if (!mm_core_lock((void *)mm, MM_LOCK_RW)) return; mc = &(mm->mp_freechunks); @@ -313,7 +313,7 @@ mm_core_unlock((void *)mm); ERR(MM_ERR_ALLOC, "out of memory"); errno = ENOMEM; - return NULL; + return NULL; } mc = (mem_chunk *)((char *)mm + mm->mp_offset); mc->mc_size = size; Index: ossp-pkg/mm/mm_core.c RCS File: /v/ossp/cvs/ossp-pkg/mm/mm_core.c,v rcsdiff -q -kk '-r1.17' '-r1.18' -u '/v/ossp/cvs/ossp-pkg/mm/mm_core.c,v' 2>/dev/null --- mm_core.c 2002/12/19 09:11:51 1.17 +++ mm_core.c 2002/12/19 09:14:58 1.18 @@ -6,7 +6,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -118,10 +118,10 @@ int fd = -1; pid_t pid; int i; - + pid = getpid(); - for (i = 0; i < MM_MAXCHILD && - mc->mc_fdsem[i].pid != 0 && + for (i = 0; i < MM_MAXCHILD && + mc->mc_fdsem[i].pid != 0 && mc->mc_fdsem[i].fd != -1; i++) { if (mc->mc_fdsem[i].pid == pid) { fd = mc->mc_fdsem[i].fd; @@ -239,7 +239,7 @@ #endif #if defined(MM_SHMT_MMANON) - if ((area = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, + if ((area = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0)) == (void *)MAP_FAILED) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to memory map anonymous area"); #endif /* MM_SHMT_MMANON */ @@ -257,7 +257,7 @@ if (ftruncate(fdmem, mm_core_mapoffset+size) == -1) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to truncate tempfile"); write(fdmem, &zero, sizeof(zero)); - if ((area = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, + if ((area = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fdmem, mm_core_mapoffset)) == (void *)MAP_FAILED) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to memory map tempfile"); shm_unlink(fnmem); @@ -274,7 +274,7 @@ if (lseek(fdmem, mm_core_mapoffset+size, SEEK_SET) == -1) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to seek in /dev/zero"); write(fdmem, &zero, sizeof(zero)); - if ((area = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, + if ((area = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fdmem, mm_core_mapoffset)) == (void *)MAP_FAILED) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to memory map /dev/zero"); mm_core_mapoffset += size; @@ -291,7 +291,7 @@ if (ftruncate(fdmem, mm_core_mapoffset+size) == -1) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to truncate memory file"); write(fdmem, &zero, sizeof(zero)); - if ((area = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, + if ((area = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fdmem, mm_core_mapoffset)) == (void *)MAP_FAILED) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to memory map memory file"); mm_core_mapoffset += size; @@ -609,7 +609,7 @@ } } #endif - + if (rc < 0) { ERR(MM_ERR_CORE|MM_ERR_SYSTEM, "Failed to lock"); rc = FALSE; Index: ossp-pkg/mm/mm_global.c RCS File: /v/ossp/cvs/ossp-pkg/mm/mm_global.c,v rcsdiff -q -kk '-r1.10' '-r1.11' -u '/v/ossp/cvs/ossp-pkg/mm/mm_global.c,v' 2>/dev/null --- mm_global.c 2002/07/26 09:59:34 1.10 +++ mm_global.c 2002/12/19 09:14:58 1.11 @@ -6,7 +6,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in Index: ossp-pkg/mm/mm_lib.c RCS File: /v/ossp/cvs/ossp-pkg/mm/mm_lib.c,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/mm/mm_lib.c,v' 2>/dev/null --- mm_lib.c 2002/07/26 09:59:34 1.6 +++ mm_lib.c 2002/12/19 09:14:58 1.7 @@ -6,7 +6,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in Index: ossp-pkg/mm/mm_test.c RCS File: /v/ossp/cvs/ossp-pkg/mm/mm_test.c,v rcsdiff -q -kk '-r1.9' '-r1.10' -u '/v/ossp/cvs/ossp-pkg/mm/mm_test.c,v' 2>/dev/null --- mm_test.c 2002/07/26 09:59:34 1.9 +++ mm_test.c 2002/12/19 09:14:58 1.10 @@ -6,7 +6,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -61,7 +61,7 @@ exit(1); \ } -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { unsigned char *core; int i; @@ -73,7 +73,7 @@ char *cp[1025]; int version; struct count_test { int count; int prev; } *ct; - + setbuf(stderr, NULL); /* @@ -94,7 +94,7 @@ ** Test Low-Level Shared Memory API ** */ - + fprintf(stderr, "\n*** TESTING LOW-LEVEL SHARED MEMORY API ***\n"); fprintf(stderr, "\n=== Testing Memory Segment Access ===\n"); @@ -134,7 +134,7 @@ s = mm_core_size(ct); FAILED_IF(s == 0); fprintf(stderr, "actually allocated core size = %d\n", s); - + ct->prev = 0; ct->count = 1; if ((pid = fork()) == 0) { @@ -203,10 +203,10 @@ s = mm_available(mm); FAILED_IF(s == 0); fprintf(stderr, "actually available bytes = %d\n", s); - + fprintf(stderr, "Allocating areas inside MM\n"); n = 0; - for (i = 0; i < 1024; i++) + for (i = 0; i < 1024; i++) cp[i] = NULL; for (i = 0; i < 1024; i++) { fprintf(stderr, "total=%09d allocated=%09d add=%06d\r", s, n, (i+1)*(i+1)); @@ -253,10 +253,10 @@ else { fprintf(stderr, "Fine, we have again %d bytes available\n", s2); } - + fprintf(stderr, "Destroying MM object\n"); mm_destroy(mm); - + /******/ fprintf(stderr, "\nOK - ALL TESTS SUCCESSFULLY PASSED.\n\n");