Port code from Solaris to Linux - Unix

This is a discussion on Port code from Solaris to Linux - Unix ; Hi, I begin porting an application originally write on Solaris, using some functions from libgen and other. If anybody have some documents which help me on this porting I appreciate much. Any comparative or alternative functions for common functions on ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Port code from Solaris to Linux

  1. Port code from Solaris to Linux

    Hi,

    I begin porting an application originally write on Solaris, using some
    functions from libgen and other.

    If anybody have some documents which help me on this porting I
    appreciate much.

    Any comparative or alternative functions for common functions on
    Solaris environment to Linux.

    Actually I try compile in REL5 using GCC with this configuration:

    gcc -v
    Using built-in specs.
    Target: i386-redhat-linux
    Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
    infodir=/usr/share/info --enable-shared --enable-threads=posix --
    enable-checking=release --with-system-zlib --enable-__cxa_atexit --
    disable-libunwind-exceptions --enable-libgcj-multifile --enable-
    languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --
    disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-
    gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
    Thread model: posix
    gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)

    Before I have this:

    gcc -v
    Reading specs from /usr/local/lib/gcc/i386-pc-solaris2.10/3.4.6/specs
    Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/
    usr/
    ccs/bin/ld --enable-shared --enable-languages=c,c++,f77
    Thread model: posix
    gcc version 3.4.6

    I'm not talk about porting to other compile, I talk about porting a
    small C application it was originally written on Solaris and use a
    small set of own functions. I need only some help to port this code to
    Linux. Only this.


  2. Re: Port code from Solaris to Linux

    On Nov 11, 8:45 am, Leo Calado wrote:
    > Hi,
    >
    > I begin porting an application originally write on Solaris, using some
    > functions from libgen and other.
    >
    > If anybody have some documents which help me on this porting I
    > appreciate much.
    >
    > Any comparative or alternative functions for common functions on
    > Solaris environment to Linux.


    Googling "solaris linux porting" turned up some useful looking
    material.

    Solaris and Linux are reasonably similar, both being SYSV type
    systems, so my first inclination would be just to try compiling your
    existing code and seeing what breaks. Have you tried that, and what
    broke?

    What kind of things does your program do? People may have an idea of
    which parts may cause trouble.


  3. Re: Port code from Solaris to Linux

    fjblurt@yahoo.com writes:

    > Solaris and Linux are reasonably similar, both being SYSV type
    > systems


    GNU/Linux is not SYSV type. See:

    http://en.wikipedia.org/wiki/System_V

    The more apropricate description might be both conforming to POSIX
    standard.

    --
    William

  4. Re: Port code from Solaris to Linux

    On Nov 12, 1:06 pm, William Ahern
    wrote:
    > Leo Calado wrote:
    > > Hi,

    >
    > > I begin porting an application originally write on Solaris, using some
    > > functions from libgen and other.

    >
    > > If anybody have some documents which help me on this porting I
    > > appreciate much.

    >
    > > Any comparative or alternative functions for common functions on
    > > Solaris environment to Linux.

    >
    >
    >
    > The libgen.h interfaces on Linux are provided by libc, very likely glibc on
    > your box. So, GCC has't much to do with it. But, libgen seems to be sort of
    > a bit-bucket, and Linux only provides a few of these common utility
    > functions.
    >
    > What functions are you using?


    Here:

    bufsplit
    strccpy
    strfind

    Thanks for help.


  5. Re: Port code from Solaris to Linux

    Leo Calado wrote:
    > On Nov 12, 1:06 pm, William Ahern
    > wrote:
    > > Leo Calado wrote:
    > > > Hi,

    > >
    > > > I begin porting an application originally write on Solaris, using some
    > > > functions from libgen and other.

    > >
    > > > If anybody have some documents which help me on this porting I
    > > > appreciate much.

    > >
    > > > Any comparative or alternative functions for common functions on
    > > > Solaris environment to Linux.

    > >
    > >
    > >
    > > The libgen.h interfaces on Linux are provided by libc, very likely glibc on
    > > your box. So, GCC has't much to do with it. But, libgen seems to be sort of
    > > a bit-bucket, and Linux only provides a few of these common utility
    > > functions.
    > >
    > > What functions are you using?

    >
    > Here:
    >
    > bufsplit


    Your strsep man page should document the standard way to implement this, all
    in 5 lines of C code.

    > strccpy


    BSD's have the vis(3) utilities. You might be able to pull that code (w/ the
    BSD license) into your project. Alternatively, a simple state machine with a
    loop and a switch should be easy to construct.

    > strfind


    char *str = "foobar";
    char *pos = strstr(str, "bar");
    ptrdiff_t off = pos - str;


    In the future, you should be wary of the sort functions you used. An attempt
    to avert your frustration is why developers become familiar with the C and
    POSIX/SUS standards.


  6. Re: Port code from Solaris to Linux

    On Tue, 13 Nov 2007 13:41:42 -0000, Leo Calado wrote:
    >On Nov 12, 1:06 pm, William Ahern wrote:
    >> The libgen.h interfaces on Linux are provided by libc, very likely
    >> glibc on your box. So, GCC has't much to do with it. But, libgen
    >> seems to be sort of a bit-bucket, and Linux only provides a few of
    >> these common utility functions.
    >>
    >> What functions are you using?

    >
    > Here:
    >
    > bufsplit
    > strccpy
    > strfind


    If it's only these functions you are missing, then it shouldn't be very
    hard to implement replacement functions, and link them through a static
    library, i.e. `libcompat.a'.

    Here's a CDDL-licensed implementation of bufsplit(), for instance:
    http://blogs.sun.com/timc/resource/bufsplit.c

    With a bit of compile-time magic, you can even arrange to include these
    functions in `libcompat.a' if they are not already available as part of
    the build-system :-)


+ Reply to Thread