| 366 | === 15) '''void* giet_fat_mmap'''( void* vaddr , unsigned int length , unsigned int prot , unsigned int flags , unsigned int fd_id , unsigned int offset ) === |
| 367 | This function has the same semantic as the UNIX <mmap()> function. |
| 368 | It allocates as many small pages (4 Kbytes) as defined by the <length> argument, from the MMAP vseg of the calling vspace. |
| 369 | It maps all these pages directly to the file_cache as defined by the <fd_id> and offset arguments. |
| 370 | Both <length> and <offset> are bytes numbers. |
| 371 | The supported values for the <prot> argument are : MAP_PROT_READ / MAP_PROT_WRITE / MAP_PROT_EXEC (can be ored). |
| 372 | It has the following limitations: |
| 373 | * it does not support the MAP_PRIVATE flag : all write are seen by all threads. |
| 374 | * it does not support the MAP_FIXED flag : the <vaddr> argument is not used. |
| 375 | * it does not support the MAP_ANONYMOUS flog : only file mapping. |
| 376 | * The only supported value for the <flags> argument is MAP_SHARED. |
| 377 | * The <length> and <offset> arguments must be multiple of 4 Kbytes. |
| 378 | |
| 379 | Returns a pointer on the allocated buffer in user space (from the MMAP space). |
| 380 | Returns NULL in case of error (illegal arguments). |
| 381 | |
| 382 | === 16) '''int giet_fat_munmap'''( void* vaddr , unsigned int length ) === |
| 383 | This function has the same semantic as the UNIX <munmap()> function. |
| 384 | It desallocates as many small pages (4 Kbytes) as defined by the <vaddr> and <length> arguments from the MMAP vseg of the calling space. |
| 385 | The dirty pages will be written on disk when the mapped file is closed. |
| 386 | It has the following limitations: |
| 387 | * The <vaddr> argument must be in the MMAP vseg. |
| 388 | * The <length> argument must be multiple of 4 Kbytes. |
| 389 | |
| 390 | Returns 0 in case of success. |
| 391 | Returns -1 in case of error (illegal arguments). |
| 392 | |