Skip to content

Commit

Permalink
iox-#1982 Fix alias naming and used-headers.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubSosnovec committed Jul 7, 2023
1 parent b47a677 commit d1a3f58
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SharedMemoryObject : public FileManagementInterface<SharedMemoryObject>
void* getBaseAddress() noexcept;

/// @brief Returns the underlying file handle of the shared memory
sharedMemoryHandle_t getFileHandle() const noexcept;
shm_handle_t getFileHandle() const noexcept;

/// @brief True if the shared memory has the ownership. False if an already
/// existing shared memory was opened.
Expand All @@ -85,7 +85,7 @@ class SharedMemoryObject : public FileManagementInterface<SharedMemoryObject>
SharedMemoryObject(SharedMemory&& sharedMemory, MemoryMap&& memoryMap) noexcept;

friend struct FileManagementInterface<SharedMemoryObject>;
sharedMemoryHandle_t get_file_handle() const noexcept;
shm_handle_t get_file_handle() const noexcept;

private:
SharedMemory m_sharedMemory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ enum class SharedMemoryError
};

/// @brief Shared memory file descriptor type
using sharedMemoryHandle_t = int;
using shm_handle_t = int;

/// @brief Creates a bare metal shared memory object with the posix functions
/// shm_open, shm_unlink etc.
Expand All @@ -73,7 +73,7 @@ class SharedMemory : public FileManagementInterface<SharedMemory>
~SharedMemory() noexcept;

/// @brief returns the file handle of the shared memory
sharedMemoryHandle_t getHandle() const noexcept;
shm_handle_t getHandle() const noexcept;

/// @brief this class has the ownership of the shared memory when the shared
/// memory was created by this class. This is the case when this class
Expand All @@ -91,7 +91,7 @@ class SharedMemory : public FileManagementInterface<SharedMemory>
friend class SharedMemoryBuilder;

private:
SharedMemory(const Name_t& name, const sharedMemoryHandle_t handle, const bool hasOwnership) noexcept;
SharedMemory(const Name_t& name, const shm_handle_t handle, const bool hasOwnership) noexcept;

bool unlink() noexcept;
bool close() noexcept;
Expand All @@ -101,10 +101,10 @@ class SharedMemory : public FileManagementInterface<SharedMemory>
static SharedMemoryError errnoToEnum(const int32_t errnum) noexcept;

friend struct FileManagementInterface<SharedMemory>;
sharedMemoryHandle_t get_file_handle() const noexcept;
shm_handle_t get_file_handle() const noexcept;

Name_t m_name;
sharedMemoryHandle_t m_handle{INVALID_HANDLE};
shm_handle_t m_handle{INVALID_HANDLE};
bool m_hasOwnership{false};
};

Expand Down
3 changes: 1 addition & 2 deletions iceoryx_hoofs/source/posix_wrapper/posix_access_rights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ PosixUser::groupVector_t PosixUser::getGroups() const noexcept

gid_t userDefaultGroup = getpwnamCall->value->pw_gid;
UninitializedArray<gid_t, MaxNumberOfGroups> groups{}; // groups is initialized in iox_getgrouplist
// iox_getgrouplist expects int
int numGroups = MaxNumberOfGroups;
auto numGroups = MaxNumberOfGroups;

auto getgrouplistCall = posixCall(iox_getgrouplist)(userName->c_str(), userDefaultGroup, &groups[0], &numGroups)
.failureReturnValue(-1)
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_hoofs/source/posix_wrapper/shared_memory_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ void* SharedMemoryObject::getBaseAddress() noexcept
return m_memoryMap.getBaseAddress();
}

sharedMemoryHandle_t SharedMemoryObject::get_file_handle() const noexcept
shm_handle_t SharedMemoryObject::get_file_handle() const noexcept
{
return m_sharedMemory.getHandle();
}

sharedMemoryHandle_t SharedMemoryObject::getFileHandle() const noexcept
shm_handle_t SharedMemoryObject::getFileHandle() const noexcept
{
return m_sharedMemory.getHandle();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ expected<SharedMemory, SharedMemoryError> SharedMemoryBuilder::create() noexcept
}

// the mask will be applied to the permissions, therefore we need to set it to 0
sharedMemoryHandle_t sharedMemoryFileHandle = SharedMemory::INVALID_HANDLE;
shm_handle_t sharedMemoryFileHandle = SharedMemory::INVALID_HANDLE;
mode_t umaskSaved = umask(0U);
{
ScopeGuard umaskGuard([&] { umask(umaskSaved); });
Expand Down Expand Up @@ -155,7 +155,7 @@ expected<SharedMemory, SharedMemoryError> SharedMemoryBuilder::create() noexcept
return success<SharedMemory>(SharedMemory(m_name, sharedMemoryFileHandle, hasOwnership));
}

SharedMemory::SharedMemory(const Name_t& name, const sharedMemoryHandle_t handle, const bool hasOwnership) noexcept
SharedMemory::SharedMemory(const Name_t& name, const shm_handle_t handle, const bool hasOwnership) noexcept
: m_name{name}
, m_handle{handle}
, m_hasOwnership{hasOwnership}
Expand Down Expand Up @@ -200,12 +200,12 @@ SharedMemory& SharedMemory::operator=(SharedMemory&& rhs) noexcept
return *this;
}

sharedMemoryHandle_t SharedMemory::getHandle() const noexcept
shm_handle_t SharedMemory::getHandle() const noexcept
{
return m_handle;
}

sharedMemoryHandle_t SharedMemory::get_file_handle() const noexcept
shm_handle_t SharedMemory::get_file_handle() const noexcept
{
return m_handle;
}
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_posh/test/moduletests/test_mepoo_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class MePooSegment_test : public Test
remove("/tmp/roudi_segment_test");
}

sharedMemoryHandle_t getFileHandle()
shm_handle_t getFileHandle()
{
return filehandle;
}
Expand All @@ -90,7 +90,7 @@ class MePooSegment_test : public Test
void* m_baseAddressHint{nullptr};
static constexpr int MEM_SIZE = 100000;
char memory[MEM_SIZE];
sharedMemoryHandle_t filehandle;
shm_handle_t filehandle;
static createFct createVerificator;
};

Expand Down
1 change: 1 addition & 0 deletions tools/scripts/used-headers.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# QNX platform / libc headers
arpa/inet.h
climits
csignal
cstdint
cstdio
dlfcn.h
Expand Down

0 comments on commit d1a3f58

Please sign in to comment.