Find the answer to your Linux question:
Results 1 to 6 of 6
Hi All, Currently I am working on the project where I have to migrate all the C code from HP-UX to Red-Hat Linux. There are lot of differences and I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    6

    HP-UX to Linux Migration


    Hi All,

    Currently I am working on the project where I have to migrate all the C code from HP-UX to Red-Hat Linux. There are lot of differences and I need lot of code change.

    I am looking for the forum where this type of discussion happen before, and I can post my problems.

    I am having a list of items which need some discussion.

    Thanks,
    Amar

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,655
    I've done a lot of cross-platform C/C++ devlopment over the years, including HPUX, Linux, Solaris, AIX, Tru64, Windows, QNX, etc. Post your issues here and I'll try to help, though bear in mind I don't have an HPUX system (PA-RISC or Itanium) to test things on at the present. Which HPUX version are you porting from, and which RHEL version are you porting to?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    6
    Thanks for the reply.
    Right now I am on planning phase and identifying the list of problems.
    It's a quit big list.

    I will send the details shortly the exact version of RHEL and HPUX.

    Let's discuss items one by one:

    String operations

    Follwing code working perfect under HPUX but crashing under Linux.
    Actually code is broken, but HPUX may be doing something extra and not getting crashed.

    int main()
    {
    char a[10];
    char *b = NULL;

    strcpy(a, b);
    }

    In case b is not having malloc this should crash, but in HP it's not crashing. Now we are having more than 20,000 file of C code, and lot of string operation. To check all the string function and correct is if needed will take lot of time.

    Any suggestion...

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,655
    Well, 20 KLOC isn't so much. I've had to review and fix as much as 10 MLOC for similar issues in the past. I would estimate 2-5 person-days to remediate your code. This is a situation where asserts (assert()) and building/testing in debugging mode can be very useful in that it will reveal most of the offenders right off. Then, you know which ones to fix and can rebuild at the end with debugging off for production.

    In any case, you are correct in that it should also fail with HPUX, but that depends upon the C runtime library. The strcpy() and similar functions can test the passed arguments for null values and do nothing if found. That is optional in the C/C++ standards, but not required. So, both behaviors can be considered acceptable. This is one of those things that bite you when building/running code in a cross-platform sense, and makes a strong case for code review and strong local coding standards.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #5
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,234
    Quote Originally Posted by Rubberman View Post
    This is one of those things that bite you when building/running code in a cross-platform sense, and makes a strong case for code review and strong local coding standards.
    I would say it makes a strong case for coding everything explicitly and not relying on any built-in intelligence in the compiler. Because a different compiler might make different assumptions or none at all. If you want to store strings or anything else, use malloc() first and your code will run on any system.
    "I'm just a little old lady; don't try to dazzle me with jargon!"
    www.hrussman.entadsl.com

  7. #6
    Just Joined!
    Join Date
    Mar 2008
    Posts
    6
    Yes, you suggestion is perfect, but code is existing may be some of them are 15 year old. Now I need to find all the bugs.

    Is there any place where guys discuss the difference between HPUX and Linux?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •