Solved

POSIX 1003.1 Compliance and lstat() functionality

Posted on 1997-10-30
2
305 Views
Last Modified: 2013-12-26
In order to better understand what is meant by POSIX compliance, I would like to pose the following question/scenario. I am using a version of UNIX that is stated to be POSIX 1003.1 compliant and I would like to compile and run a C program in POSIX mode that utilizes the lstat() function. The POSIX 1003.1 standard does not include Berkeley-style symbolic file links. Symbolic links were not included in the standard until POSIX 1003.1b. Therefore, the lstat() function is not part of the POSIX standard that my system conforms to. What should happen or be expected to happen when I try to compile this program specifying POSIX compliance.

a) A fatal error should occur during compile/link time.
b) The program should compile/link with warnings.
c) The program should compile/link without warnings.

If the program does compile, what should happen when the lstat() function is performed during execution of the program.

a) The program should generate a run-time error.
b) The lstat() function should work properly as defined by the ANSI C or K&R standard.
c) Since the lstat() function is not part of this POSIX standard, it can behave any way it chooses which includes giving totally erroneous results.

Since POSIX is an evolving standard, does it attempt to define expected results from functions that are not yet part of the standard but part of the systems C programming environment?. I would be interested in any responses or comments to this question. As a note, my system returns erroneous results when the lstat() function is performed, improperly mapped stat structure elements, which I have been informed is totally acceptable performance.

0
Comment
Question by:condon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 80 total points
ID: 1295469
At compile time:
--> a) A fatal error should occur during compile/link time.

because your POSIX compliant include files do not have an lstat().

Of cource, if you use non-POSIX compliant includes beside the
POSIX onse, the compiler could not report this as an error.
I think it depends on the compiler if it detects at least a
warning.


After compiling you have to link. If you allow non-POSIX libs
here, your program will run without problems (probably).


POSIX standard does not prevent you using none-POSIX functions.
0
 

Author Comment

by:condon
ID: 1295470
This scenario has been tested on three versions of UNIX. Sun, UNISYS SVR4 and UnixWare. The Sun does not warn during compile and link and the executable performs correctly. The other UNIX versions both compile without warnings despite setting the compiler for standard comformance, but give invalid results at run-time. The SVR4 system and UnixWare do not appear to have a set of POSIX header files as opposed to non-POSIX. The variances between the two modes is accomplished via #if/#else macro constructs in the one set of header files. Also, on these systems there are no POSIX libraries per say. It appears that the functions operate in either POSIX or non-POSIX modes determined at run-time possibly by some global flag. Also, there is a function called _lxstat() in the stat.h file that uses one aditional parameter which appears to be a mode value indicator. If I call this low level function with a value of 1, it works properly in POSIX mode but if I use a value of 2, it gives the same improper results as I see when calling lstat() in POSIX mode. I assume lstat() calls _lxstat() and passes an incorrect mode value when running in POSIX mode.

Thanks for your answer and if you have any additional input please forward it to me.

Regards,
Joe Condon

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Include multiple hostnames in this command? 3 55
Replacement selected text 2 66
sameEnds challenge 3 187
move a line in eclipse 3 109
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question