diff --git a/test/ipc/unixsocket.cpp b/test/ipc/unixsocket.cpp
index f44ab9c90e25..2546882da085 100644
--- a/test/ipc/unixsocket.cpp
+++ b/test/ipc/unixsocket.cpp
@@ -34,6 +34,8 @@ using namespace libcamera;
 using namespace std;
 using namespace std::chrono_literals;
 
+namespace {
+
 int calculateLength(int fd)
 {
 	lseek(fd, 0, 0);
@@ -43,6 +45,8 @@ int calculateLength(int fd)
 	return size;
 }
 
+} /* namespace */
+
 class UnixSocketTestSlave
 {
 public:
