LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-05-2008, 09:06 AM   #1
emp1953
Member
 
Registered: Nov 2007
Posts: 30

Rep: Reputation: 0
Endian issues in RedHat


I was just jolted into reality when I found that my linux application running on an intel chip became little endian. I am communicating with a Unix (big endian) platform. None of my communication/message constructs are now valid.
Are there any plug and run endian conversion tools (or code if I have to implement it) available that anyone knows of.

Thanks emp1953
 
Old 02-06-2008, 04:38 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Consider yourself lucky you don't have EBCDIC <==> ASCII issues as well ...

If you are doing your own (raw) data transfers, I think you are going to have to handle it yourself. It's a bitch if you have a lot of embedded null values - guess how I know ...
 
Old 02-06-2008, 05:31 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Actually there are plenty of "swap bytes" C codes in the internet, that you can use as template. Take in mind that byte swapping works for pure binaries (I mean files containing only numbers). If there are character values, they must not be swapped.
 
Old 02-07-2008, 10:17 AM   #4
emp1953
Member
 
Registered: Nov 2007
Posts: 30

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
Consider yourself lucky you don't have EBCDIC <==> ASCII issues as well ...

If you are doing your own (raw) data transfers, I think you are going to have to handle it yourself. It's a bitch if you have a lot of embedded null values - guess how I know ...
Yes I'm using a good CM product.
 
Old 02-07-2008, 07:24 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Yes, it's "an illegitimate human being."

Byte-swapping functions do exist, however, and you'll have to use them. Note, however, that many libraries do byte-swapping for you or provide a global way to control that... possibly at compile-time when the library is built. Endian-issues are not that uncommon, after all.

EBCDIC? "Bah! These kids today... why, back in my day we had to do our homework in Baudot!"

{I've still got my "card saw," syg00... do you? And I'm definitely a member of the "I dropped an entire box" club.}
 
Old 02-07-2008, 08:43 PM   #6
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
Quote:
Originally Posted by sundialsvcs View Post
{I've still got my "card saw," syg00... do you? And I'm definitely a member of the "I dropped an entire box" club.}
Hey, how many other digital media besides cards are still readable after that many years? Floppies, zips, even CDs turn up unusable. Remember how the guy in Cryptonomicon broke the code? He pulled out the box of cards from his dad's belongings after he died.

Last edited by choogendyk; 02-07-2008 at 08:49 PM.
 
Old 02-08-2008, 07:26 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
No, some of my old "junk" gets tossed out every time we move house .... :shrug:.

Where I have had issues was using C to drive a raw TCP transfer of RMF (performance) data - it's composed of variable numbers of self-defining (big endian EBCDIC) fields than are *full* of binary zero values. Gave up in disgust.
There is now a z/OS CIM Server (based on OpenPegasus), so I probably should revisit it one day.

Last edited by syg00; 02-08-2008 at 07:29 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
loading additional modules in endian 2.1 dbmacartney Linux - Software 0 04-03-2007 04:46 AM
Endian Firewall Upgrade sombra_tommy Linux - Software 1 03-15-2007 04:32 AM
problem in understanding little endian/big endian machine program indian Programming 6 04-19-2006 02:50 PM
big endian little endian? blackzone Linux - Hardware 4 09-23-2004 06:04 AM
What is all this big endian-little endian stuff about? vdemuth Linux - Newbie 1 04-28-2004 02:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration