Changeset 24
- Timestamp:
- 09/03/06 12:48:23 (7 years ago)
- Files:
-
- trunk (modified) (1 prop)
- trunk/.cvsignore (modified) (1 diff)
- trunk/Makefile.am (modified) (3 diffs)
- trunk/configure.ac (modified) (1 diff)
- trunk/init_lib.c (modified) (3 diffs)
- trunk/malloc.c (modified) (1 diff)
- trunk/umem.spec.in (modified) (1 diff)
- trunk/umem_test.c (modified) (1 diff)
- trunk/umem_test3.c (added)
- trunk/umem_test4 (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk
- Property svn:ignore changed from
*.lo
*.la
.deps
.libs
*.loT
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.h
config.h.in
config.log
config.status
configure
libtool
stamp-h
stamp-h.in
stamp-h1
umem_test
umem_test2
Doxyfile
umem.spec
*.tar.gz
*.tar.bz2
to
*.lo
*.la
.deps
.libs
*.loT
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.h
config.h.in
config.log
config.status
configure
libtool
stamp-h
stamp-h.in
stamp-h1
umem_test
umem_test2
umem_test3
Doxyfile
umem.spec
*.tar.gz
*.tar.bz2
- Property svn:ignore changed from
trunk/.cvsignore
r21 r24 19 19 umem_test 20 20 umem_test2 21 umem_test3 21 22 Doxyfile 22 23 umem.spec trunk/Makefile.am
r21 r24 1 EXTRA_DIST = COPYRIGHT OPENSOLARIS.LICENSE umem.spec Doxyfile 1 EXTRA_DIST = COPYRIGHT OPENSOLARIS.LICENSE umem.spec Doxyfile umem_test4 2 2 3 3 lib_LTLIBRARIES = libumem.la 4 noinst_PROGRAMS = umem_test umem_test2 4 noinst_PROGRAMS = umem_test umem_test2 umem_test3 5 6 libumem_la_LDFLAGS = -lpthread -ldl 5 7 6 8 umem_test_SOURCES = umem_test.c 7 umem_test_LDADD = -lumem -lpthread -ldl9 umem_test_LDADD = -lumem 8 10 9 11 umem_test2_SOURCES = umem_test2.c 10 umem_test2_LDADD = -lumem -lpthread -ldl 12 umem_test2_LDADD = -lumem 13 14 umem_test3_SOURCES = umem_test3.c 15 umem_test3_LDADD = -lumem 11 16 12 17 libumem_la_SOURCES = init_lib.c \ … … 33 38 sys/vmem_impl_user.h 34 39 40 if MALLOC_REPLACEMENT 41 libumem_la_SOURCES += malloc.c 42 endif 43 35 44 nobase_include_HEADERS = umem.h sys/vmem.h 36 45 37 TESTS = umem_test umem_test2 46 TESTS = umem_test umem_test2 umem_test3 umem_test4 38 47 39 48 html-local: … … 48 57 rpmbuild -ta $(distdir).tar.bz2 49 58 50 # malloc.c51 52 # XXX: Standalone version?53 # See <http://cvs.opensolaris.org/source/xref/on/usr/src/lib/libumem/Makefile.com>54 55 59 # XXX: Non-i386: SPARC asm. x86_64? 56 60 # Convert this to GNU as format: i386_subr_sol.s 61 # <http://cvs.opensolaris.org/source/xref/on/usr/src/lib/libumem/> trunk/configure.ac
r16 r24 1 1 AC_INIT([umem], [1.0], [], [umem]) 2 2 AM_INIT_AUTOMAKE([dist-bzip2]) 3 4 AC_ARG_ENABLE([malloc-replacement], 5 AS_HELP_STRING([--enable-malloc-replacement], 6 [Include implementations of malloc/free/etc. in libumem (default is no)]), 7 [case "${enableval}" in 8 yes) malloc_replacement=true ;; 9 no) malloc_replacement=false ;; 10 *) AC_MSG_ERROR(bad value ${enableval} for --enable-malloc-replacement) ;; 11 esac],[malloc_replacement=false]) 12 AM_CONDITIONAL(MALLOC_REPLACEMENT, test x$malloc_replacement = xtrue) 3 13 4 14 AC_PROG_CC trunk/init_lib.c
r2 r24 45 45 #endif 46 46 47 #include <fcntl.h> 48 #include <string.h> 49 47 50 void 48 51 vmem_heap_init(void) … … 90 93 umem_get_max_ncpus(void) 91 94 { 92 #ifdef _SC_NPROCESSORS_ONLN 95 #ifdef linux 96 /* 97 * HACK: sysconf() will invoke malloc() on Linux as part of reading 98 * in /proc/stat. To avoid recursion in the malloc replacement 99 * version of libumem, read /proc/stat into a static buffer. 100 */ 101 static char proc_stat[8192]; 102 int fd; 103 int ncpus = 1; 104 105 fd = open("/proc/stat", O_RDONLY); 106 if (fd >= 0) { 107 const ssize_t n = read(fd, proc_stat, sizeof(proc_stat) - 1); 108 if (n >= 0) { 109 const char *cur; 110 const char *next; 111 112 proc_stat[n] = '\0'; 113 cur = proc_stat; 114 while (*cur && (next = strstr(cur + 3, "cpu"))) { 115 cur = next; 116 } 117 118 if (*cur) 119 ncpus = atoi(cur + 3) + 1; 120 } 121 122 close(fd); 123 } 124 125 return ncpus; 126 127 #else /* !linux */ 128 129 #if _SC_NPROCESSORS_ONLN 93 130 return (2 * sysconf(_SC_NPROCESSORS_ONLN)); 94 131 #elif defined(_SC_NPROCESSORS_CONF) … … 102 139 return (1); 103 140 #endif 141 142 #endif /* linux */ 104 143 } trunk/malloc.c
r2 r24 415 415 return (buf); 416 416 } 417 418 void __attribute__((constructor)) 419 __malloc_umem_init (void) 420 { 421 umem_startup(NULL, 0, 0, NULL, NULL); 422 } trunk/umem.spec.in
r23 r24 17 17 BuildRequires: binutils 18 18 BuildRequires: make 19 BuildRequires: mktemp 19 20 20 21 trunk/umem_test.c
r22 r24 19 19 umem_free(foo, 32); 20 20 21 return 0;21 return EXIT_SUCCESS; 22 22 } 23 23
