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

Re: [MiNT] stat() file mode



W dniu 25.08.2011 20:08, Alan Hourihane pisze:
On 08/25/11 18:48, Adam Kłobukowski wrote:
Hi

I'd like to propose to modify MiNTLib a little bit.

Currently, we have following file modes defined (from bits/stat.h)

#define __S_IFSOCK<---->0010000>/* Socket.  */
#define>__S_IFCHR<----->0020000>/* Character device.  */
#define>__S_IFDIR<----->0040000>/* Directory.  */
#define __S_IFBLK<----->0060000>/* Block device.  */
#define>__S_IFREG<----->0100000>/* Regular file.  */
#define __S_IFIFO<----->0120000>/* FIFO.  */
#define __S_IFMEM<----->0140000 /* memory region or process */
#define>__S_IFLNK<----->0160000>/* Symbolic link.  */

Those values come directly from kernel (Fxattr())

Unfortunately, modern unices (Linux most notably) define they a bit
different:

* File types.  */
#define>__S_IFIFO<----->0010000>/* FIFO.  */
#define>__S_IFCHR<----->0020000>/* Character device.  */
#define>__S_IFDIR<----->0040000>/* Directory.  */
#define>__S_IFBLK<----->0060000>/* Block device.  */
#define>__S_IFREG<----->0100000>/* Regular file.  */
#define>__S_IFLNK<----->0120000>/* Symbolic link.  */
#define>__S_IFSOCK<---->0140000>/* Socket.  */

I propose to bring our definition on par with Linux definition. This
will ease porting software.

Now, The Plan:
  - we can't change kernel definition obiviously, so it stays the same,
nothing breaks
  - we benefit from static linking of out libraries. I'll add simple
wrapper function to translate from kernel values to new MiNTLib
values. The overhead should not be noticeable. This should only matter
for stat() and friends, but I'll make a through search to be sure.

Anyone against?


I brought this up a little while ago. Might want to check the archives.

Alan.

I could only fins this: http://sparemint.atariforge.net/mailinglist/Mailing-Lists/MiNT-List.200908/1251327195.19057.36.camel@jetpack.demon.co.uk.text and it is about stat(), but not about file mode. Can you please give me a hint?

AdamK