Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_suite_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
export JAVA_HOME=/usr/lib/jvm/java-${{ matrix.JAVA_VERSION }}-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export LIBGL_ALWAYS_SOFTWARE=true
xvfb-run --auto-servernum make distrib -j4
xvfb-run --auto-servernum make debug -j4
- name: Create/Update GitHub release
if: ${{ matrix.os == 'ubuntu-22.04' && (github.event_name == 'push' || github.event_name == 'schedule') }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_suite_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
export JAVA_HOME="$(/usr/libexec/java_home -v 16)"
export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin/:$PATH
make distrib -j4
make debug -j4
- name: Create/Update GitHub release
if: ${{ (github.event_name == 'push' || github.event_name == 'schedule') }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_suite_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Webots Package Creation
run: |
export WEBOTS_HOME=$GITHUB_WORKSPACE
make distrib -j4
make debug -j4
- name: Create/Update GitHub release
if: ${{ (github.event_name == 'push' || github.event_name == 'schedule') }}
run: |
Expand Down
1 change: 1 addition & 0 deletions docs/reference/changelog-r2025.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Added implementations of `wbu_system_tmpdir` and `wbu_system_webots_instance_path` to the MATLAB API ([#6756](https://github.com/cyberbotics/webots/pull/6756)).
- Added missing import libraries on Windows ([#6753](https://github.com/cyberbotics/webots/pull/6753)).
- Added some missing function definitions to the existing Windows libraries ([#6753](https://github.com/cyberbotics/webots/pull/6753)).
- Webots now prints the cause when it fails to create a memory-mapped file for a camera node ([#6896](https://github.com/cyberbotics/webots/pull/6896)).
- Cleanup
- **Removed `libController.a` and `libCppController.a` libraries on Windows. Please use `Controller.lib` and `CppController.lib` instead ([#6753](https://github.com/cyberbotics/webots/pull/6753)).**
- Bug Fixes
Expand Down
14 changes: 11 additions & 3 deletions src/webots/core/WbPosixMemoryMappedFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

#include "WbPosixMemoryMappedFile.hpp"

#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>

Expand All @@ -30,14 +32,20 @@ WbPosixMemoryMappedFile::~WbPosixMemoryMappedFile() {
bool WbPosixMemoryMappedFile::create(int size) {
unlink(mName.toUtf8()); // delete a possibly existing memory mapped file with the same name
int fd = open(mName.toUtf8(), O_CREAT | O_RDWR, 0666); // returns -1 in case of failure
if (fd < 0)
if (fd < 0) {
mErrorString = QString("Cannot open file: %1 (%2)").arg(mName).arg(strerror(errno));
return false;
if (ftruncate(fd, size) == -1)
}
if (ftruncate(fd, size) == -1) {
mErrorString = QString("Cannot truncate file: %1 (%2)").arg(mName).arg(strerror(errno));
return false;
}
mData = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0);
close(fd);
if (mData == MAP_FAILED)
if (mData == MAP_FAILED) {
mErrorString = QString("Cannot map file: %1 (%2)").arg(mName).arg(strerror(errno));
return false;
}
mSize = size;
return true;
}
2 changes: 2 additions & 0 deletions src/webots/core/WbPosixMemoryMappedFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ class WbPosixMemoryMappedFile {
int size() const { return mSize; }
void *data() const { return mData; }
const QString &nativeKey() const { return mName; }
const QString &errorString() const { return mErrorString; }

private:
QString mName;
int mSize;
void *mData;
QString mErrorString;
};

#endif
3 changes: 2 additions & 1 deletion src/webots/nodes/WbAbstractCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ WbMemoryMappedFile *WbAbstractCamera::initializeMemoryMappedFile(const QString &
if (imageMemoryMappedFile->attach())
imageMemoryMappedFile->detach();
if (!imageMemoryMappedFile->create(size())) {
const QString message = tr("Cannot allocate memory mapped file for camera image.");
const QString message =
tr("Cannot allocate memory mapped file for camera image.\nCaused by: %1.").arg(imageMemoryMappedFile->errorString());
warn(message);
delete imageMemoryMappedFile;
return NULL;
Expand Down
Loading