Linux-Development-Apps Digest #576, Volume #6     Wed, 3 May 00 05:13:08 EDT

Contents:
  Questions on Priority in Traffic Control(QoS) ([EMAIL PROTECTED])
  Re: Creating a non-blocking socket ("Paul Richards (Pauldoo)")
  Re: How to get the execution directory at runtime (Thomas Zajic)
  Re: How to get timezone information (Paul Kimoto)
  Linux console termcap and line drawing errors (John Hardin)
  how to create child window in gtk+/gtk-- ? (Felix Natter)
  Work experience ("Gary Fisher")
  01 Help or advice ("Hal Evans")
  GCC 2.95.2 & Shared libraries ("Benoît Smith")
  Re: mySQL (Rob)
  Re: GCC 2.95.2 & Shared libraries (Felix Natter)
  Correctness of name conversion ([EMAIL PROTECTED])
  Re: Strange bug when using ElectricFence with C++ program (Eugene Morozov)
  Wait for multiple objects ? ("Hubert")
  Re: Wait for multiple objects ? (Kalle Olavi Niemitalo)
  mulaw 8-bit to linear 8-bit conversion (nag)
  Re: porting lilo (Villy Kruse)
  help ?! Need function in struct.????? (Bonny Gijzen)
  Re: Wrinting A Function Like DelTree ("AnonymousCoward")
  MALLOC_CHECK-Question (Martin Taendl)
  getcwd() newbie question (Nicola Attico)
  Re: How portable is ftruncate ("Jean-Francois Monestier")
  Re: MALLOC_CHECK-Question (Wolfram Gloger)

----------------------------------------------------------------------------

From: [EMAIL PROTECTED]
Subject: Questions on Priority in Traffic Control(QoS)
Date: Tue, 02 May 2000 21:20:56 GMT

Hi, All

When doing experiments on Linux Traffic Control, I run into
some problems. One of them is that I can't see the priorities o
f classes affect their queuing delays.

The following is my testbed:

192.168.3.x
==========>flow 3
=======      Linux Router
       |------++++++++++ 172.16.79.123
         eth1 +        + -------
         eth2 +        + eth0
       |------++++++++++
=======
192.168.2.x
==========>flow 2

All the tc commands are:

#Attaching the Qdisc to the eth0 device.
#The maximum available bandwidth is 10M bit.
tc qdisc add dev eth0 root handle 1: cbq bandwidth 10Mbit \
cell 8 avpkt 1000 mpu 64

#Adding the root class to the queuing discipline.
#The root has 10Mbit completely
tc class add dev eth0 parent 1:0 classid 1:1 \
cbq bandwidth 10Mbit rate 10Mbit \
allot 1514 cell 8 weight 100Kbit prio 8 maxburst 20 avpkt 1000 bounded

#Traffic from 192.168.2.1. The priority is 1 and the allocation is 5Mbit
tc class add dev eth0 parent 1:1 classid 1:2 \
cbq bandwidth 10Mbit rate 5Mbit \
allot 1514 cell 8 weight 50Kbit prio 1 maxburst 20 avpkt 1000

#Traffic from 192.168.3.1. The priority is 8 and the allocation is 5Mbit
tc class add dev eth0 parent 1:1 classid 1:3 \
cbq bandwidth 10Mbit rate 5Mbit \
allot 1514 cell 8 weight 50Kbit prio 8 maxburst 20 avpkt 1000

#Installing the u32 classifier/filter on the root of the link sharing
tree
tc filter add dev eth0 parent 1:0 protocol ip prio 20 \
u32 match ip src 192.168.2.0/24 flowid 1:2
tc filter add dev eth0 parent 1:0 protocol ip prio 100 \
u32 match ip src 192.168.3.0/24 flowid 1:3


I injected two UDP traffic flows into eth1 and eth2 respectively.
The sending rate of flow 3 going into eth2 is more than 10Mbps
(more than its allocated rate 5Mbps) and the purpose is to flood
the total available bandwidth. The sending rate of flow 2 going into
eth1 is around 32kbps (less than its allocated rate 5Mbps)
Obviously, flow 3 can borrow bandwidth from flow 2.
However, the queuing delay of flow 2 should NOT be affected by
flow 3, although it can lend bandwidth to flow 3, when the priority
of flow 2 is higher than that of flow 3.( This is my expectation) .
So I made the priority assignment in both 'class' and 'filter' different
(refer to above tc commands)for flow 2 and 3.

Unfortunately, the measurement data shows that the queuing delay
of flow 2 is still affected by flow 3 even if the priority of
flow 2 is higher than that of flow 3. The strange thing was that
if I made the priority assignment the same, the queueing delay
of flow 2 is the same as the case in which the priority of flow 2
is higher. So my question is that,
why the priority assignment in 'tc' doesn't work?

Another problem is about 'allot 1514'. I can't change this
mtu setting to be less than 1500. Say, I set allot to be 200,
tc will automatically change it back to 1500.


Could please give me some hints?
Thanks a lot!

Sincerely,
Song



Sent via Deja.com http://www.deja.com/
Before you buy.

------------------------------

From: "Paul Richards (Pauldoo)" <[EMAIL PROTECTED]>
Subject: Re: Creating a non-blocking socket
Date: Tue, 02 May 2000 19:33:28 +0000

Tobias Anderberg wrote:
> 
> Paul Richards (Pauldoo) <[EMAIL PROTECTED]>, wrote:
> >Hi,
> >To create a non-blocking file descriptor you use open("filename",
> >O_NONBLOCK) right?
> >
> >Well since you use socket() to return a file descriptor for a socket,
> >where do you put the O_NONBLOCK?
> 
> You use fcntl() with the flag O_NONBLOCK.

Cheers
-- 
Paul Richards (Pauldoo) - http://www.pauldoo.co.uk

I've not run any Microsoft code for 156 days.
    How about you?

------------------------------

From: [EMAIL PROTECTED] (Thomas Zajic)
Subject: Re: How to get the execution directory at runtime
Reply-To: [EMAIL PROTECTED] (Thomas Zajic)
Date: Tue, 02 May 2000 22:25:05 GMT

On Tue, 2 May 2000 13:26:32 -0700, Norman Black wrote:

> > The system configurations go in /etc/program-name/ according to
> > the File System Standard.
> 
> Where can I read about this File System standard, it sounds like I
> need to. I assume the standard says something about file name clashes
> since it is mandating stuff go into a common directory, /etc/xxx.

<http://www.pathname.com/fhs/>

HTH,
Thomas
-- 
=-------------------------------------------------------------------------=
-   Thomas "ZlatkO" Zajic   <[EMAIL PROTECTED]>   Linux-2.0.38/slrn-0.9.6.2   -
-  "It is not easy to cut through a human head with a hacksaw."  (M. C.)  -
=-------------------------------------------------------------------------=

------------------------------

From: [EMAIL PROTECTED] (Paul Kimoto)
Subject: Re: How to get timezone information
Date: 2 May 2000 19:30:34 -0500
Reply-To: [EMAIL PROTECTED]

In article <8end6h$8h8$[EMAIL PROTECTED]>, Norman Black wrote:
>                      I did see
> some variables in the header file(s) about timezones, including exactly what
> I wanted, but they did not seem to be POSIX. Since Linux is my first port of
> two, and possibly others, I am trying to be very strict Posix/Xopen and then
> succumb to Gnu(libc) or system specifics.

In addition to the GNU libc info pages, this documentation (from the GNU
libc web pages) might interest you:

http://www.gnu.ai.mit.edu/software/libc/glibc-idx.html

-- 
Paul Kimoto             <[EMAIL PROTECTED]>

------------------------------

From: John Hardin <[EMAIL PROTECTED]>
Crossposted-To: comp.databases.informix
Subject: Linux console termcap and line drawing errors
Date: Tue, 02 May 2000 15:57:41 -0700

Several curses applications compiled under Linux (most notably menuing
programs) don't draw line graphics properly - if the application
attempts to display a line of text, followed by whitespace (tabs &
spaces), followed by a line drawing character, the tabs and spaces are
drawn in the alternate character set.

Does anybody know whether this is a problem with the termcap entry, or a
problem in the termcap or curses libraries, or a problem in the kernel
console driver?

How can I fix this?

Thanks.

--
        John Hardin
        Internal Systems Administrator
        Apropos Retail Management Systems, Inc.
        <[EMAIL PROTECTED]>

------------------------------

From: Felix Natter <[EMAIL PROTECTED]>
Subject: how to create child window in gtk+/gtk-- ?
Date: 03 May 2000 01:44:52 +0200

hi,

in a simple gtk-- (gtk+ C++-bindings) program, I created a window by
deriving Gtk::Window, added two buttons in a ButtonBox to it and then
showed it. This works.

In the main window's constructor I then created another window, added a button
to it, and tried to display it, but it never appears.

in that window's constructor, I just do

SomeWindow() : button("some button")
{
        add(button);
        show_all();
}

what am I missing ?

thanks,

-- 
Felix Natter

------------------------------

From: "Gary Fisher" <[EMAIL PROTECTED]>
Subject: Work experience
Date: Wed, 3 May 2000 01:00:45 +0100

I am a 20 year old student who is just away to complete a HNC in computing.
I am going to University next year to do a degree in Computing.
My current course ends at the beginning of June and I have 3 months to spare
in the summer. I was wondering if anyone knew of any companies or where
involved in any companies that would be able to give me a work placement or
a short term working contract for a period during this time.
I live in Aberdeen.

During my HNC I have completed the following modules:

Information technology applications (Word, Excel, Access etc.)
Stand alone computer systems software support
Information systems and services
Software development - Life cycle
Software development - Procedural languages
Computer architecture
Maths for computing
Data communications
Publishing on the Internet
Intro to the Internet
Communications
Developing personal effectiveness
Systems development

Gary Fisher.   [EMAIL PROTECTED]








------------------------------

From: "Hal Evans" <Fred@Fish>
Subject: 01 Help or advice
Date: Wed, 3 May 2000 00:55:52 +0100

Excuse me if this is posted in the wrong NG and if so please point me in the
right direction:

I have just discovered the implications of the Linux open source revolution
and being a champion of noble software (I develop open source data
applications, sadly for MS windows consumption), see a gaping need for a few
smart guys to develop an open application:

I need an open source GIS/mapping server.

The sophistication and ability of the open source society is staggering and
I know that there will be a bright crew out there who can help.

If anyone would like to discuss this or knows of anyone in the GIS/mapping
world I would be for ever in your debt (well until we' made the first
million).

This is a serious request and any advice or references would be very much
appreciated.

TIA

Hal Evans

[EMAIL PROTECTED]




------------------------------

From: "Benoît Smith" <[EMAIL PROTECTED]>
Subject: GCC 2.95.2 & Shared libraries
Date: Wed, 3 May 2000 01:53:40 +0200

Greetings,

I recently installed GCC 2.95.2. But when I tried to compile some source
code with it, some shared libraries (libstdc++-...) included within GCC were
not found !

Could someone tell me how I should have installed GCC so that the dynamic
linker kept working fine ?

NB: I use Slackware 7.0. I don't know if this matters, but in case...

--
Benoît Smith



------------------------------

From: [EMAIL PROTECTED] (Rob)
Subject: Re: mySQL
Date: Tue, 02 May 2000 23:46:25 GMT


The distribution for mySQL has some good sample code.
you might wanna do a search for "mysql tutorial" on a search site
there are tons, im sure..

There is a book, called "MySQL" by Paul DuBois.
I found this book very good, with good tutorials on using mySQL,
commands, and even goes through all the API's 

Here's a breif chapter summary of it...

Section I - General MySQL use
1. Intro to mysql and sql
2. Working with data in mysql
3. mysql sql syntax and use
4. Query Optimization
Section 2 - using mysql programming interfaces
5. Intro to mysql programming
6. C api
7. Perl DBI api
8. PHP Api
Section 3 - Mysql Administration
9. Intro to mysql admin
10. mysql data directory
11. general mysql administration
12. security
13. database management and repair

then a bunch of appendices and reference material for all api's



On Sat, 29 Apr 2000 10:56:30 GMT, Philip <[EMAIL PROTECTED]> wrote:

>Where can I find any documentation/tools/etc on using mySQL in my own
>applications. I don't find a lot on mysql.org :(  for C++ I did found a
>few things however ...
>
>OS: Linux 2.2.14
>Compiler : gcc (program language c -duh-)
>
>
>-- 
>Philip van Hoof aka freax         _/_/_/                               
>http://users.pandora.be/skatan  _/_/  _/ _/_/   _/_/_/    _/_/   _/   _/
>mailto:[EMAIL PROTECTED]        _/_/     _/ _/  _/       _/  _/   _/  _/ 
>Microsoft OS are bad, and   _/_/_/_/   _/  _/ _/_/    _/_/_/_/   _/_/   
>their morals are even worse  _/_/     _/     _/      _/    _/  _/  _/   
>(Linus Torvalds 8 Sept.1996)_/_/     _/      _/_/_/ _/    _/ _/     _/


------------------------------

From: Felix Natter <[EMAIL PROTECTED]>
Subject: Re: GCC 2.95.2 & Shared libraries
Date: 03 May 2000 02:35:57 +0200

"Benoît Smith" <[EMAIL PROTECTED]> writes:

> Greetings,
> 
> I recently installed GCC 2.95.2. But when I tried to compile some source
> code with it, some shared libraries (libstdc++-...) included within GCC were
> not found !
> 
> Could someone tell me how I should have installed GCC so that the dynamic
> linker kept working fine ?

assuming this is linux, add a line containing 'prefix/lib' to /etc/ld.so.conf
or remove libstdc++-<version>.so from prefix/lib (warning: this will cause
all of your programs to link libstdc++ statically!).
[prefix is the --prefix for your gcc, i.e. /usr/local/newgcc]

-- 
Felix Natter

------------------------------

From: [EMAIL PROTECTED]
Subject: Correctness of name conversion
Date: Wed, 03 May 2000 02:39:10 GMT

Hi,

I needed to convert a host name to an IP, and after figuring out that
h_addr_list is defined as char * for historical reasons, and that it
really points to an struct in_addr, I came up with the following:

printf("%s\n", inet_ntoa((*(struct in_addr *)foo->h_addr_list[0]))));

Which seems to work.  But, it looks suspecious.. is it correct?  I
noticed -Unix Network Programming- uses inet_ntop, but it is not
documented on my system (I tried man and info.. I'm using Red Hat 6.1).

Also, am I overusing paranthesis or can that not be simplified anymore?
Any other flaws with it?

Thanks,
 -- John


Sent via Deja.com http://www.deja.com/
Before you buy.

------------------------------

From: Eugene Morozov <[EMAIL PROTECTED]>
Subject: Re: Strange bug when using ElectricFence with C++ program
Date: 03 May 2000 08:07:08 +0400

[EMAIL PROTECTED] (Kaz Kylheku) writes:

> 
> I think that the exception handling logic is trying do do the equivalent of:
> 
>     malloc(0);
I just can't undestand why it happens only if I called gethostbyname
before throwing an exception.  
Eugene

-- 
Email: <jmv @ lucifer dorms spbu ru> Homepage: http://lucifer.dorms.spbu.ru

------------------------------

From: "Hubert" <[EMAIL PROTECTED]>
Subject: Wait for multiple objects ?
Date: Wed, 3 May 2000 09:07:09 +0200

Hi,

I try to port some code from windows to linux. In that code I use alot of
events and WaitForMultipleObjects().

Is it possible for a program running on linux to wait for multiple objects
like it is possible for windows programs?

Thanks
Hubert



------------------------------

From: Kalle Olavi Niemitalo <[EMAIL PROTECTED]>
Subject: Re: Wait for multiple objects ?
Date: 03 May 2000 10:24:08 +0300

Try select() or poll().

------------------------------

From: nag <[EMAIL PROTECTED]>
Subject: mulaw 8-bit to linear 8-bit conversion
Date: Wed, 03 May 2000 07:30:03 GMT


hi to all..

how to convert mulaw 8-bit to linear 8-bit format and viseversa.
help me providing conversion formula or table.

looking for u'r response,
nag.




--
Posted via CNET Help.com
http://www.help.com/

------------------------------

From: [EMAIL PROTECTED] (Villy Kruse)
Subject: Re: porting lilo
Date: 3 May 2000 07:43:56 GMT

On 02 May 2000 08:49:42 -0400, Eric P. McCoy <[EMAIL PROTECTED]> wrote:

>
>NT cleverly takes this a step further by also having a mini-SCSI
>driver, if necessary.  Is it still completely impossible to boot from
>a SCSI drive with Linux?
>


So how come my old 486 system using an Adaptec SCSI controller with
only SCSI disk units never had any problems booting linux?


Of course that is not a mystery as the Adaptec installs an BIOS extender
that implements int13 with unit 80 being the first SCSI disk, and that
is all LILO requires for booting an OS.


Villy

------------------------------

From: Bonny Gijzen <[EMAIL PROTECTED]>
Subject: help ?! Need function in struct.?????
Date: Wed, 03 May 2000 09:58:01 -0400

    Hello,

I want to use a function in a struct :

struct _Appstruct
{
    char *Name;
    void SomeFunction();

}

Then I could use :

App->SomeFunction();

I know this is possible in a class, but I'm using C so ????????

Regards Bonny Gijzen,


------------------------------

From: "AnonymousCoward" <[EMAIL PROTECTED]>
Subject: Re: Wrinting A Function Like DelTree
Date: Wed, 3 May 2000 04:02:06 -0400

What's wrong with this program?  Oh man.  What's wrong with you?  Goto
statements?  Spaghetti code is out man.  Nowadays, us programmers, we use
things like functions and objects.  Maybe you should run back to GW-BASIC
until you figure out how to use UNIX, Linux, and C......(and yes, this
includes knowing how to use the rm command.)

-AC




------------------------------

From: Martin Taendl <[EMAIL PROTECTED]>
Subject: MALLOC_CHECK-Question
Date: 3 May 2000 08:26:09 GMT

 Hello !

 I wrote a program which crashes with a Segfault which occurs
 in malloc. (bad enough)

 Of course I know that this is very probably a bug in my program.

 So I set the MALLOC_CHECK_- Variable to 1 and started the program
 again.

 The Segfault was gone, 
 
 "malloc: using debugging hooks"  was written at program-startup
 but no further information was printed. 

 Why ?? I assume that malloc or free or realloc worked differently,
 otherwise the program had crashed. So it should be possible to
 write this difference to stderr, as promised in the man-page.

 Another Question: Does libc5 use this "safe implementation" of malloc all
 the time, even if MALLOC_CHECK_ isn't set ??
 (I didn't get the Segfault with libc5)

 * I compiled with egcs-2.91.6,
 * linked with libc.so.6 -> libc-2.1.3.so


 Many thanks in advance

 Martin 

-- 
______________________________________________________________________________
 Martin TAENDL                                        [EMAIL PROTECTED]
 Die Y2K-Katastrophe ist eingetreten:    Silvesterstadl

------------------------------

From: Nicola Attico <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.system
Subject: getcwd() newbie question
Date: Wed, 3 May 2000 10:58:18 +0200



Hello Linux developers!


I'm trying to understand system calls and I've
this problem (maybe stupid).
I'm running Red Hat Linux 6.1 and I would like
to understand how the getcwd() call (only one among the
others!) to obtain the
current working directory of a process works.
I've installed the version 2 of glibc as showed by
rpm:

[nicola@c1p8 nicola]$ rpm -q glibc
glibc-2.1.2-11

In the GNU libc reference manual (available at
http://www.gnu.org, p. 181) the following prototype
of getcwd() is declared:

char *getcwd(char *buffer,size_t size)

where buffer is the string where you want to store the
current working directory and size is the number of
bytes you want to use for that (size_t is just the same
that unsigned int).

Now I wrote the following stupid (but maybe wrong) C code
to implement it:

#include <unistd.h>
int main()
{
char buffer[10];
getcwd(buffer, 10);
printf("%s\n",buffer);
}

I compile with gcc:

{
Incidentally I've the following version:=20
[nicola@c1p8 nicola]$ rpm -q egcs     =20
egcs-1.1.2-24
}

using:=20

[nicola@c1p8 nicola]$ gcc getcwd.c=20

and all seems work fine, but when I run:

[nicola@c1p8 nicola]$ ./a.out
x=FC=FF=BF=EB@

=2E..I obtain only garbage!
So, why that? I've not great experience in C programming,
so maybe I'm doing some very trivial error!

Any suggestion will be greatly appreciated,

Thanks,

# Nicola


------------------------------

From: "Jean-Francois Monestier" <[EMAIL PROTECTED]>
Subject: Re: How portable is ftruncate
Date: Wed, 3 May 2000 10:55:11 +0200

>Anyone know about
>Solaris
>AIX
>HP-UX

Hi

You'll find hereafter the man page for ftruncate taken from an HP-UX 10.20
box.

N.B. Note the HP-UX specifics.


Hope this helps,
Jean-Francois.




truncate(2)                                                     truncate(2)




 NAME
      ftruncate, truncate - truncate a file to a specified length

 SYNOPSIS
      #include <unistd.h>

      int ftruncate(int fildes, off_t length);

      int truncate(const char *path, off_t length);

 DESCRIPTION
      The ftruncate() function causes the regular file referenced by fildes
      to have a size of length bytes.

      The truncate() function causes the regular file named by path to have
      a size of length bytes.

      The effect of ftruncate() and truncate() on other types of files is
      unspecified. If the file previously was larger than length, the extra
      data is lost. If it was previously shorter than length, bytes between
      the old and new lengths are read as zeroes. With ftruncate(), the file
      must be open for writing; for truncate(), the process must have write
      permission for the file.

      If the request would cause the file size to exceed the soft file size
      limit for the process, the request will fail and the implementation
      will generate the SIGXFSZ signal for the process.

      These functions do not modify the file offset for any open file
      descriptions associated with the file.  On successful completion, if
      the file size is changed, these functions will mark for update the
      st_ctime and st_mtime fields of the file, and if the file is a regular
      file, the S_ISUID and S_ISGID bits of the file mode may be cleared.

 RETURN VALUE
      Upon successful completion, ftruncate()and truncate() returns 0.
      Otherwise a -1 is returned, and errno is set to indicate the error.

 ERRORS
      The ftruncate() and truncate() functions will fail if:

           [EINTR]                  A signal was caught during execution.

           [EINVAL]                 The length argument was less than 0.

           [EFBIG] or [EINVAL]      The length argument was greater than the
                                    maximum file size.

           [EIO]                    An I/O error occurred while  reading
                                    from or writing to a file system.


 Hewlett-Packard Company            - 1 -    HP-UX Release 10.20:  July 1996


 truncate(2)                                                     truncate(2)


      The ftruncate() function will fail if:

           [EBADF] or [EINVAL]      The fildes argument is not a file
                                    descriptor open for writing.

           [EINVAL]                 The fildes argument references a file
                                    that was opened without write
                                    permission.

      The truncate() function will fail if:

           [EACCES]                 A component of the path prefix denies
                                    search permission, or write permission
                                    is denied on the file.

           [EISDIR]                 The named file is a directory.

           [ELOOP]                  Too many symbolic links were encountered
                                    in resolving path.

           [ENAMETOOLONG]           The length of the specified pathname
                                    exceeds PATH_MAX bytes, or the length of
                                    a component of the pathname exceeds
                                    NAME_MAX bytes.

           [ENOENT]                 A component of path does not name an
                                    existing file or path is an empty
                                    string.

           [ENOTDIR]                A component of the path prefix of path
                                    is not a directory.

           [EROFS]                  The named file resides on a read-only
                                    file system.

      The truncate() function may fail if:

           [ENAMETOOLONG]           Pathname resolution of a symbolic link
                                    produced an intermediate result whose
                                    length exceeds {PATH_MAX}.

 SEE ALSO
      open(), <unistd.h>.

 CHANGE HISTORY
      First released in Issue 4, Version 2.


                                    - 2 -            Formatted:  May 3, 2000


 ftruncate()                                                     ftruncate()


                                 HP-UX EXTENSIONS


 SYNOPSIS
      int truncate(const char *path, size_t length);

      int ftruncate(int fildes, size_t length);

 ERRORS
      If truncate() fails, errno is set to one of the following values:

           [EACCES]       MAC access is denied on the file.

           [EDQUOT]       The user's disk quota block limit has been reached
                          for this file system.

           [EFAULT]       path points outside the process's allocated
                          address space. The reliable detection of this
                          error is implementation dependent.

           [EINVAL]       length was greater than the maximum file size.

           [ETXTBSY]      The file is a pure procedure (shared text) file
                          that is being executed.

      If ftruncate() fails, errno is set to one of the following values:

           [EDQUOT]       The user's disk quota block limit has been reached
                          for this file system.

 AUTHOR
      truncate() was developed by the University of California, Berkeley.

 SEE ALSO
      ftruncate64(2), open(2), truncate64(2).

 STANDARDS CONFORMANCE
      truncate(): AES ftruncate(): AES, SVID3




 Hewlett-Packard Company            - 1 -    HP-UX Release 10.20:  July 1996





------------------------------

From: Wolfram Gloger <[EMAIL PROTECTED]>
Subject: Re: MALLOC_CHECK-Question
Date: 03 May 2000 11:03:14 +0200

Martin Taendl <[EMAIL PROTECTED]> writes:

>  I wrote a program which crashes with a Segfault which occurs
>  in malloc. (bad enough)
> 
>  Of course I know that this is very probably a bug in my program.
> 
>  So I set the MALLOC_CHECK_- Variable to 1 and started the program
>  again.
> 
>  The Segfault was gone, 
>  
>  "malloc: using debugging hooks"  was written at program-startup
>  but no further information was printed. 
> 
>  Why ?? I assume that malloc or free or realloc worked differently,
>  otherwise the program had crashed.

Yes, this is possible.  When MALLOC_CHECK_ is set, there is a hidden
overhead of one additional byte per allocated chunk (such that the
most common error, overruns, can be detected), so the whole allocation
pattern (and therefore the ordering of chunks in memory) becomes
different.

>  So it should be possible to
>  write this difference to stderr, as promised in the man-page.

Sorry, I don't quite understand this.  Anyway, MALLOC_CHECK_ cannot
detect all errors, unfortunately, only the most common ones.  On the
plus side, it is very fast, though, almost as fast as the regular
malloc.

You could try ElectricFence; that can also detect underruns and
references to freed memory.  But it is considerably slower than
standard malloc and requires much more memory.

>  Another Question: Does libc5 use this "safe implementation" of malloc all
>  the time, even if MALLOC_CHECK_ isn't set ??

No.

>  (I didn't get the Segfault with libc5)

The allocation pattern is probably different than with libc6, so the
error may be hidden, too.

Regards,
Wolfram.

------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list (and comp.os.linux.development.apps) via:

    Internet: [EMAIL PROTECTED]

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-Apps Digest
******************************

Reply via email to