LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   c programming compliant with posix ---HELP! (https://www.linuxquestions.org/questions/programming-9/c-programming-compliant-with-posix-help-292760/)

v333k 02-20-2005 06:56 PM

c programming compliant with posix ---HELP!
 
Hi,
My professor assigned a programming assignment and he said that it needs to be compliant with posix. I have no clue what that means? I searched on some search engines but I ended up with hits that mention the word "posix" in them, but nothing that helped.

If you have any links or explanation to what this posix is, please let me know. I am lost at the moment!

Thanks,
v333k

Dave Kelly 02-20-2005 07:05 PM

I was going to tell you to search google. But I got over 3 million hits when I did and figured that was not enough to tell you the answer to your question.

So I went to the first place listed to get the answer to your question.
IEEE

shishir 02-21-2005 12:35 AM

POSIX helps you keep your programs running on different systems without having to modify the code...prime example i can think of : pthreads...you can have a program run on different systems that implement threads in different ways...also, all the calls ending in _r (the re-entrant versions are POSIX compliant )..you might be able to dig up some docs that list all the POSIX calls...

this is from the UNP Vol. 1 by Richard Stevens
-----------------------------------------------------------------------------------
Background on POSIX
POSIX is an acronym for Portable Operating System Interface. POSIX is not a single standard, but a family of standards being developed by the Institute for Electrical and Electronics Engineers, Inc., normally called the IEEE. The POSIX standards have also been adopted as international standards by ISO and the International Electrotechnical Commission (IEC), called ISO/IEC. The POSIX standards have an interesting history, which we cover only briefly here:

IEEE Std 1003.1–1988 (317 pages) was the first POSIX standard. It specified the C language interface into a Unix-like kernel and covered the following areas: process primitives (fork, exec, signals, and timers), the environment of a process (user IDs and process groups), files and directories (all the I/O functions), terminal I/O, system databases (password file and group file), and the tar and cpio archive formats.


The first POSIX standard was a trial-use version in 1986 known as "IEEE-IX." The name "POSIX" was suggested by Richard Stallman.


IEEE Std 1003.1–1990 (356 pages) was next, and it was also known as ISO/IEC 9945–1: 1990. Minimal changes were made from the 1988 to the 1990 version. Appended to the title was "Part 1: System Application Program Interface (API) [C Language]," indicating that this standard was the C language API.

IEEE Std 1003.2–1992 came next in two volumes (about 1,300 pages). Its title contained "Part 2: Shell and Utilities." This part defined the shell (based on the System V Bourne shell) and about 100 utilities (programs normally executed from a shell, from awk and basename to vi and yacc). Throughout this text, we will refer to this standard as POSIX.2.

IEEE Std 1003.1b–1993 (590 pages) was originally known as IEEE P1003.4. This was an update to the 1003.1–1990 standard to include the real-time extensions developed by the P1003.4 working group. The 1003.1b–1993 standard added the following items to the 1990 standard: file synchronization, asynchronous I/O, semaphores, memory management (mmap and shared memory), execution scheduling, clocks and timers, and message queues.

IEEE Std 1003.1, 1996 Edition [IEEE 1996] (743 pages) came next and included 1003.1–1990 (the base API), 1003.1b–1993 (real-time extensions), 1003.1c–1995 (pthreads), and 1003.1i–1995 (technical corrections to 1003.1b). This standard was also called ISO/IEC 9945–1: 1996. Three chapters on threads were added, along with additional sections on thread synchronization (mutexes and condition variables), thread scheduling, and synchronization scheduling. Throughout this text, we will refer to this standard as POSIX.1. This standard also contains a Foreword stating that ISO/IEC 9945 consists of the following parts:

Part 1: System API (C language)

Part 2: Shell and utilities

Part 3: System administration (under development)

Parts 1 and 2 are what we call POSIX.1 and POSIX.2.


Over one-quarter of the 743 pages are an appendix titled "Rationale and Notes." This appendix contains historical information and reasons why certain features were included or omitted. Often, the rationale is as informative as the official standard.


IEEE Std 1003.1g: Protocol-independent interfaces (PII) became an approved standard in 2000. Until the introduction of The Single Unix Specification Version 3, this POSIX work was the most relevant to the topics covered in this book. This is the networking API standard and it defines two APIs, which it calls Detailed Network Interfaces (DNIs):

DNI/Socket, based on the 4.4BSD sockets API

DNI/XTI, based on the X/Open XPG4 specification

Work on this standard started in the late 1980s as the P1003.12 working group (later renamed P1003.1g). Throughout this text, we will refer to this standard as POSIX.1g.

The current status of the various POSIX standards is available from

http://www.pasc.org/standing/sd11.html

-----------------------------------------------------------------------------------


Mara 02-21-2005 03:20 AM

What i meas in the real life... Most Linux system functions are POSIX. When you view their manuals, let's say
man 2 time
You have at the end something like
Code:

COMPATIBILITY
      SVr4, SVID, POSIX, X/OPEN, BSD 4.3

If you have POSIX on that list, the function is one you can use.

Just program as usual, but it's be great if you write in pure C (with --ansi switch). But when you're about to use a system call, check its manual and see if you can use it. In practice, you will be able to use nearly all.

v333k 02-28-2005 03:08 PM

THanks!
I think I should be able to go from here on my own!


All times are GMT -5. The time now is 06:14 PM.