Ignore:
Timestamp:
2013-07-10T08:58:49Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3908355, 4c53333
Parents:
30c1b75 (diff), 98abd40 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Extending POSIX library

Merge from lp:~vojtech-horky/helenos/gcc-port.

This is work-in-progress merge from branch aimed at bringing GCC to run
inside HelenOS.

The most notable change is dealing with the name clashes in libposix and
libc. For ported applications, the libposix headers looks as normal
POSIX headers and there is no need to do preprocessor-based renaming inside
the ported application. The renaming is done inside object files instead.
See revision 1745 in lp:~vojtech-horky/helenos/gcc-port [1] for more
detailed explanation.
The solution is definitely not perfect but shall deal with the naming
conflicts in much safer manner than using the redefines.

There were some other changes as well, mostly small ones.

  • Add some functions, some as ToDo ones (i.e. empty implementation).
  • Add more POSIX headers, split some existing.

[1] http://bazaar.launchpad.net/~vojtech-horky/helenos/gcc-port/revision/1745

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/include/posix/sys/stat.h

    r30c1b75 rc8bb1633  
    3939#include "types.h"
    4040#include "../time.h"
     41
     42#ifndef __POSIX_DEF__
     43#define __POSIX_DEF__(x) x
     44#endif
    4145
    4246/* values are the same as on Linux */
     
    108112#define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
    109113
    110 struct posix_stat {
    111         posix_dev_t     st_dev;     /* ID of device containing file */
    112         posix_ino_t     st_ino;     /* inode number */
     114struct __POSIX_DEF__(stat) {
     115        __POSIX_DEF__(dev_t)     st_dev;     /* ID of device containing file */
     116        __POSIX_DEF__(ino_t)     st_ino;     /* inode number */
    113117        mode_t          st_mode;    /* protection */
    114         posix_nlink_t   st_nlink;   /* number of hard links */
    115         posix_uid_t     st_uid;     /* user ID of owner */
    116         posix_gid_t     st_gid;     /* group ID of owner */
    117         posix_dev_t     st_rdev;    /* device ID (if special file) */
    118         posix_off_t     st_size;    /* total size, in bytes */
    119         posix_blksize_t st_blksize; /* blocksize for file system I/O */
    120         posix_blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
     118        __POSIX_DEF__(nlink_t)   st_nlink;   /* number of hard links */
     119        __POSIX_DEF__(uid_t)     st_uid;     /* user ID of owner */
     120        __POSIX_DEF__(gid_t)     st_gid;     /* group ID of owner */
     121        __POSIX_DEF__(dev_t)     st_rdev;    /* device ID (if special file) */
     122        __POSIX_DEF__(off_t)     st_size;    /* total size, in bytes */
     123        __POSIX_DEF__(blksize_t) st_blksize; /* blocksize for file system I/O */
     124        __POSIX_DEF__(blkcnt_t)  st_blocks;  /* number of 512B blocks allocated */
    121125        time_t          st_atime;   /* time of last access */
    122126        time_t          st_mtime;   /* time of last modification */
     
    124128};
    125129
    126 extern int posix_fstat(int fd, struct posix_stat *st);
    127 extern int posix_lstat(const char *restrict path, struct posix_stat *restrict st);
    128 extern int posix_stat(const char *restrict path, struct posix_stat *restrict st);
    129 extern int posix_chmod(const char *path, mode_t mode);
    130 extern mode_t posix_umask(mode_t mask);
     130extern int __POSIX_DEF__(fstat)(int fd, struct __POSIX_DEF__(stat) *st);
     131extern int __POSIX_DEF__(lstat)(const char *restrict path, struct __POSIX_DEF__(stat) *restrict st);
     132extern int __POSIX_DEF__(stat)(const char *restrict path, struct __POSIX_DEF__(stat) *restrict st);
     133extern int __POSIX_DEF__(chmod)(const char *path, mode_t mode);
     134extern mode_t __POSIX_DEF__(umask)(mode_t mask);
    131135extern int mkdir(const char *, mode_t);
    132136
    133 #ifndef LIBPOSIX_INTERNAL
    134         #define fstat posix_fstat
    135         #define lstat posix_lstat
    136         #define stat posix_stat
    137         #define chmod posix_chmod
    138         #define umask posix_umask
    139 #endif
    140137
    141138#endif /* POSIX_SYS_STAT_H */
Note: See TracChangeset for help on using the changeset viewer.