Changeset 94b5368 in rtems-libbsd for freebsd/sys

Timestamp:
07/02/18 06:21:37 (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, 5-freebsd-12, 388d46bb1b3080402c68ae11d14b2b36c3138952, 89db1bb27c9d52164a78dc2fda0a2ba9da0920ef
Children:
6fb003f
Parents:
e6f6b5e
git-author:
Sebastian Huber <sebastian.huber@…> (07/02/18 06:21:37)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/04/18 05:20:37)
Message:

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.

(No files)

Note: See TracChangeset for help on using the changeset viewer.