[PATCH][RESEND] apply the struct dirent penalty only when needed

Rolf Eike Beer eb at emlix.com
Thu Oct 12 20:57:19 AEDT 2017


Hi,

attached is a patch that reduces the memory in use on all systems where 
BROKEN_ONE_BYTE_DIRENT_D_NAME is not defined.

It would be good if there was a ac_something variable that could be given to 
configure to tell it if this workaround is needed or not when cross compiling. 
We currently do it another way after running configure:

====
cat >>conftest.c <<EOF
#include <sys/types.h>
#include <dirent.h>
#include <assert.h>

int
main()
{
        struct dirent d;
        static_assert(sizeof(d.d_name) > sizeof(char), "struct to small");

        return 0;
}
EOF

${target_platform}-gcc ${optflags} conftest.c && \
        sed -ri 's/#define (BROKEN_ONE_BYTE_DIRENT_D_NAME) 1/#undef \1/' 
config.h
====

Of course that only works when one has a compiler that is new enough (what we 
can guarantee).

Greetings,

Eike
-- 
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Bertha-von-Suttner-Str. 9, 37085 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix – smart embedded open source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-apply-the-struct-dirent-penalty-only-when-needed.patch
Type: text/x-patch
Size: 1385 bytes
Desc: not available
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20171012/adbffe3c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 313 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20171012/adbffe3c/attachment.asc>


More information about the openssh-unix-dev mailing list