gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] Re: OpenBSD and GCL


From: Magnus Henoch
Subject: Re: [Gcl-devel] Re: OpenBSD and GCL
Date: Tue, 06 Apr 2004 21:39:16 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Camm Maguire <address@hidden> writes:

> OK, I'll implement this if you can tell me the following will not work
> for you: define a little static variable in malloc to detect recursive
> calls in which case return null.  BTW your setrlimit stuff should be
> where you want it now.

Like this?

#include <stdio.h>

FILE *output = stdout;
static int recursion = 0, entries = 0;

void *malloc(int size)
{
  entries++;
  if (recursion == 0) {
    recursion++;       
    fputs("in malloc()\n", output);
  }
   
  return NULL;
}
 
int main(void)
{
  fputs("in main\n", output);
  fprintf(output, "entries is %d\n", entries);
  return 0;
}

This works.  For output==stdout, it outputs

in malloc()
in main
entries is 3

and for output==stderr, entries is 2 at the end.  This definitely
looks like a good idea; even printf seems to work well without
malloc'ed memory.

>> > 3) Is there any chance of getting to the bottom of the unexec issue in
>> >    a week or so?  It would be nice to have openbsd supported out of
>> >    the box in 2.6.2.
>> 
>> Don't count on it, as I won't have very much time to work on it the
>> next week.  I'll see what I can do, though.
>> 
>
> Just curious, any progress here?  We're quite close to making the
> 2.6.2pre tag.

No, I haven't even looked at it yet.

Regards,
Magnus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]