たとえば、マニュアルページには次のように書かれています:
The mmap() function shall fail if:
EACCES
The fildes argument is not open for read, regardless of the protection specified,
fildes is not open for write and PROT_WRITE was specified for a MAP_SHARED type
mapping.
他にもたくさんのケースがあります。どのエラーが発生したかを確認する方法があると思いますが、1時間検索しても何も得られませんでした。その特定のエラーが発生したかどうかをどのように確認しますか?