[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] STAT bits - Ouch!



On Thu, 2010-12-09 at 10:27 +0100, Vincent Rivière wrote:
> Alan Hourihane wrote:
> > Given, pretty much, every unix'ish style OS defines these....
> >
> > #define __S_IFDIR       0040000 /* Directory.  */
> > #define __S_IFCHR       0020000 /* Character device.  */
> > #define __S_IFBLK       0060000 /* Block device.  */
> > #define __S_IFREG       0100000 /* Regular file.  */
> > #define __S_IFIFO       0010000 /* FIFO.  */
> > #define __S_IFLNK       0120000 /* Symbolic link.  */
> > #define __S_IFSOCK      0140000 /* Socket.  */
> >
> > On FreeMiNT, we do this....
> >
> > #define __S_IFDIR       0040000 /* Directory.  */
> > #define __S_IFCHR       0020000 /* Character device.  */
> > #define __S_IFBLK       0060000 /* Block device.  */
> > #define __S_IFREG       0100000 /* Regular file.  */
> > #define __S_IFIFO       0120000 /* FIFO.  */
> > #define __S_IFLNK       0160000 /* Symbolic link.  */
> > #define __S_IFSOCK      0010000 /* Socket.  */
> 
> Compatibility issues are always critical...

Indeed.

> Are the UNIX values really the same on every other OS ?

Maybe if you go back 20 years (as for FreeMiNT) it may not have been,
but certainly from what I've seen it is for current OS's.

> If they are different on FreeMiNT, maybe there was a good reason in 
> early days ? Or maybe a simple typo ?

There is no standard for these values, so it was always open to
redefinition. Everyone assumes that the programmer uses things
correctly, but it's not always the case :-<

> For me the best solution would be to switch FreeMiNT to the standard 
> values, and recompile every software against the new MiNTLib... but of 
> course it is unrealistic.

Of course, that's unrealistic. I have proposed a solution which keeps
backwards compatibility for everything out there. We just move forward
with new values.

Alan.