Re: kalloc.c and recent gcc's

2005-09-19 Thread Alfred M\. Szmidt
Commited the following to ams-branch (with changes noted by Thomas). Index: serverboot/ChangeLog 2005-08-13 Alfred M. Szmidt <[EMAIL PROTECTED]> * kalloc.c: #include (init_hook, malloc_hook, free_hook): New functions. (__malloc_initialize_hook): New variable. (m

Re: kalloc.c and recent gcc's

2005-09-11 Thread Alfred M\. Szmidt
My question was rather if we can be sure that realloc() or memalign() aren't used by e.g. printf() or other library functions that mach-defpager is calling. As I told you, you need to check that in the source code for realloc and memalign. __

Re: kalloc.c and recent gcc's

2005-09-02 Thread Thomas Schwinge
On Thu, Sep 01, 2005 at 01:25:29PM +0200, Alfred M. Szmidt wrote: >Can we be sure that we don't have to also hook realloc() and >memalign()? > > I don't think so, check the code for realloc/memalign to be sure, I > don't have access to it here. I don't think they're used in the Hurd code;

Re: kalloc.c and recent gcc's

2005-09-01 Thread Alfred M\. Szmidt
Uhm, did you did you read that message of mine? http://lists.gnu.org/archive/html/bug-hurd/2005-08/msg00253.html> Must have missed it, or great chuncks of it, sorry. For convenience, I attached the message to this mail. Thanks. Can we be sure that we don't have to also hook realloc(

Re: kalloc.c and recent gcc's

2005-08-31 Thread Thomas Schwinge
On Wed, Aug 31, 2005 at 04:54:36PM +0200, Alfred M. Szmidt wrote: >Ideally, fix the declaration of init_hook. Failing that, at least >give a correct cast instead of kludging with void *. > >void (*__malloc_initialize_hook) (void) = (void (*)(void)) init_hook; > > This is nicer, indee

Re: kalloc.c and recent gcc's

2005-08-31 Thread Alfred M\. Szmidt
Ideally, fix the declaration of init_hook. Failing that, at least give a correct cast instead of kludging with void *. void (*__malloc_initialize_hook) (void) = (void (*)(void)) init_hook; This is nicer, indeed. Could someone apply the patch with this modification? __

Re: kalloc.c and recent gcc's

2005-08-31 Thread Alfred M\. Szmidt
I think the proposed code should give a compiler error (which doesn't mean that it does, of course). The code is correct C99 code. ___ Bug-hurd mailing list Bug-hurd@gnu.org http://lists.gnu.org/mailman/listinfo/bug-hurd

Re: kalloc.c and recent gcc's

2005-08-31 Thread Alfred M\. Szmidt
Shall I do any further testing (and how to do that)? I told you, attach gdb to defpager, and put a breakpoint in malloc. Since this is a hook, any usual code from malloc shouldn't be run. > > +#include /* for malloc_hook/free_hook */ > > + > > +void *init_hook (void);

Re: kalloc.c and recent gcc's

2005-08-28 Thread Thomas Schwinge
Note that this is not my patch we're discussing, but as Alfred is currently on vacations, ... On Sun, Aug 28, 2005 at 02:51:37PM -0700, Thomas Bushnell BSG wrote: > Thomas Schwinge <[EMAIL PROTECTED]> writes: > >> > +void (*__malloc_initialize_hook) (void) = (void *) init_hook; > >> > >> Do you r

Re: kalloc.c and recent gcc's

2005-08-28 Thread Thomas Bushnell BSG
Bas Wijnen <[EMAIL PROTECTED]> writes: > I think the proposed code should give a compiler error (which doesn't mean > that it does, of course). Function pointers and data pointers are really > different types, and cannot be mixed. They need not even be the same size. Except that (void *) is com

Re: kalloc.c and recent gcc's

2005-08-28 Thread Thomas Bushnell BSG
Thomas Schwinge <[EMAIL PROTECTED]> writes: >> > +void (*__malloc_initialize_hook) (void) = (void *) init_hook; >> >> Do you really need the void * cast? > The cast avoids the following warning: > #v+ > [...] > ../../hurd-0/mach-defpager/../serverboot/kalloc.c:43: warning: initialization > from

Re: kalloc.c and recent gcc's

2005-08-28 Thread Bas Wijnen
On Sun, Aug 28, 2005 at 11:03:31PM +0200, Thomas Schwinge wrote: > > > + > > > +void (*__malloc_initialize_hook) (void) = (void *) init_hook; > > > > Do you really need the void * cast? > > The cast avoids the following warning: > #v+ > [...] > ../../hurd-0/mach-defpager/../serverboot/kalloc.c:4

Re: kalloc.c and recent gcc's

2005-08-28 Thread Thomas Schwinge
On Sun, Aug 28, 2005 at 09:00:41PM +0100, Neal H. Walfield wrote: > > What about the following fix? This should fix things so that we don't > > use vanilla malloc/free, and only use our own versions. > > This looks okay. Has it been tested? Michael Banck and I have been running the fixed binary

Re: kalloc.c and recent gcc's

2005-08-28 Thread Neal H. Walfield
> What about the following fix? This should fix things so that we don't > use vanilla malloc/free, and only use our own versions. This looks okay. Has it been tested? > +#include /* for malloc_hook/free_hook */ > + > +void *init_hook (void); > +void *malloc_hook (size_t size, const vo

kalloc.c and recent gcc's

2005-08-25 Thread Alfred M\. Szmidt
I reported this a while back (it happens with gcc 4.x too): /usr/local/lib/gcc/i386-unknown-gnu0.3/3.4.0/../../../../i386-unknown-gnu0.3/li b/libcrt.a(malloc.o)(.text+0x10d8): In function `__libc_free': /export/ams/libc/malloc/malloc.c:3355: multiple definition of `free' kalloc.o(.text+0x334):../