lien nguyenphuong | 27 Aug 10:33
Picon

TRIEN LAM O TO LON NHAT

Kính mời Quý vị  đến tham quan TRIỂN LÃM Ô TÔ LỚN NHẤT VIỆT NAM- AUTOPETRO 2009 với SIÊU XE- SIÊU MẪU.

 

                        Thời gian:     Từ 3 đến 6/9/2009

                        Địa điểm:       Trung tâm Triển lãm và Hội nghị Sài Gòn (SECC)

                                                  799 Đại lộ Nguyễn Văn Linh, Quận 7, TP.Hồ Chí Minh

Jan Engelhardt | 17 Jan 20:39
Picon

btrfs: readdir problem workaround for 32-bit off_t

Hi,

I am seeing abnormal kernel<->userland interaction for range-exceeding 
offsets during readdir.
A suggested patch for btrfs is below, but I think there could also
be involvement of (read: a bug in) Glibc.
Would the copied parties please have a look, as it may spans both glibc 
and btrfs.

Thanks,
Jan

parent 81841fa96da5597a411f5f274a664f186b2d2549 (v2.6.29-rc2-21-g81841fa)
commit fa8ea6611fedecba8e5fdf2a5dfd82affa5a982e
Author: Jan Engelhardt <jengelh <at> medozas.de>
Date:   Sat Jan 17 20:26:25 2009 +0100

btrfs: readdir problem workaround for 32-bit off_t

Kernel is i586, as is the userland.

btrfs sets filp->f_pos == (2^63-1) when it has reached the
end of a directory. This is problematic.

In obtuse 32-bit mode (no _FILE_OFFSET_BITS), readdir(3) will not return 
the last entry.

However, when compiled with -D_FILE_OFFSET_BITS=64, it will return the 
last entry. But telldir() will return (uint32_t)-1, which does not quite 
match up with the 2^63-1.

	$ cat test.c
	#include <dirent.h>
	#include <stdio.h>

	int main(int argc, const char **argv)
	{
		DIR *r = opendir(argv[1]);
		struct dirent *de;

		while ((de = readdir(r)) != NULL)
			printf("%lld %s\n", (long long)telldir(r), de->d_name);
		return 0;
	}
	$ gcc test.c -o test -ggdb3
	$ ./test /tmp/z
	2 .
	2 ..
	3 a
	4 b
	5 lib

	$ gcc test.c -o test -ggdb3 -D_FILE_OFFSET_BITS=64
	$ ./test /tmp/z
	2 .
	2 ..
	3 a
	4 b
	5 lib
	4294967295 strace.log

This has deep effects and my boot hangs. (Got btrfs as the root fs.)

I have no idea who exactly of Glibc and btrfs is at fault with what,
but this change makes btrfs usable for the moment.

Signed-off-by: Jan Engelhardt <jengelh <at> medozas.de>
---
 fs/btrfs/inode.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8adfe05..901be02 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3264,10 +3264,7 @@ skip:
 	}

 	/* Reached end of directory/root. Bump pos past the last item. */
-	if (key_type == BTRFS_DIR_INDEX_KEY)
-		filp->f_pos = INT_LIMIT(typeof(filp->f_pos));
-	else
-		filp->f_pos++;
+	filp->f_pos++;
 nopos:
 	ret = 0;
 err:
--

-- 
# Created with git-export-patch

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Alexander Mikhailian | 30 Jun 00:09

a new ru_BY locale is requested

Hello, I am listed as a maintainer of the be_BY locale. There's been a
discussion on the i18n <at> mova.org [1] mailing list around the creation of the
ru_BY locale.

The reasoning is as follows:

1. In Belarus, Russian is by far more popular than Belarusian.
2. Most of the local GNU/Linux users live happily with the ru_RU locale.
3. Some things, e.g. the default encoding, the currency, the phone prefix,
   the name of the country itself differ in the belarusian variant
   of Russian.
4. By introducing the new locale, we fixing those issues.

Attachment (ru_BY.patch): text/x-diff, 452 bytes
comment_char %
escape_char  /
%
% Russian Language Locale for Belarus
% Contact: Alexander Mikhailian
% Email: mikhailian <at> mova.org
% Language: ru
% Territory: BY
% Revision: 0.1
% Date: 2008-06-24
% Application: general
% Users: general
% Charset: UTF-8
% Distribution and use is free, also
% for commercial purposes.

LC_IDENTIFICATION
title      "Russian locale for Belarus"
source     ""
address    ""
contact    ""
email      "mikhailian <at> mova.org"
tel        ""
fax        ""
language   "Russian"
territory  "Belarus"
revision   "0.1"
date       "2008-06-24"
%
category  "ru_BY:2000";LC_IDENTIFICATION
category  "ru_BY:2000";LC_CTYPE
category  "ru_BY:2000";LC_COLLATE
category  "ru_BY:2000";LC_TIME
category  "ru_BY:2000";LC_NUMERIC
category  "ru_BY:2000";LC_MONETARY
category  "ru_BY:2000";LC_MESSAGES
category  "ru_BY:2000";LC_PAPER
category  "ru_BY:2000";LC_NAME
category  "ru_BY:2000";LC_ADDRESS
category  "ru_BY:2000";LC_TELEPHONE

END LC_IDENTIFICATION

LC_COLLATE
copy "ru_RU"
END LC_COLLATE

LC_CTYPE
copy "ru_RU"
END LC_CTYPE

LC_MESSAGES
copy "ru_RU"
END LC_MESSAGES

LC_MONETARY
int_curr_symbol           "<U0042><U0059><U0052><U0020>"
currency_symbol           "<U0440><U0443><U0431>"
mon_decimal_point         "<U002E>"
mon_thousands_sep         "<U00A0>"
mon_grouping              3;3
positive_sign             ""
negative_sign             "<U002D>"
int_frac_digits           2
frac_digits               2
p_cs_precedes             0
p_sep_by_space            1
n_cs_precedes             0
n_sep_by_space            1
p_sign_posn               1
n_sign_posn               1
END LC_MONETARY

LC_NUMERIC
copy "ru_RU"
END LC_NUMERIC

LC_TIME
copy "ru_RU"
END LC_TIME

LC_PAPER
copy "ru_RU"
END LC_PAPER

LC_TELEPHONE
tel_int_fmt    "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
<U006C>"
int_prefix     "<U0033><U0037><U0035>"
int_select     "<U0038><U007E><U0031><U0030>"
END LC_TELEPHONE

LC_MEASUREMENT
copy "ru_RU"
END LC_MEASUREMENT

LC_NAME
copy "ru_RU"
END LC_NAME

LC_ADDRESS
postal_fmt    "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
<U004E><U0025><U0025><U007A><U0020><U0025><U0054><U0025>/
<U004E><U0025><U0063><U0025><U004E>"
country_ab2 "<U0042><U0059>"
country_ab3 "<U0042><U004C><U0052>"
country_num 112
country_name "<U0411><U0435><U043B><U0430><U0440><U0443><U0441><U044C>"
country_car "<U0042><U0059>"
country_post "<U0042><U0059>"
country_isbn 5
lang_name "<U0440><U0443><U0441><U0441><U043A><U0438><U0439><U0020><U044F><U0437><U044B><U043A>"
% FIXME
%lang_ab "<U0440><U0443>"
%lang_term "<U0440><U0443><U0441>"
%lang_lib "<U0440><U0443><U0441>"
END LC_ADDRESS
_______________________________________________
I18n mailing list
I18n <at> mova.org
http://mova.org/cgi-bin/mailman/listinfo/i18n
amith pawar | 24 Apr 06:53
Picon

Glibc Help

Hi,
This is Amit and I am trying to port Glibc to new platform (new
processor ) and I want to learn how to do ? but I didn't get whole
picture. Can you please suggest me or can you give me hint how to do
this. Just now i finished adding information about this processor to
config.sub file and what exactly do I need to modify in configure.in
file I dont know and Linux OS will be going to run on this processor
and I have to do following task to port.

1) Modifying config files
2) Creating sysdep definitions (machine independent)
3) Creating pthread related definitions
4) Creating machine dependent routines

Please tell me general task I need to do to port Glibc

--

-- 
With best regards,
amit pawar

cuminato | 6 Apr 10:02
Picon
Picon

Problem compiling glibc-2.5

Hi,
im trying to compile glibc2.5 but im getting this error:

gcc   -nostdlib -nostartfiles -r -o
/home/hooligan/Desktop/gb/elf/librtld.map.o '-Wl,-('
/home/hooligan/Desktop/gb/elf/dl-allobjs.os
/home/hooligan/Desktop/gb/libc_pic.a -lgcc '-Wl,-)'
-Wl,-Map,/home/hooligan/Desktop/gb/elf/librtld.mapT
/home/hooligan/Desktop/gb/libc_pic.a(init-first.os):(.data+0x0): multiple
definition of `__libc_multiple_libcs'
/home/hooligan/Desktop/gb/elf/dl-allobjs.os:/home/hooligan/Desktop/glibc-2.5/elf/rtld.c:644:
first defined here
/home/hooligan/Desktop/gb/libc_pic.a(_itoa.os): In function `_itoa':
/home/hooligan/Desktop/glibc-2.5/stdio-common/_itoa.c:210: multiple
definition of `_itoa'
/home/hooligan/Desktop/gb/elf/dl-allobjs.os:/home/hooligan/Desktop/glibc-2.5/elf/dl-minimal.c:295:
first defined here
/usr/bin/ld: Warning: size of symbol `_itoa' changed from 86 in
/home/hooligan/Desktop/gb/elf/dl-allobjs.os to 440 in
/home/hooligan/Desktop/gb/libc_pic.a(_itoa.os)
collect2: ld returned 1 exit status
make[2]: *** [/home/hooligan/Desktop/gb/elf/librtld.map] Error 1
make[2]: Leaving directory `/home/hooligan/Desktop/glibc-2.5/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/home/hooligan/Desktop/glibc-2.5'
make: *** [all] Error 2

i dont know what to do more, can anyone help me?

im using gcc version 4.1.2, ubuntu edgy 6.10

thanks
Oswaldo Villarroel | 19 Mar 15:51
Picon

problems building glibc 2.5 on linux ubuntu dapper

i can't install glibc 2.5 on ubuntu dapper 6.06, because, i thing something is missing in installation pack....
i can do it the "configure" whithout problems, but doing the "make" there is a file it can't find

please check the process....


root <at> oswaldo-pc:/home/oswaldo/Desktop# cd glibc-2.5
root <at> oswaldo-pc:/home/oswaldo/Desktop/glibc-2.5# cd glibc-build
root <at> oswaldo-pc:/home/oswaldo/Desktop/glibc-2.5/glibc-build# ../glibc- 2.5/configure --prefix=/tools \
>     --disable-profile --enable-add-ons \
>     --enable-kernel=2.6.0 --with-binutils=/tools/bin \
>     --without-gd --with-headers=/tools/include \
>     --without-selinux
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
configure: running configure fragment for add-on nptl
checking sysdep dirs... sysdeps/i386/elf nptl/sysdeps/unix/sysv/linux/i386/i686 nptl/sysdeps/unix/sysv/linux/i386 sysdeps/unix/sysv/linux/i386 nptl/sysdeps/unix/sysv/linux nptl/sysdeps/pthread sysdeps/pthread sysdeps/unix/sysv/linux sysdeps/gnu sysdeps/unix/common sysdeps/unix/mman sysdeps/unix/inet sysdeps/unix/sysv/i386 nptl/sysdeps/unix/sysv sysdeps/unix/sysv sysdeps/unix/i386 nptl/sysdeps/unix sysdeps/unix sysdeps/posix sysdeps/i386/i686/fpu nptl/sysdeps/i386/i686 sysdeps/i386/i686 sysdeps/i386/i486 nptl/sysdeps/i386/i486 sysdeps/i386/fpu nptl/sysdeps/i386 sysdeps/i386 sysdeps/wordsize-32 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/ieee754 sysdeps/generic/elf sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
../glibc-2.5/configure: line 3856: cd: /tools/bin: No such file or directory
checking for ranlib... ranlib
checking whether as is GNU as... yes
checking whether ld is GNU ld... yes
checking for as... as
checking version of as... 2.16.91, ok
checking for ld... ld
checking version of ld... 2.16.91, ok
checking for pwd... /bin/pwd
checking for gcc... gcc -B/home/oswaldo/Desktop/glibc- 2.5/glibc-build/
checking version of gcc -B/home/oswaldo/Desktop/glibc-2.5/glibc-build/... 4.0.3, ok
checking for gnumake... no
checking for gmake... no
checking for make... make
checking version of make... 3.81, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.14.5, ok
checking for makeinfo... no
checking for sed... sed
checking version of sed... 4.1.4, ok
checking for autoconf... autoconf
checking whether autoconf works... yes
configure: WARNING:
*** These auxiliary programs are missing or incompatible versions: makeinfo
*** some features will be disabled.
*** Check the INSTALL file for required versions.
checking whether ranlib is necessary... no
checking LD_LIBRARY_PATH variable... ok
checking whether GCC supports -static-libgcc... -static-libgcc
checking for bash... /bin/sh
checking for gawk... no
checking for mawk... mawk
checking for perl... /usr/bin/perl
checking for install-info... /usr/sbin/install-info
checking for bison... no
checking for signed size_t type... no
checking for libc-friendly stddef.h... yes
checking whether we need to use -P to assemble .S files... no
checking whether .text pseudo-op must be used... yes
checking for assembler global-symbol directive... .globl
checking for .set assembler directive... yes
checking for assembler .type directive prefix... <at>
checking for .symver assembler directive... yes
checking for ld --version-script... yes
checking for .previous assembler directive... yes
checking for .protected and .hidden assembler directive... yes
checking whether __attribute__((visibility())) is supported... yes
checking for broken __attribute__((visibility()))... no
checking for broken __attribute__((alias()))... no
checking whether to put _rtld_local into .sdata section... no
checking for .preinit_array/.init_array/.fini_array support... yes
checking for libunwind-support in compiler... no
checking for -z nodelete option... yes
checking for -z nodlopen option... yes
checking for -z initfirst option... yes
checking for -z relro option... yes
checking for -Bgroup option... yes
checking for libgcc_s suffix...
checking for --as-needed option... yes
checking whether --noexecstack is desirable for .S files... yes
checking for -z combreloc... yes
checking for -z execstack... yes
checking for -fpie... yes
checking for --hash-style option... no
checking for -fno-toplevel-reorder... no
checking for -fstack-protector... no
checking whether cc puts quotes around section names... no
checking for assembler .weak directive... yes
checking whether CFI directives are supported... yes
checking for ld --no-whole-archive... yes
checking for gcc -fexceptions... yes
checking for __builtin_expect... yes
checking for __builtin_memset... no
checking for redirection of built-in functions... yes
checking for __thread... yes
checking for tls_model attribute... yes
checking for libgd... no
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for long double... yes
checking size of long double... 12
running configure fragment for sysdeps/i386/elf
checking for i386 TLS support... yes
running configure fragment for nptl/sysdeps/pthread
checking for forced unwind support... yes
checking for C cleanup handling... yes
running configure fragment for sysdeps/pthread
running configure fragment for sysdeps/unix/sysv/linux
checking for egrep... (cached) grep -E
checking installed Linux kernel header files... TOO OLD!
configure: error: GNU libc requires kernel header files from
Linux 2.0.10 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 2.0.10 or later.  This check uses <linux/version.h>, so
make sure that file was built correctly when installing the kernel header
files.  To use kernel headers not from /usr/include/linux, use the
configure option --with-headers.
root <at> oswaldo-pc:/home/oswaldo/Desktop/glibc- 2.5/glibc-build# cd ../glibc-2.5
root <at> oswaldo-pc:/home/oswaldo/Desktop/glibc-2.5/glibc-2.5# make
Makeconfig:84: sysdeps/../config.make: No existe el fichero ó directorio
The GNU C library has not been configured.
Run `configure' to configure it before building.
Try `configure --help' for more details.
make: Fallo al reconstruir el makefile `sysdeps/../config.make'.
root <at> oswaldo-pc:/home/oswaldo/Desktop/glibc- 2.5/glibc-2.5#

i hope you realy can helpme...
thanks for any answer

_______________________________________________
bug-glibc mailing list
bug-glibc <at> gnu.org
http://lists.gnu.org/mailman/listinfo/bug-glibc
Mediatech | 19 Mar 15:07
Picon
Favicon

MAC OS X porting


Hello

I was attempting to install GLIBC on my Mac OS X 10.4 and received  
the following:

checking build system type... powerpc-apple-darwin8.8.0
checking host system type... powerpc-apple-darwin8.8.0
configure: running configure fragment for add-on nptl
*** The GNU C library is currently not available for this platform
*** So far nobody cared to port it and if there is no volunteer it
*** might never happen.  So, if you have interest to see glibc on
*** this platform visit
***     http://www.gnu.org/software/libc/porting.html
*** and join the group of porters

Unfortunately the URL http://www.gnu.org/software/libc/porting.html  
returns; Not Found

Any suggestions? Thanks in advance.

Rick

--
david | 3 Mar 19:54
Picon
Favicon

Enhancement to mtrace perl script

I have just spent a couple of days trying to puzzle out where all the memory went in a large
and complex application that crashed with "out of memory". It was a painful experience :-{

Lying in bed last night thought "there must be a better way" and went trawling in the linux
man pages. I came across mtrace and saw that the log mtrace made could also be used
to identify where all the memory was allocated.

I have thus enhanced the mtrace perl script adding a track of what the peak usage is and
the --peak option that additionally reports all the allocation locations that contribute to
that (those) peak(s). Here is a sample output for a very small test program:

~/mtrace --peak test_mtrace mtrace.txt
The peak allocation during this run was 3c0, (960) bytes

Memory not freed:
-----------------
           Address     Size             Caller
0x0000000000603460     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x0000000000603480     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x00000000006034a0     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x00000000006034c0     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x00000000006034e0     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x0000000000603500     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x0000000000603520     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x0000000000603540     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x0000000000603560     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x0000000000603580     0x10 (      16) at /home/david/projects/svn-general/trunk/test/../src/link_list.c:57
0x00000000006035a0    0x320 (     800) at /home/david/projects/svn-general/trunk/test/test_mtrace.c:46

At peak allocation - 3c0, (960) - these were the code locations where the memory was allocated.
Location                                                               bytes
/home/david/projects/svn-general/trunk/test/test_mtrace.c:46           320 (800) in 1 allocations
/home/david/projects/svn-general/trunk/test/../src/link_list.c:57      a0 (160) in 10 allocations

Caution: As yet this update has only had limited testing - I've not used it in anger yet! I would
appreciate any news of usage and any problems encountered.

This updated script  is donated to the GNU libC project and thus is released under the license of
the original script - see the code header.

GNU Libc maintainer: please consider incorporating this update in the next glibc release.

Farewell little script - I hope you can find your way in the world :^)
#! /usr/bin/perl
eval "exec /usr/bin/perl -S $0 $*"
    if 0;
# Copyright (C) 1997-2004, 2005, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper <at> gnu.org>, 1997.
# Based on the mtrace.awk script.

# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.

# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
#
# This script analyses the output from the GNU malloc module's mtrace function.
# It can help identify where memory is leaking. Additionally with the -peak
# option it can also identify where all the memory is being consumed at peak usage.
#
# History
# 2007-03-03 D.Ingamells Restructured code and added the -peak option.

use strict;

my $VERSION = "2.5";
my $PACKAGE = "libc";
my $progname = $0;

sub usage($)
{
    my $status = shift;

    print "Usage: mtrace [OPTION]... [Binary] MtraceData\n";
    print "  --help       print this help, then exit\n";
    print "  --version    print version number, then exit\n";
    print "  --peaks      also report allocations at peaks\n";
    print "\n";
    print "For bug reporting instructions, please see:\n";
    print "<http://www.gnu.org/software/libc/bugs.html>.\n";
    exit $status;
}

# We expect two arguments:
#   #1: the complete path to the binary
#   #2: the mtrace data filename
# The usual options are also recognized.

sub arglist(\@)
{
  my $ARGV = shift;
  my $peaks = 0;

    if ($ARGV->[0] =~ m/^--?v(e(r(s(i(o(n)?)?)?)?)?)?$/)
    {
        print "mtrace (GNU $PACKAGE) $VERSION\n";
        print "Copyright (C) 2006 Free Software Foundation, Inc.\n";
        print "This is free software; see the source for copying conditions.  There is NO\n";
        print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
        print "Written by Ulrich Drepper <drepper\@gnu.org>\n";

        exit 0;
    }
    elsif ($ARGV->[0] =~ m/^--?h(e(lp?)?)?$/)
    {
        usage 0;
    }
    elsif ($ARGV->[0] =~ m/^--?p(e(a(ks?)?)?)?$/)
    {
       $peaks = 1;
       shift @$ARGV;
    }
    elsif ($ARGV->[0] =~ /^-/)
    {
        print "$progname: unrecognized option `$ARGV->[0]'\n";
        print "Try `$progname --help' for more information.\n";
        exit 1;
    }
    else
    {
    }

    return $peaks;
}

##
# location function determines the source code the the given code address.
{
    my %cache;

    sub location($$\%)
    {
        my $str = shift;
        my $binary = shift;
        my $locs_hr = shift;

        return $str if ($str eq "");

        if ($str =~ /.*[[](0x[^]]*)]:(.)*/)
        {
            my $addr = $1;
            my $fct = $2;

            return $cache{$addr} if (exists $cache{$addr});

            if ($binary ne "" && open (ADDR, "addr2line -e $binary $addr|"))
            {
                my $line = <ADDR>;
                chomp $line;
                close (ADDR);
                if ($line ne '??:0')
                {
                    $cache{$addr} = $line;
                    return $cache{$addr};
                }
            }

            $cache{$addr} = $str = "$fct @ $addr";
        }
        elsif ($str =~ /^(.*):.*[[](0x[^]]*)]$/)
        {
            my $prog = $1;
            my $addr = $2;
            my $searchaddr;

            return $cache{$addr} if (exists $cache{$addr});

            if ($locs_hr->{$prog} ne "")
            {
                $searchaddr = sprintf "%#x", $addr - $locs_hr->{$prog};
            }
            else
            {
                $searchaddr = $addr;
                $prog = $binary;
            }

            if ($binary ne "" && open (ADDR, "addr2line -e $prog $searchaddr|"))
            {
                my $line = <ADDR>;
                chomp $line;
                close (ADDR);

                if ($line ne '??:0')
                {
                    $cache{$addr} = $line;
                    return $cache{$addr};
                }
            }

            $cache{$addr} = $str = $addr;
        }
        elsif ($str =~ /^.*[[](0x[^]]*)]$/)
        {
            my $addr = $1;

            return $cache{$addr} if (exists $cache{$addr});

            if ($binary ne "" && open (ADDR, "addr2line -e $binary $addr|"))
            {
                my $line = <ADDR>;
                chomp $line;
                close (ADDR);

                if ($line ne '??:0')
                {
                    $cache{$addr} = $line;
                    return $cache{$addr};
                }
            }

            $cache{$addr} = $str = $addr;
        }

        return $str;
    }
}

##
## Read all the command line arguments, act on any commands (like help and version)
## and return the remainder to the caller.
##

sub getArgs(\@)
{
    my $ARGV = shift;
    my $peaks = arglist(@$ARGV);

    my $data = $ARGV->[0];
    my $prog = "";

    if (1 == @$ARGV)
    {
      $data = $ARGV->[0];
    }
    elsif (2 == @$ARGV)
    {
        my $binary = $ARGV->[0];
        $data      = $ARGV->[1];

        if ($binary =~ /^.*[\/].*$/)
        {
          $prog = $binary;
        }
        else
        {
          $prog = "./$binary";
        }
    }
    else
    {
      die "Wrong number of arguments (" . scalar @ARGV . "), run $progname --help for help.";
    }

    return ($data, $prog, $peaks);
}

sub loadLocs($)
{
    my $prog = shift;
    my %locs;

    if ($prog && (open (LOCS, "env LD_TRACE_LOADED_OBJECTS=1 $prog |")))
    {
        while (my $l = <LOCS>)
        {
            chomp $l;
            if ($l =~ /^.*=> (.*) .(0x[0123456789abcdef]*).$/)
            {
                $locs{$1} = $2;
            }
        }

        close (LOCS);
    }

    return %locs;
}

sub findLeaks(\%\%\%$$)
{
    my $allocated_hr = shift;
    my $addrwas_hr   = shift;
    my $locs_hr      = shift;
    my $data         = shift;
    my $prog         = shift;

    my $currAllocated = 0;
    my $peakAllocated = 0;

    my $nr = 0;

    open(DATA, "< $data") || die "Cannot open mtrace data file";

    while (my $l = <DATA>)
    {
        chomp $l;

        my @cols = split / +/, $l;
        my $n;
        my $where;

        if ($cols[0] eq "@")
        {
            # We have address and/or function name.
            $where = $cols[1];
            $n = 2;
        }
        else
        {
            $where = "";
            $n = 0;
        }

        my $allocaddr = $cols[$n + 1];
        my $howmuch = hex($cols[$n + 2]);

        ++$nr;

        if ($cols[$n] eq "+")
        {
            # report of an allocation of memory.

            $currAllocated += $howmuch;
            $peakAllocated = $currAllocated if ($peakAllocated < $currAllocated);

            if (defined $allocated_hr->{$allocaddr})
            {
                printf ("+ %#018x Alloc %d duplicate: %s %s\n",
                        hex($allocaddr), $nr, location($addrwas_hr->{$allocaddr}, $prog, %$locs_hr),
                        $where);
            }
            else
            {
                $allocated_hr->{$allocaddr} = $howmuch;
                $addrwas_hr->{$allocaddr}   = $where;
            }
        }
        elsif ($cols[$n] eq "-")
        {
            # report of a free.

            $currAllocated -= $howmuch;

            if (defined $allocated_hr->{$allocaddr})
            {
                delete $allocated_hr->{$allocaddr};
                delete $addrwas_hr->{$allocaddr};
            }
            else
            {
                printf ("- %#018x Free %d was never alloc'd %s\n",
                        hex($allocaddr), $nr,
                        location($where, $prog, %$locs_hr));
            }
        }
        elsif ($cols[$n] eq "<")
        {
            # realloc release

            $currAllocated -=  $allocated_hr->{$allocaddr};

            if (defined $allocated_hr->{$allocaddr})
            {
                delete $allocated_hr->{$allocaddr};
                delete $addrwas_hr->{$allocaddr};
            }
            else
            {
                printf ("- %#018x Realloc %d was never alloc'd %s\n",
                        hex($allocaddr), $nr, location($where, $prog, %$locs_hr));
            }
        }
        elsif ($cols[$n] eq ">")
        {
            # realloc new allocation

            $currAllocated += $howmuch;
            $peakAllocated = $currAllocated if ($peakAllocated < $currAllocated);

            if (defined $allocated_hr->{$allocaddr})
            {
                printf ("+ %#018x Realloc %d duplicate: %#010x %s %s\n",
                        hex($allocaddr), $nr, $allocated_hr->{$allocaddr},
                        location($addrwas_hr->{$allocaddr}, $prog, %$locs_hr),
                        location($where, $prog, %$locs_hr));
            }
            else
            {
                $allocated_hr->{$allocaddr} = $howmuch;
                $addrwas_hr->{$allocaddr}   = $where;
            }
        }
        elsif ($cols[$n] eq "=")
        {
            # Ignore "= Start".
        }
        elsif ($cols[$n] eq "!")
        {
            # Ignore failed realloc for now.
        }
    }
    close (DATA);

    return $peakAllocated;
}

sub logAllocations(\%\%\%$$)
{
    my $whereUsed_hr = shift;
    my $whereCounts_hr = shift;
    my $locs_hr      = shift;
    my $prog         = shift;
    my $peakAllocated = shift;

    printf "\nAt peak allocation - %x, (%d) - these were the code locations where the memory was allocated.\n",
      $peakAllocated, $peakAllocated;

    printf "%-70s bytes\n", "Location";

    foreach my $k (sort keys %$whereUsed_hr)
    {
        printf("%-70s %x (%d) in %d allocations\n",
               location($k, $prog, %$locs_hr), $whereUsed_hr->{$k}, $whereUsed_hr->{$k},
               $whereCounts_hr->{$k});
    }

    print "\n";
}

sub reportPeaks($$$)
{
    my $data          = shift;
    my $prog          = shift;
    my $peakAllocated = shift;

    my %locs = loadLocs($prog);

    my %allocated;
    my %addrWas;
    my %whereUsed;
    my %whereCounts;

    my $currAllocated = 0;

#    my $nr = 0;

    open(DATA, "< $data") || die "Cannot open mtrace data file";

    while (my $l = <DATA>)
    {
        chomp $l;

        my @cols = split / +/, $l;
        my $n;
        my $where;

        if ($cols[0] eq "@")
        {
            # We have address and/or function name.
            $where = $cols[1];
            $n = 2;
        }
        else
        {
            $where = "";
            $n = 0;
        }

        my $allocaddr = $cols[$n + 1];
        my $howmuch = hex($cols[$n + 2]);

        if ($cols[$n] eq "+")
        {
            # report of an allocation of memory.

            if (!defined $allocated{$allocaddr})
            {
                $allocated{$allocaddr} = $howmuch;
                $addrWas{$allocaddr}   = $where;

                $whereUsed{$where} += $howmuch;
                $whereCounts{$where} ++;

                $currAllocated += $howmuch;

                logAllocations(%whereUsed, %whereCounts, %locs, $prog, $peakAllocated) if ($currAllocated >= $peakAllocated);

            }
        }
        elsif ($cols[$n] eq "-")
        {
            # report of a free.

            if (defined $allocated{$allocaddr})
            {
                $currAllocated -= $allocated{$allocaddr};

                $whereUsed{$addrWas{$allocaddr}} -= $allocated{$allocaddr};
                $whereCounts{$addrWas{$allocaddr}} --;

                delete  $whereUsed{$addrWas{$allocaddr}} if ($whereUsed{$addrWas{$allocaddr}} <= 0);
                delete $whereCounts{$addrWas{$allocaddr}} if (!defined $whereUsed{$addrWas{$allocaddr}});

                delete $allocated{$allocaddr};
                delete $addrWas{$allocaddr};
            }
        }
        elsif ($cols[$n] eq "<")
        {
            # realloc release

            if (defined $allocated{$allocaddr})
            {
                $currAllocated -=  $allocated{$allocaddr};

                $whereUsed{$addrWas{$allocaddr}} -= $allocated{$allocaddr};
                $whereCounts{$addrWas{$allocaddr}} --;

                delete $whereUsed{$addrWas{$allocaddr}} if ($whereUsed{$addrWas{$allocaddr}} <= 0);
                delete $whereCounts{$addrWas{$allocaddr}} if (!defined $whereUsed{$addrWas{$allocaddr}});

                delete $allocated{$allocaddr};
                delete $addrWas{$allocaddr};
            }
        }
        elsif ($cols[$n] eq ">")
        {
            # realloc new allocation

            if (!defined $allocated{$allocaddr})
            {
                $whereUsed{$where} += $howmuch;
                $whereCounts{$where} ++;
                $allocated{$allocaddr} = $howmuch;
                $addrWas{$allocaddr}   = $where;

                $currAllocated += $howmuch;

                logAllocations(%whereUsed, %whereCounts, %locs, $prog, $peakAllocated) if ($currAllocated >= $peakAllocated);

            }
        }
        elsif ($cols[$n] eq "=")
        {
            # Ignore "= Start".
        }
        elsif ($cols[$n] eq "!")
        {
            # Ignore failed realloc for now.
        }
    }
    close (DATA);
}

sub logLeaks(\%\%\%$)
{
    my $allocated_hr = shift;
    my $addrwas_hr   = shift;
    my $locs_hr      = shift;
    my $prog         = shift;

    my $anything = 0;

    if (%$allocated_hr >= 0)
    {
        foreach my $addr (sort keys %$allocated_hr)
        {
            if (defined $allocated_hr->{$addr})
            {
                if ($anything == 0)
                {
                    print "\nMemory not freed:\n-----------------\n";
                    print ' ' x (18 - 7), "Address     Size             Caller\n";
                    $anything = 1;
                }

                printf ("%#018x %#8x (%#8d) at %s\n", hex($addr), $allocated_hr->{$addr},
                        $allocated_hr->{$addr}, location($addrwas_hr->{$addr}, $prog, %$locs_hr));
            }
        }
    }

    print "No memory leaks.\n" if ($anything == 0);

    return $anything;
}

sub reportLeaks($$)
{
    my $data          = shift;
    my $prog          = shift;

    my %locs = loadLocs($prog);

    my %allocated;
    my %addrwas;

    my $peakAllocated = findLeaks(%allocated, %addrwas, %locs, $data, $prog);

    printf ("The peak allocation during this run was %x, (%d) bytes\n",
            $peakAllocated, $peakAllocated);

    # Now print all remaining entries.

    my $anythingFound = logLeaks(%allocated, %addrwas, %locs, $prog);

    return ($peakAllocated, $anythingFound);
}

sub main()
{
    my ($data, $prog, $peaks) = getArgs(@ARGV);

    my ($peakAllocated, $anythingFound) = reportLeaks($data, $prog);

    reportPeaks($data, $prog, $peakAllocated) if ($peaks);

    exit $anythingFound != 0;
}

main;
_______________________________________________
bug-glibc mailing list
bug-glibc <at> gnu.org
http://lists.gnu.org/mailman/listinfo/bug-glibc
Gary Gee Kien Lum | 21 Feb 06:54
Favicon

Glibc port to FreeBSD

GNU,

I am interested in porting Glibc-2.3.6 to FreeBSD-6.0, and I need your advise. 
After downloading the software, I configured the package using the --enable-hacker-mode option. The
configure ran successfully.
However, when I tried to make, I got the error indicated in the partial make output shown below:

...
\
                             sed -e 's/"\([^"]*\)".*/\1/p' -e d) 2>/dev/null`;\
                   if [ -z "$version" ]; then \
                     if [ -r /proc/version ]; then \
                       version=`sed 's/.*Linux version \([^ ]*\) .*/>>\1<</' \
                                < /proc/version`; \
                     else \
                       version=`uname -r`; \
                     fi; \
                   fi; \
                   os=`uname -s 2> /dev/null`; \
                   if [ -z "$os" ]; then \
                     os=Linux; \
                   fi; \
                   printf '"Compiled on a %s %s system on %s.\\n"\n' \
                          "$os" "$version" "`date +%Y-%m-%d`";; \
           *) ;; \
         esac; \
         files="../libio/Banner ../crypt/Banner ../nptl/Banner ../resolv/Banner ../nis/Banner";                         \
         if test -n "$files"; then                              \
           echo "\"Available extensions:\\n\"";                 \
           sed -e '/^#/d' -e 's/^[[:space:]]*/  /'              \
               -e 's/^\(.*\)$/\"\1\\n\"/' $files;               \
         fi) > /usr/local/src/glibc-build/csu/version-info.hT
mv -f /usr/local/src/glibc-build/csu/version-info.hT /usr/local/src/glibc-build/csu/version-info.h
.././scripts/mkinstalldirs /usr/local/src/glibc-build/csu
rm -f /usr/local/src/glibc-build/csu/abi-tag.h.new
sed -e 's/#.*$//' -e '/^[       ]*$/d' ../abi-tags | \
        while read conf tagos tagver; do \
          test `expr 'i386-unknown-freebsd6.0' \
                     : "$conf"` != 0 || continue; \
          ( echo "$tagos" | \
            sed -e 's/[^0-9xXa-fA-F     ]//' \
                -e 's/^/#define __ABI_TAG_OS /'; \
            echo "#ifndef __ABI_TAG_VERSION"; \
            echo "$tagver" | \
            sed -e 's/[^0-9xXa-fA-F]/ /g' -e 's/ *$//' \
              -e 's/ /,/g' -e 's/^/# define __ABI_TAG_VERSION /'; \
            echo "#endif" ) > /usr/local/src/glibc-build/csu/abi-tag.h.new; \
        done
if test -r /usr/local/src/glibc-build/csu/abi-tag.h.new; then mv -f
/usr/local/src/glibc-build/csu/abi-tag.h.new /usr/local/src/glibc-build/csu/abi-tag.h; \
        else echo >&2 'This configuration not matched in ../abi-tags'; exit 1; fi
This configuration not matched in ../abi-tags
make[2]: *** [/usr/local/src/glibc-build/csu/abi-tag.h] Error 1
make[2]: Leaving directory `/usr/local/src/glibc-2.3.6/csu'
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory `/usr/local/src/glibc-2.3.6'
make: *** [all] Error 2
/usr/local/src/glibc-build #

Please advise to e-mail address shown below;

glum <at> hawaii.edu

Thank you for your time,

Gary G. K. Lum
Dept. of Chemistry,
University of Hawaii, Manoa
T.J. Duchene | 14 Feb 17:35

Glibc page update

Please excuse me,  but the FSF gnu.org glibc webpage is out of date.  
The version listed is 2.4 when according to the FSF, the current version 
is 2.5.  Could you please update them?

If you need help,  I'd be happy to lend a hand.  I'm a big fan of your 
efforts and want to help if possible.

Thanks
T.J. Duchene
Raman M | 2 Feb 12:17
Picon
Favicon

error installing glibc; need help

Hello,
I get the following error when I issue make install command after a 
successful configure

it is glibc-2.5 (I get the same error on glibc-2.4 as well)

cd /root/debs/extracts/glibcObj && ar cruv libc_nonshared.a `cat stamp.oS`
: /root/debs/extracts/glibcObj/libc_nonshared.a
make[1]: *** No rule to make target 
`/root/debs/extracts/glibcObj/Versions.all', needed by 
`/root/debs/extracts/glibcObj/abi-versions.h'.  Stop.
make[1]: Leaving directory `/root/debs/extracts/glibc-2.5'
make: *** [all] Error 2

[
I tried this because when I tried installing glib (for gtk), i got the 
following error
*** You must have either have gettext support in your C library, or use the
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
]

appreciate any help in getting over this hurdle.

thanks
Raman

_________________________________________________________________
Tried the new MSN Messenger? It’s cool! Download now. 
http://messenger.msn.com/Download/Default.aspx?mkt=en-in

Gmane