[PATCH v2 09/18] ptpd: Add malloc definitions for RTEMS

Gabriel Moyano gabriel.moyano at dlr.de
Mon Apr 17 07:59:22 UTC 2023


From: Chris Johns <chrisj at rtems.org>

---
 rtemsbsd/ptpd/src/dep/sys.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/rtemsbsd/ptpd/src/dep/sys.c b/rtemsbsd/ptpd/src/dep/sys.c
index b5831701..6c93bf4c 100644
--- a/rtemsbsd/ptpd/src/dep/sys.c
+++ b/rtemsbsd/ptpd/src/dep/sys.c
@@ -2668,3 +2668,19 @@ int setCpuAffinity(int cpu) {
 return -1;
 
 }
+
+#if __rtems__
+void *malloc (size_t n);
+
+/* Allocate an N-byte block of memory from the heap.
+   If N is zero, allocate a 1-byte block.  */
+
+void *
+rpl_malloc (size_t n)
+{
+  if (n == 0)
+    n = 1;
+  return malloc (n);
+}
+
+#endif /* __rtems__ */
-- 
2.25.1



More information about the devel mailing list