summaryrefslogtreecommitdiffstats
path: root/testsuite
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 /testsuite
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 'testsuite')
0 files changed, 0 insertions, 0 deletions