Hi!

<cut>

>> Could you try to modify your test to do the proper casts and see if
>> you can find what is going wrong on your system ?
>> If we can find a test that fails on your system but works on ours, we
>> would know a lot more about of how to fix this problem.

Michael> Yes, as it turns out.  The problem is in dce.  It seems setrlimit is
Michael> replaced with cma_setrlimit in dce/cma_ux.h.  I'll provide the modified
Michael> rlimtest.c and it's output below, but the short version is that including
Michael> pthread.h and linking with -ldce causes the problem.

Michael> Here's the code:

<cut>

Michael> Here's the output:

Michael>   stassenm@dr ~ $gcc -I/opt/dce/include -ldce rlimtest.c
  
Michael>   stassenm@dr ~ $./a.out
Michael>   Size of rlimit is 8
Michael>   getrlimit: cur=60 max=1024
Michael>   Changing to: cur=510 max=510

Michael>   SUCCESS

Michael> That worked, but then I mention largefile:

Michael>   stassenm@dr ~ $gcc -D_FILE64 -I/opt/dce/include -ldce rlimtest.c

Michael>   stassenm@dr ~ $./a.out
Michael>   Size of rlimit is 16
Michael>   getrlimit: cur=60 max=1024
Michael>   Changing to: cur=510 max=510

Michael>   ERROR: errno=22

Michael> As you can see, setrlimit (really cma_setrlimit64 in this case) returns an
Michael> error.  Error 22 is EINVAL, which seems to cover most of the possible ways
Michael> to go wrong.

I tried this again and this time I got the same problem.

I checked the output with gcc -E and for me it only called
cma_setrlimit(), not cma_setrlimit64()

I changed the compile line to:

gcc -D__STDC_EXT__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-I/opt/dce/include -ldce rlimtest.c

But this still didn't call cma_setrlimit64() for me.


I investigated this a little and noticed the following strange things
from the preprocessor output:

extern int setrlimit64(int, const struct rlimit64 *);
..
static setrlimit(a,b) const struct rlimit *b; { return __setrlimit64(a,b);
...
#define setrlimit       cma_setrlimit
....
#define setrlimit64    cma_setrlimit64
                                        
I think there is a bug in the above logic.  It should be:

#define setrlimit64    cma_setrlimit64

When compiling I get the following (wrong) warning message:

(It's wrong because the header files assumes you should use
struct rlim_64, while the defines fixes that the standard 'struct
rlimit' is ok)

rlimtest.c: In function `main':
rlimtest.c:26: warning: passing arg 2 of `cma_setrlimit64' from incompatible pointer 
type

After this I get:

[monty@mysql-hp monty]$ ./a.out
Size of rlimit is 16
getrlimit: cur=500 max=500
Changing to: cur=500 max=500
 
SUCCESS

You should contact HP and ask them how they have planed that this
should work.

What they should do is remove all usage of struct rlimit64, and use
struct rlimit everyhere and add the define:

#ifdef _LARGEFILE64_SOURCE
#undef setrlimit
#define setrlimit cma_setrlimit64
#endif

in

/opt/dce/include/dce/cma_ux.h

Regards,
Monty

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to