Xenomai 3.1 missing munmap Posix wrapper
Hello Everybody,
I just migrated from 2.6.2.1. to 3.1 and run into an issue in my user mode application.
The Posix wrapper for the munmap() function is missing. I mean the cobalt.wrappers file does not have a --wrap munmap line and the library does not have the function either. Why is that? The mmap wrapper is there. I need to unmap the memory before closing the file descriptor. At least I did it this way in my old sources. Can I skip the munmap() call in this new Xenomai version before closing the descriptor?
Than you,
Tamas
Quoted 5 lines · Paal Tamas via Xenomai
Hello Everybody,
I just migrated from 2.6.2.1. to 3.1 and run into an issue in my user mode application.
The Posix wrapper for themunmap()function is missing. I mean the cobalt.wrappers file does not have a --wrap munmap line and the library does not have the function either. Why is that? The mmap wrapper is there. I need to unmap the memory before closing the file descriptor. At least I did it this way in my old sources. Can I skip themunmap()call in this new Xenomai version before closing the descriptor?
You mmap memory against an RTDM device handle, the only difference to mmap against a Linux device is who provides the memory. Releasing that mapping is just the same as with Linux: call munmap.
If your driver has anything to do on release, register vmops with the backing vma. See e.g. spi_master_mmap.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Quoted 6 lines
Quoted 5 lines
Hello Everybody,
I just migrated from 2.6.2.1. to 3.1 and run into an issue in my user mode application.
The Posix wrapper for themunmap()function is missing. I mean the cobalt.wrappers file does not have a --wrap munmap line and the library does not have the function either. Why is that? The mmap wrapper is there. I need to unmap the memory before closing the file descriptor. At least I did it this way in my old sources. Can I skip themunmap()call in this new Xenomai version before closing the descriptor?
Quoted 9 lines
You mmap memory against an RTDM device handle, the only difference to mmap against a Linux device is who provides the memory. Releasing that mapping is just the same as with Linux: call munmap.
If your driver has anything to do on release, register vmops with the backing vma. See e.g.
spi_master_mmap.Jan
This is an ARM system (MX6) where I use the external parallel bus of the CPU to communicate with an FPGA in a real-time fashion in user mode. I need to access memory mapped registers of the CPU during the configuration of the CPU external bus interface, and the address range I use to "access" the FPGA is mapped to memory as well. In the old 2.6.2.1 system I was using the mmap() and munmap() wrapper functions for this purpose. I linked only Xenomai libraries to my executable. Do you mean I should not use the mmap() wrapper from the cobalt library anymore. Use the Linux equivalent in 3.1? Will it not lead to any trouble? I mean will I not switch to secondary mode when I access the memory I mapped this way for example?
Thanks,
Tamas
Quoted 10 lines · Paal Tamas
Quoted 10 lines
Quoted 5 lines
Hello Everybody,
I just migrated from 2.6.2.1. to 3.1 and run into an issue in my user mode application.
The Posix wrapper for themunmap()function is missing. I mean the cobalt.wrappers file does not have a --wrap munmap line and the library does not have the function either. Why is that? The mmap wrapper is there. I need to unmap the memory before closing the file descriptor. At least I did it this way in my old sources. Can I skip themunmap()call in this new Xenomai version before closing the descriptor?You mmap memory against an RTDM device handle, the only difference to mmap against a Linux device is who provides the memory. Releasing that mapping is just the same as with Linux: call munmap.
Quoted 8 lines
Quoted 5 lines
If your driver has anything to do on release, register vmops with the backing vma. See e.g.
spi_master_mmap.Jan
This is an ARM system (MX6) where I use the external parallel bus of the CPU to communicate with an FPGA in a real-time fashion in user mode. I need to access memory mapped registers of the CPU during the configuration of the CPU external bus interface, and the address range I use to "access" the FPGA is mapped to memory as well. In the old 2.6.2.1 system I was using the
mmap()andmunmap()wrapper functions for this purpose. I linked only Xenomai libraries to my executable. Do you mean I should not use themmap()wrapper from the cobalt library anymore. Use the Linux equivalent in 3.1? Will it not lead to any trouble? I mean will I not switch to secondary mode when I access the memory I mapped this way for example?
Mapping an unmapping were never time sensitive operations. No magic happened when they were executed, memory locking was the magic to ensure that backing memory is always available on access (but even that is unrelated when we talk about device memory, e.g. MMIO).
The only reason for mmap being wrapped is that it can be used on resources (represented by RTDM file descriptors) the Linux kernel itself has no knowledge about, only Xenomai. If you use mmap to map /dev/mem, ie. without a proper kernel driver, this will continue to work as before.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Quoted 24 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Hello Everybody,
I just migrated from 2.6.2.1. to 3.1 and run into an issue in my user mode application.
The Posix wrapper for themunmap()function is missing. I mean the cobalt.wrappers file does not have a --wrap munmap line and the library does not have the function either. Why is that? The mmap wrapper is there. I need to unmap the memory before closing the file descriptor. At least I did it this way in my old sources. Can I skip themunmap()call in this new Xenomai version before closing the descriptor?You mmap memory against an RTDM device handle, the only difference to mmap against a Linux device is who provides the memory. Releasing that mapping is just the same as with Linux: call munmap.
Quoted 8 lines
Quoted 5 lines
If your driver has anything to do on release, register vmops with the backing vma. See e.g.
spi_master_mmap.Jan
This is an ARM system (MX6) where I use the external parallel bus of the CPU to communicate with an FPGA in a real-time fashion in user mode. I need to access memory mapped registers of the CPU during the configuration of the CPU external bus interface, and the address range I use to "access" the FPGA is mapped to memory as well. In the old 2.6.2.1 system I was using the
mmap()andmunmap()wrapper functions for this purpose. I linked only Xenomai libraries to my executable. Do you mean I should not use themmap()wrapper from the cobalt library anymore. Use the Linux equivalent in 3.1? Will it not lead to any trouble? I mean will I not switch to secondary mode when I access the memory I mapped this way for example?Mapping an unmapping were never time sensitive operations. No magic happened when they were executed, memory locking was the magic to ensure that backing memory is always available on access (but even that is unrelated when we talk about device memory, e.g. MMIO).
Quoted 7 lines
The only reason for mmap being wrapped is that it can be used on resources (represented by RTDM file descriptors) the Linux kernel itself has no knowledge about, only Xenomai. If you use mmap to map
/dev/mem, ie. without a proper kernel driver, this will continue to work as before.Jan
Understood. Thank you very much for the explanation.
What I did technically is removed the mmap and munmap wrappers from my makefile. This led to an error-free compilation. I assume the Linux libraries got into the business this way... Thanks again,
Tamas