Fedora Linux Support Community & Resources Center
  #1  
Old 7th February 2009, 11:36 AM
meowdin Offline
Registered User
 
Join Date: Feb 2008
Location: HK
Age: 31
Posts: 196
Unix env in linux env

Hi all,
I had just attended the second lecture on my new course: Distributed System, and had just learnt that the future programming environment in this course is "Unix environment".

I have never really work on or even touch a unix system, but the SSH terminal from the school shows that the one terminal provide by the school is sunOS (solaries?) , which looked so similar to my home machine (fedora)

Anyway, I have a sample program which was written in C which looked like:
Code:

		/* IP-addr & port # of the remote socket */
        	printf("remote IP: %d.%d.%.d.%d\n", remote_addr.sin_addr.S_un_b.s_b1, remote_addr.sin_addr.S_un_b.s_b2, remote_addr.sin_addr.S_un_b.s_b3, remote_addr.sin_addr.S_un_b.s_b4);
        	printf("remote port: %d\n", remote_addr.sin_port);
edit: removed a large portion of the source codes since they are irrelevent

I compile it with gcc and get an error that indicated :
‘struct in_addr’ has no member named ‘S_un_b’

After some search, I found that the structure of the struct in_addr is different between linux and solaris.... (but I am not sure about unix

My question is:

- As the professor has already told us that the future programming environment (including our assignment and exam) will be based on UNIX environment, could I continue to work with Linux?

If es, what can I do to simulate a complete unix environment?

If no, any suggestion on what to do?
(VMware? Triple boot to a unix system? What did you do back to the collage/trainee days ? )


Thanks in advance


Mao Ting

Note: I am currently using fedora 10 64, which is logically and physically so similar to the sample unix system (with SunOS) provided by school.... (relative to winOS, at least)

Last edited by meowdin; 11th February 2009 at 05:16 AM.
Reply With Quote
  #2  
Old 7th February 2009, 01:48 PM
sideways's Avatar
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
OpenSolaris is a free download and can be run as a livecd or within a virtual environment such as qemu or VirtualBox

Alternatively there are premade images for vmware player/server

http://www.vmware.com/appliances/directory/1242


EDIT

Just noticed I linked to the older 2008.5 OpenSolaris vmware image, there is a newer version available 2008.11

http://www.vmware.com/appliances/directory/64222

Last edited by sideways; 9th February 2009 at 04:12 PM. Reason: update vmware link
Reply With Quote
  #3  
Old 8th February 2009, 10:53 AM
meowdin Offline
Registered User
 
Join Date: Feb 2008
Location: HK
Age: 31
Posts: 196
Hi sideways, thx for your reply, I will download the opensolaris and the vmware first

just wondering, isn't linux also a unix environment ??
Reply With Quote
  #4  
Old 8th February 2009, 10:56 AM
Jake's Avatar
Jake Offline
Registered User
 
Join Date: Oct 2008
Location: England, Lincolnshire
Posts: 1,576
Yes and no.

However we are Linux, which was made by someone named "Linus" (Kernel that is). And the kernel is GNU.

So it's a different kernel and a lot of things are different a Mac Is Unix. Solaris is Unix. But Linux is not.
__________________
Fedora user since FC6.
Linux user since 2003.
Registered Linux ID: #456478
OS: Fedora 16 x86_64
Reply With Quote
  #5  
Old 8th February 2009, 11:02 AM
meowdin Offline
Registered User
 
Join Date: Feb 2008
Location: HK
Age: 31
Posts: 196
Thanks Jake, seems like I will have to work with solaris for this course
Reply With Quote
  #6  
Old 8th February 2009, 11:19 AM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,076
Quote:
Originally Posted by meowdin View Post
just wondering, isn't linux also a unix environment ??
UNIX® is a registered trademark of The Open Group. Using the trademark requires paying licensing fees, so we can't legally say that Linux is "a unix environment". However, Linux is mostly compatible with the Single UNIX Specification.
Your Solaris example code uses features that aren't part of the Single UNIX Specification, so it's Solaris code, not portable UNIX code. It would need fixing to work on any UNIX environment (and Linux).
Reply With Quote
  #7  
Old 9th February 2009, 03:57 PM
meowdin Offline
Registered User
 
Join Date: Feb 2008
Location: HK
Age: 31
Posts: 196
Seems like my school favour Solaris, I have installed vmware server and the pre-built opensolaris
Currently seems working

Thanks all for your reply!
Reply With Quote
  #8  
Old 13th February 2009, 07:19 AM
meowdin Offline
Registered User
 
Join Date: Feb 2008
Location: HK
Age: 31
Posts: 196
It seems I was too naive about the situation, after playing around with opensolaris for a while, I figured it's more like a Linux distro to me...

At first, I tried install sunstudio in opensolaris, which until now, after I delete the VM, I still don't understand why I couldn't install it. Then I used the Netbean in OpenSolaris..... and hit the exact compilation error on my laptop.

After some searching, I figured that the header file in opensolaris 2008 is more like mine then Solaris' header file...
Like:
Under the include C header file, /netinet/in.h

This is on my fedora 10
Quote:

* Copyright (C) 1991-2001, 2003, 2004, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
.......

And this is on the SunOS server (Solaris 10) in my school...
Quote:
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved.
*......

and the one on opensolaris using is like mine more then the one in Solaris 10

After some struggling, I have some conclusion:

- OpenSolaris is not solaris , but a Linux distro
- As a Linux distro, OpenSolaris is almost as good as fedora9 to me...... you get what I mean....

So I deleted opensolaris and tried to use sunstudio on my fedora10, which a very funny thing happen..

The latest Sun studio only support netbean 5.5.1 ... and fedora10 only has netbean6+ , and netbean 5+ is not even supported by the neatbean.org any more (broken link for download)... I i just stayed with netbean6 and download the whole include folder from my school server, and use netbean and the SunOS include folder for compiling the codes....

Then, I finally could compile the codes, but I couldn't run it because the debugger and "ld" (which I don't know what it is) is still working with my system path's header files...

So eventually, I scp all my sources to the server after i use gedit on my desktop, and compile and run on the sunos in my school's server.... and I spent half of my time typing my password and copying the file...

Just some grumbling, but if anyone has a better idea, I am all ears and grateful...
Reply With Quote
  #9  
Old 13th February 2009, 10:36 AM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,076
Quote:
Originally Posted by meowdin View Post
- OpenSolaris is not solaris , but a Linux distro
No, it doesn't use the Linux kernel so it isn't a Linux distro. It's a GNU system based on the Solaris kernel, so maybe it should be called "GNU/OpenSolaris"
Reply With Quote
  #10  
Old 13th February 2009, 06:04 PM
sideways's Avatar
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
OpenSolaris certainly isn't linux, no linux distro has zfs filesystem.

I checked out OpenSolaris11.08 and installed the SUNWhea package to get the headers.
netinet/in.h is the same as the one at your school I think, here's the header

Code:
/*
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */
/*
 * Copyright (c) 1982, 1986 Regents of the University of California.
 * All rights reserved.
it certainly is a lot different to the glibc one provided in fedora 10.

Here's the definition of in_addr in OpenSolaris11.08 SunOS headers

Code:
/*
 * IPv4 Internet address
 *	This definition contains obsolete fields for compatibility
 *	with SunOS 3.x and 4.2bsd.  The presence of subnets renders
 *	divisions into fixed fields misleading at best.  New code
 *	should use only the s_addr field.
 */

#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#define	_S_un_b	S_un_b
#define	_S_un_w	S_un_w
#define	_S_addr	S_addr
#define	_S_un	S_un
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */

struct in_addr {
	union {
		struct { uint8_t s_b1, s_b2, s_b3, s_b4; } _S_un_b;
		struct { uint16_t s_w1, s_w2; } _S_un_w;
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
		uint32_t _S_addr;
#else
		in_addr_t _S_addr;
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
	} _S_un;
#define	s_addr	_S_un._S_addr		/* should be used for all code */
#define	s_host	_S_un._S_un_b.s_b2	/* OBSOLETE: host on imp */
#define	s_net	_S_un._S_un_b.s_b1	/* OBSOLETE: network */
#define	s_imp	_S_un._S_un_w.s_w2	/* OBSOLETE: imp */
#define	s_impno	_S_un._S_un_b.s_b4	/* OBSOLETE: imp # */
#define	s_lh	_S_un._S_un_b.s_b3	/* OBSOLETE: logical host */
};
whereas in glibc in fedora 10 we have

Code:
/* Internet address */
typedef uint32_t in_addr_t;
struct in_addr
  {
      in_addr_t s_addr;
  };
Quite a difference! Solaris does seem to make a lot of fuss over what is basically 4 bytes

Did you install the correct header files (SUNWhea package in Core section of package manager)

OpenSolaris should be very compatible with Solaris10
Reply With Quote
Reply

Tags
env, linux, unix

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
show version of unix/linux manhh Installation and Live Media 1 17th September 2009 05:11 PM
differentiating Unix and Linux yiela Using Fedora 13 14th June 2007 06:17 PM
Unix apps on Linux? techmatt Linux Chat 3 14th April 2007 09:57 PM
some linux/unix humour ElektraMale Linux Chat 1 10th June 2006 03:26 PM
Botting Unix/Linux to boot into...Windows?! btechman2002 Linux Chat 10 26th April 2005 05:59 PM


Current GMT-time: 16:26 (Thursday, 23-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat