Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

POSIX 1003.1 Compliance and lstat() functionality

Posted on 1997-10-30
2
Medium Priority
?
314 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 240 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

722 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