putenv for AIX and ifdef for AIX

Discussion in 'C Programming' started by ClownPleco, Aug 22, 2007.

  1. ClownPleco

    ClownPleco Guest

    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
     
    ClownPleco, Aug 22, 2007
    #1
    1. Advertising

  2. In article <>,
    ClownPleco <> wrote:

    >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
    --
    "Consideration shall be given to the need for as many as 32 characters
    in some alphabets" - X3.4, 1963.
     
    Richard Tobin, Aug 22, 2007
    #2
    1. Advertising

  3. ClownPleco

    CBFalconer Guest

    ClownPleco wrote:
    >
    > 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).

    --
    Chuck F (cbfalconer at maineline dot net)
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net>


    --
    Posted via a free Usenet account from http://www.teranews.com
     
    CBFalconer, Aug 22, 2007
    #3
  4. ClownPleco

    Mark Bluemel Guest

    ClownPleco wrote:
    > 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
    <http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.aix.doc/infocenter/base/aix53.htm>

    > 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/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.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.
     
    Mark Bluemel, Aug 23, 2007
    #4
  5. Mark Bluemel <> writes:
    > ClownPleco wrote:
    >> 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.

    [...]

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

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Aug 23, 2007
    #5
  6. Richard Tobin <> wrote:
    > In article <>,
    > ClownPleco <> wrote:


    >>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.


    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.

    --
    Thomas E. Dickey
    http://invisible-island.net
    ftp://invisible-island.net
     
    Thomas Dickey, Aug 24, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. putenv

    , Dec 20, 2005, in forum: Python
    Replies:
    8
    Views:
    2,846
    Tom Anderson
    Dec 21, 2005
  2. Michael B Allen

    getenv returns same string as putenv?

    Michael B Allen, Dec 11, 2006, in forum: C Programming
    Replies:
    8
    Views:
    440
    Chris Dollin
    Dec 13, 2006
  3. Replies:
    5
    Views:
    1,062
  4. Johannes Bauer

    Re: os.putenv() has no effect

    Johannes Bauer, Jun 18, 2013, in forum: Python
    Replies:
    0
    Views:
    123
    Johannes Bauer
    Jun 18, 2013
  5. Dave Angel

    Re: os.putenv() has no effect

    Dave Angel, Jun 18, 2013, in forum: Python
    Replies:
    2
    Views:
    149
    Johannes Bauer
    Jun 18, 2013
Loading...

Share This Page