putenv for AIX and ifdef for AIX

C

ClownPleco

I have read several posts about putenv is not Standard C. But I'm
wondering if anyone knows if it is available in AIX. All of our other
platforms (linux (32 and 64 bit), sgi, hpux, x86, darwin (intel and
mac), interix and sun) behave properly for our application. We found
that if we run this command prior to running the application, it works
correctly:

set LDR_CNTRL=MAXDATA=0x80000000;export LDR_CNTRL

Our problem is that we start a parent process that spawns the child
application. If we set the LDR_CNTRL=MAXDATA prior to starting the
parent process, other child applications are failing.

Our initial solution is to have wrap around child application that
sets the environmental variable and then spawns an additional child.
This environmental variable would only be set if the the operating
system is AIX.

Second question, does anyone know the correct #ifdef statement to
check for AIX, is it:

#ifdef __AIX__

I'm a very very green C programmer!

Thanks

Rick
 
R

Richard Tobin

ClownPleco said:
I have read several posts about putenv is not Standard C. But I'm
wondering if anyone knows if it is available in AIX. All of our other
platforms (linux (32 and 64 bit), sgi, hpux, x86, darwin (intel and
mac), interix and sun) behave properly for our application. We found
that if we run this command prior to running the application, it works
correctly:

set LDR_CNTRL=MAXDATA=0x80000000;export LDR_CNTRL

You'd be better off asking in comp.unix.aix.

-- Richard
 
C

CBFalconer

ClownPleco said:
I have read several posts about putenv is not Standard C. But I'm
wondering if anyone knows if it is available in AIX. All of our other
platforms (linux (32 and 64 bit), sgi, hpux, x86, darwin (intel and
mac), interix and sun) behave properly for our application. We found
that if we run this command prior to running the application, it works
correctly:

set LDR_CNTRL=MAXDATA=0x80000000;export LDR_CNTRL

Our problem is that we start a parent process that spawns the child
application. If we set the LDR_CNTRL=MAXDATA prior to starting the
parent process, other child applications are failing.

Our initial solution is to have wrap around child application that
sets the environmental variable and then spawns an additional child.
This environmental variable would only be set if the the operating
system is AIX.

Second question, does anyone know the correct #ifdef statement to
check for AIX, is it:

#ifdef __AIX__

I'm a very very green C programmer!

These are not C language questions. Try comp.unix.programmer (I
think).
 
M

Mark Bluemel

ClownPleco said:
I have read several posts about putenv is not Standard C. But I'm
wondering if anyone knows if it is available in AIX.

As I happen to work extensively with AIX, in this area, I'll give you
some answers. However, I'd stress that it's off-topic for this newsgroup
- as others have suggested, it would probably be more appropriate to ask
these sort of questions in a unix newsgroup in future.

putenv(), which is part of POSIX and therefore required for
POSIX-compliant systems such as AIX, is covered in the manuals for AIX
which are available online at
All of our other
platforms (linux (32 and 64 bit), sgi, hpux, x86, darwin (intel and
mac), interix and sun) behave properly for our application. We found
that if we run this command prior to running the application, it works
correctly:

set LDR_CNTRL=MAXDATA=0x80000000;export LDR_CNTRL

See the AIX manual discussion of this option at
<http://publib.boulder.ibm.com/infoc...aix.genprogc/doc/genprogc/lrg_prg_support.htm>

You can set this option for your executable at build time, which will
not affect its children. This would probably be more appropriate. See
the documentation for the linker (ld) and the "-bmaxdata" option.
Our problem is that we start a parent process that spawns the child
application. If we set the LDR_CNTRL=MAXDATA prior to starting the
parent process, other child applications are failing.

Don't use the environment variable...
Second question, does anyone know the correct #ifdef statement to
check for AIX, is it:

#ifdef __AIX__

I can't help you here - we usually set our own defines in the makefiles
for O/S specifics.
 
K

Keith Thompson

Mark Bluemel said:
As I happen to work extensively with AIX, in this area, I'll give you
some answers. However, I'd stress that it's off-topic for this
newsgroup - as others have suggested, it would probably be more
appropriate to ask these sort of questions in a unix newsgroup in
future.
[...]

How difficult would it have been, both for you and for the OP, to take
this discussion to comp.unix aix?
 
T

Thomas Dickey

Richard Tobin said:
You'd be better off asking in comp.unix.aix.

Not really (comp.unix.aix doesn't get much traffic from developers,
and rarely do those get a knowledgable answer - nothing that OP did
get an answer here ;-).

Posting to comp.unix.programmer would be more likely to get results.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top