LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-18-2013, 12:49 PM   #16
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454

Quote:
Originally Posted by Brandon9000 View Post
For the present exercise, we're working on product which can be compiled and run on almost any Unixy system, both big and tiny. That's the goal.
Android is also a UNIXy system. Kind of. With very much dumbed down standard library.
 
Old 06-18-2013, 02:01 PM   #17
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,671
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
I very-frankly suggest that your quest for "POSIX compliant" is going to be a Faustian one: even if you succeed in doing it, it won't get your business the payoff that it imagines it's getting by specifying it.

I think that you should resign yourself to the fact that there will be a certain amount of "target platform specific" differences in your code, and that you should carefully design both the system and its Makefiles (and configure-scripts) to allow the same build-procedure to be carried out on any platform, even though the resulting source-code and build-steps will as a result vary somewhat from one platform to another.

For instance, go ahead and use cURL, because there is no reason to re-invent a wheel. Just make sure that you can see your way clear to running it on all your target systems, and do this be-fore you actually start building anything. That's key: the source-code that your developers write should vary very little.

You might also wish to explore some of the ideas in some platform-independent development systems such as haXe.

Last edited by sundialsvcs; 06-18-2013 at 02:04 PM.
 
1 members found this post helpful.
Old 06-18-2013, 04:11 PM   #18
bloody
Member
 
Registered: Feb 2013
Location: Berlin
Distribution: Gentoo, Debian
Posts: 172

Rep: Reputation: 25
If libs like zlib weren't POSIX-compilant / highly portable, they would never be so commonplace and used by everybody. Don't worry, established libs always run on virtually anything.
 
Old 06-18-2013, 04:14 PM   #19
Brandon9000
Member
 
Registered: Apr 2012
Location: Florida
Distribution: Many
Posts: 111

Original Poster
Rep: Reputation: Disabled
I appreciate your information, but in my present situation, I have to either see a claim that a library is POSIX compliant from its maker, or else, roll my own. There is no "probably" or "almost certainly" in what I'm doing.
 
Old 06-18-2013, 07:48 PM   #20
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by Brandon9000 View Post
I appreciate your information, but in my present situation, I have to either see a claim that a library is POSIX compliant from its maker, or else, roll my own. There is no "probably" or "almost certainly" in what I'm doing.
Does a "POSIX-compliant" dependency in this case mean that it only depends on other libraries that are self-certified as POSIX-compliant? If so, I imagine you'll be rewriting everything that isn't included as a standard part of the operating system. So, given that you need to stop the quest at some depth, I suggest that depth be the software you're actually writing.

Kevin Barry
 
Old 06-18-2013, 08:20 PM   #21
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
Originally Posted by Brandon9000
I still wish, though, that I didn't feel like the first person in history to do this in the sense that there is no list as to what is compliant, what is partially compliant, and what is non-compliant.
POSIX compliance is a matter of money, people usually care about dependencies, ie what you actually need to make the library work.

From the Debian FAQ:
Quote:
the POSIX standards cost real money and the POSIX.1 (and FIPS 151-2) certification is quite expensive;
 
Old 06-18-2013, 09:17 PM   #22
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by ntubski View Post
From the Debian FAQ:
Quote:
the POSIX standards cost real money and the POSIX.1 (and FIPS 151-2) certification is quite expensive;
Doesn't that only apply to the operating system, and not to 3rd-party software? There's really no value in certifying an application or library as POSIX-compliant unless it provides functionality that POSIX describes, but in such cases the standard applies to the behavior and API, not to the source code itself. This is highlighted by the fact that you can take POSIX-compliant C and translate it into asm, which isn't POSIX-compliant, yet when compiled into binary form it does the exact same thing. In my opinion, POSIX compliance of source code is more of an assurance to the maintainers that it's anticipated to compile and run on POSIX-compliant operating systems. Once it's compiled and linked, there's no telling if the source code was compliant or not; therefore, all value of compliance disappears once the software is in usable form.

Kevin Barry
 
Old 06-19-2013, 07:25 AM   #23
Brandon9000
Member
 
Registered: Apr 2012
Location: Florida
Distribution: Many
Posts: 111

Original Poster
Rep: Reputation: Disabled
In my case, what they want is a guarantee of nearly universal portability. This is a product that they hope to port to every platform and device, or, at least, that's the dream. I know that most platforms are just "Unixy" and not fully compliant, but this is their chosen approach to achieving something which almost runs in lots of different environments, even minimal ones. Hence my original desire to find a list of popular libraries already known to have been written in a POSIX compliant way. Every library which claims POSIX compliance is one I don't have to duplicate.
 
Old 06-19-2013, 07:49 AM   #24
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by Brandon9000 View Post
In my case, what they want is a guarantee of nearly universal portability. This is a product that they hope to port to every platform and device, or, at least, that's the dream. I know that most platforms are just "Unixy" and not fully compliant, but this is their chosen approach to achieving something which almost runs in lots of different environments, even minimal ones. Hence my original desire to find a list of popular libraries already known to have been written in a POSIX compliant way. Every library which claims POSIX compliance is one I don't have to duplicate.
They are taking a wrong approach. I think they better stick to C++ 2011 standard and fully compliant compiler (I think LLVM).

I.e. I suggest in the needed libraries to replace potentially POSIX compliant functions with C++ 2011 standard library ones.

And don't forget about threads.

My point is that C++ 2011 appears to be a better abstractions layer than POSIX - because compiler vendors will be interested to make compliant compilers for their respective platforms.
 
Old 06-19-2013, 07:55 AM   #25
Brandon9000
Member
 
Registered: Apr 2012
Location: Florida
Distribution: Many
Posts: 111

Original Poster
Rep: Reputation: Disabled
I understand, but there is no C++ standard library replacement for zlib, libxml2, libcrypto, libssl, etc. My primary issue at the moment is the need to rewrite the portions of these and other libraries for my application. It's a lot of work. This is why I wanted so much to find a list of libraries which claimed POSIX compliance - to free myself from the need to redo as many libraries as possible.
 
Old 06-19-2013, 08:17 AM   #26
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by Brandon9000 View Post
I understand, but there is no C++ standard library replacement for zlib, libxml2, libcrypto, libssl, etc. My primary issue at the moment is the need to rewrite the portions of these and other libraries for my application. It's a lot of work. This is why I wanted so much to find a list of libraries which claimed POSIX compliance - to free myself from the need to redo as many libraries as possible.
We are going rounds.

By themselves zlib, libxml2, libcrypto, libssl have nothing to do with POSIX. But the libraries call standard "C" library functions which have to do with POSIX.

So, instead of pursuing POSIX compliance replace those standard "C" library calls with equivalent (or combination where needed) C++ 2011 standard library functions, thus making what you need to be C++ 2011 compliant.
 
Old 06-19-2013, 10:40 AM   #27
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by Sergei Steshenko View Post
So, instead of pursuing POSIX compliance replace those standard "C" library calls with equivalent (or combination where needed) C++ 2011 standard library functions, thus making what you need to be C++ 2011 compliant.
If this is an option, then sticking with the existing versions of the libs in question should also be an option. This is because C++ 2011 isn't a standard part of an operating system; hence, it's a 3rd-party dependency like everything else.


If you end up rewriting libcrypto and libssl, I doubt many security-minded people will use your software. You'll also alienate a lot of users if you say, "You need to use my POSIX-compliant version of what you already have, even though you'll never know the difference."

In some cases, you might actually break the functionality of certain libs if you take out the non-POSIX code:
  1. Think about inotify (Linux) and kevent (FreeBSD). Both are used to monitor files and directories for changes and there's no POSIX-compliant replacement, so if you removed them from a lib it would have to use a spinlock to replace that functionality.
  2. The SIGLOST signal results in termination of a program in Linux, but that signal doesn't exist on FreeBSD. If you want to have a signal handler to perform cleanup, you'll have conditional code that's used on Linux but not on FreeBSD.
  3. In some cases, a FreeBSD version of a library or program will have code that logs actions through the audit system.
  4. POSIX doesn't describe SO_REUSEADDR for setsockopt, yet it can save everyone a lot of headache if a server process needs to be restarted immediately after it exits.
  5. When changing the uid of a process in FreeBSD, it's often appropriate to set the login class and MAC label for security reasons. Failing to do so could create a major security hole, yet neither are POSIX concepts.
The point is that you can't just arbitrarily decide what code in your dependencies doesn't belong based on aesthetics.

Kevin Barry

Last edited by ta0kira; 06-19-2013 at 11:01 AM.
 
Old 06-19-2013, 11:57 AM   #28
Brandon9000
Member
 
Registered: Apr 2012
Location: Florida
Distribution: Many
Posts: 111

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ta0kira View Post
If this is an option, then sticking with the existing versions of the libs in question should also be an option. This is because C++ 2011 isn't a standard part of an operating system; hence, it's a 3rd-party dependency like everything else.


If you end up rewriting libcrypto and libssl, I doubt many security-minded people will use your software. You'll also alienate a lot of users if you say, "You need to use my POSIX-compliant version of what you already have, even though you'll never know the difference."

In some cases, you might actually break the functionality of certain libs if you take out the non-POSIX code:
  1. Think about inotify (Linux) and kevent (FreeBSD). Both are used to monitor files and directories for changes and there's no POSIX-compliant replacement, so if you removed them from a lib it would have to use a spinlock to replace that functionality.
  2. The SIGLOST signal results in termination of a program in Linux, but that signal doesn't exist on FreeBSD. If you want to have a signal handler to perform cleanup, you'll have conditional code that's used on Linux but not on FreeBSD.
  3. In some cases, a FreeBSD version of a library or program will have code that logs actions through the audit system.
  4. POSIX doesn't describe SO_REUSEADDR for setsockopt, yet it can save everyone a lot of headache if a server process needs to be restarted immediately after it exits.
  5. When changing the uid of a process in FreeBSD, it's often appropriate to set the login class and MAC label for security reasons. Failing to do so could create a major security hole, yet neither are POSIX concepts.
The point is that you can't just arbitrarily decide what code in your dependencies doesn't belong based on aesthetics.

Kevin Barry
An interesting discussion, but no one will ever be asked to use my libraries. They are alternatives for me to linking the existing libraries into my application. Also, I only implement the pieces I need. The sole goal is to write a POSIX compliant application. In addition to knowing which libraries claim POSIX compliance, I would like to know which libraries are nearly universally present, even on minimal platforms. I might be able to make a case for using non-POSIX compliant libraries if I could argue that we would find them in every location we contemplate installing this application. The goal is wide portability without change in functionality.
 
Old 06-22-2013, 12:21 PM   #29
bloody
Member
 
Registered: Feb 2013
Location: Berlin
Distribution: Gentoo, Debian
Posts: 172

Rep: Reputation: 25
A library that is "nearly universally present" is of course also running on POSIX-compatible platforms.
 
  


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
PCI Compliance fetal Linux - Server 6 02-11-2013 09:55 PM
vsftpd and PCI compliance saraza Linux - Networking 3 09-22-2012 01:39 PM
of introduction and of first compliance thealmightyunicorn LinuxQuestions.org Member Intro 0 08-27-2012 04:44 PM
GPL Compliance jonnytabpni Linux - General 3 11-24-2009 11:30 PM
regarding POSIX compliance rajesh_b Programming 1 05-05-2006 03:31 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:26 AM.

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