summaryrefslogtreecommitdiffstats
path: root/rtemsbsd
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-07-02 08:21:37 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-07-04 07:20:37 +0200
commit94b5368388f51b535256b65d278998a48b0c4a3f (patch)
tree2e8b568f20af185ded11a246cc08be6c1175202a /rtemsbsd
parentBPF(9): Pass flags to bpfopen() (diff)
downloadrtems-libbsd-94b5368388f51b535256b65d278998a48b0c4a3f.tar.bz2
Avoid malloc() in getsockaddr()
The getsockaddr() function is used to allocate a struct sockaddr of the right length and initialize it with userspace provided data. It is used for the connect(), bind() and sendit() family functions. In particular, the sendit() function is used by the UDP send functions. This means each UDP send needs a malloc() and free() invocation. This is a performance problem in RTEMS (first-fit heap) and may lead to heap fragmentation. Replace the malloc() allocation with a stack allocation. This requires SOCK_MAXADDRLEN (= 255) of additional stack space for libbsd. A further optimization would be to get rid of the stack copy of the socket address. However, this would require to check each consumer of the address to ensure that it is not modified.
Diffstat (limited to 'rtemsbsd')
-rw-r--r--rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
index 0a9c6bbf..7f265785 100644
--- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
+++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
@@ -1178,7 +1178,6 @@
#define GetProxyAddress _bsd_GetProxyAddress
#define GetProxyPort _bsd_GetProxyPort
#define get_random_bytes _bsd_get_random_bytes
-#define getsockaddr _bsd_getsockaddr
#define GetStateIn _bsd_GetStateIn
#define GetStateOut _bsd_GetStateOut
#define gf128_genmultable _bsd_gf128_genmultable