Changeset bc56f30 in mainline for uspace/lib/posix/src/sys/mman.c


Ignore:
Timestamp:
2019-05-27T12:38:26Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0d14c25
Parents:
4d51c60
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-13 16:06:49)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-27 12:38:26)
Message:

Make some libc and libposix headers usable in C++

These headers either get included from standard C++ headers,
or are standard themselves, which means any unnamespaced nonstandard
identifiers are a problem. This commit attempts to fix those
issues, and removes hacks previously used in libcpp to work around it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/src/sys/mman.c

    r4d51c60 rbc56f30  
    3939#include <unistd.h>
    4040
     41static int _prot_to_as(int prot)
     42{
     43        int ret = 0;
     44
     45        if (prot & PROT_READ)
     46                ret |= AS_AREA_READ;
     47
     48        if (prot & PROT_WRITE)
     49                ret |= AS_AREA_WRITE;
     50
     51        if (prot & PROT_EXEC)
     52                ret |= AS_AREA_EXEC;
     53
     54        return ret;
     55}
     56
    4157void *mmap(void *start, size_t length, int prot, int flags, int fd,
    4258    off_t offset)
     
    5369                return MAP_FAILED;
    5470
    55         return as_area_create(start, length, prot, AS_AREA_UNPAGED);
     71        return as_area_create(start, length, _prot_to_as(prot), AS_AREA_UNPAGED);
    5672}
    5773
Note: See TracChangeset for help on using the changeset viewer.