Commit Graph

4 Commits

Author SHA1 Message Date
Corinna Vinschen 783133b753 Cygwin: cygtls: drop useless alignment directives
The patch fixing the alignment of _cygtls::context accidentally
pushed the desperate attempt to automate the alignment by using
another, non-working variation of attribute((aligned)).  Drop it.

Fixes: dcab768cb9 ("Cygwin: cygtls: fix context alignment")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-09-05 19:52:28 +02:00
Corinna Vinschen dcab768cb9 Cygwin: cygtls: fix context alignment
A hang was encountered, apparently triggered by commit 63b503916d,
changing tls_pathbufs from malloc'ed to HeapAlloc'ed memory.  After
lengthy debugging it transpired that adding the heap handle to the
tls_pathbuf struct added 8 bytes to the cygtls area, thus moving
the "context" member by 8 bytes, too, so it was suddently unaligned.

Fix this for now by changing the alignment.

Fix this once and for all, by adding code to the gentls_offsets script
to check if the alignment of the "context" member is 16 bytes.  If not,
print a matching error message, remove the just generated file, and exit
with error.

FIXME: It would be really nice to find a way to auomate the correct
alignment of the "context" member, but I don't see any way to use
alignment attributes to get what we need here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-29 15:18:53 +02:00
Corinna Vinschen 63b503916d Cygwin: tls_pathbuf: Use Windows heap
Rather than using malloc/free for the buffers, we're now using
HeapAlloc/HeapFree on a HEAP_NO_SERIALIZE heap created for this
thread.

Advantages:
- Less contention. Our malloc/free doesn't scale well in
  multithreaded scenarios
- Even faster heap allocation by using a non serialized heap.
- Internal, local, temporary data not cluttering the user heap.
- Internal, local, temporary data not copied over to child process
  at fork().

Disadvantage:
- A forked process has to start allocating temporary buffers from
  scratch.  However, this should be alleviated by the fact that
  buffer allocation usually reaches its peak very early in process
  runtime, so the longer the proceess runs, the less buffers have
  to allocated, and, only few processes don't exec after fork
  anyway.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-23 12:09:44 +02:00
Corinna Vinschen 007e23d639 Cygwin: Reorganize cygwin source dir
Create subdirs and move files accordingly:

- DevDocs:  doc files
- fhandler: fhandler sources, split fhandler.cc into base.cc and null.cc
- local_includes: local include files
- scripts:  scripts called during build
- sec:      security sources

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-05 12:02:11 +02:00