Mark Geisert | 9 Mar 09:39 2016

[PATCH] Support profiling of multi-threaded apps.

This is Version 3 incorporating review comments of Version 2.  This is just the 
code patch; a separate doc patch is forthcoming.

Change log relative to winsup/cygwin:

         * include/sys/cygwin.h: Add CW_CYGHEAP_PROFTHR_ALL.
         * cygheap.cc (cygheap_profthr_all): New C-callable function that
         runs cygheap's threadlist handing each pthread's thread handle in
         turn to profthr_byhandle().
         * external.cc (cygwin_internal): Add case CW_CYGHEAP_PROFTHR_ALL.
         * gmon.c (_mcleanup): Add support for multiple simultaneous
         gmon.out* files named via environment variable GMON_OUT_PREFIX.
         * gmon.h (struct gmonparam): Make state decl volatile.
         * mcount.c (_MCOUNT_DECL): Change stores into gmonparam.state to use
         Interlocked operations. Add #include "winsup.h", update commentary.
         * profil.c (profthr_byhandle): New function abstracting out the
         updating of profile counters based on a thread handle.
         (profthr_func): Update to call profthr_byhandle() to sample the main
         thread then call cygheap_profthr_all() indirectly through
         cygwin_internal(CW_CYGHEAP_PROFTHR_ALL) to sample all other threads.
         (profile_off): Zero targthr to indicate profiling was turned off.
         (profile_on): Fix handle leak on failure path.
         (profile_child): New callback func to restart profiling in child
         process after a fork if the parent was being profiled.
         (profile_ctl): Call pthread_atfork() to set profile_child callback.

Thanks,

..mark
(Continue reading)

Jon Turney | 8 Mar 12:14 2016
Picon
Gravatar

[PATCH] faq: Sort BLODA list and update advice on fixing fork failures

	* faq-using.xml(bloda): Alphabetically sort BLODA list for ease of
	finding things in it.  (fixing-fork-failures) Update to suggest
	rebase-trigger rather than running rebaseall via dash yourself.
	Mention detect_bloda CYGWIN token.

Signed-off-by: Jon Turney <jon.turney <at> dronecode.org.uk>
---
 winsup/doc/faq-using.xml | 88 ++++++++++++++++++++++++++++++------------------
 1 file changed, 56 insertions(+), 32 deletions(-)

diff --git a/winsup/doc/faq-using.xml b/winsup/doc/faq-using.xml
index ae72145..9194677 100644
--- a/winsup/doc/faq-using.xml
+++ b/winsup/doc/faq-using.xml
 <at>  <at>  -1286,39 +1286,39  <at>  <at>  behaviour which affect the operation of other programs, such as Cygwin.
 </para>
 <para>Among the software that has been found to cause difficulties are:</para>
 <para><itemizedlist>
-<listitem><para>Sonic Solutions burning software containing DLA component (when DLA disabled)</para></listitem>
-<listitem><para>Norton/McAfee/Symantec antivirus or antispyware</para></listitem>
-<listitem><para>Logitech webcam software with "Logitech process monitor" service</para></listitem>
-<listitem><para>Kerio, Agnitum or ZoneAlarm Personal Firewall</para></listitem>
-<listitem><para>Iolo System Mechanic/AntiVirus/Firewall</para></listitem>
-<listitem><para>LanDesk</para></listitem>
-<listitem><para>Windows Defender </para></listitem>
-<listitem><para>Various programs by Wave Systems Corp using wxvault.dll, including Embassy Trust
Suite and Embassy Security Center</para></listitem>
-<listitem><para>NOD32 Antivirus</para></listitem>
-<listitem><para>ByteMobile laptop optimization client</para></listitem>
-<listitem><para>Earthlink Total-Access</para></listitem>
(Continue reading)

Alexey Sokolov | 4 Mar 20:56 2016
Picon

[PATCH] Mention 64-bit Cygwin as another remedy for fork() failures.

Hello, patch to FAQ is attached.

--

-- 
Alexey Sokolov | SRE, Software Engineer | sokolov <at> google.com | +353 87 3767 850
Patrick Bendorf | 29 Feb 08:12 2016
Picon

[PATCH] ccwrap: fix build with non-english locale set

/winsup/
* ccwrap: fix build with non-english locale set
---
  winsup/ccwrap | 1 +
  1 file changed, 1 insertion(+)

diff --git a/winsup/ccwrap b/winsup/ccwrap
index 7580e7a..ef83085 100755
--- a/winsup/ccwrap
+++ b/winsup/ccwrap
 <at>  <at>  -12,6 +12,7  <at>  <at>  if ($ARGV[0] ne '++') {
      $cxx = 1;
  }
  die "$0: $ccorcxx environment variable does not exist\n" unless exists 
$ENV{$ccorcxx};
+$ENV{'LANG'} = 'C.UTF-8';
  my  <at> compiler = split ' ', $ENV{$ccorcxx};
  if (" <at> ARGV" !~ / -nostdinc/o) {
      my $fd;
--
2.7.0

Mark Geisert | 20 Feb 09:16 2016

[PATCH] gprof profiling of multi-threaded Cygwin programs, ver 2

Version 2 incorporating review comments of version 1.

Change log relative to winsup/cygwin:

         * include/sys/cygwin.h: Add CW_CYGHEAP_PROFTHR_ALL.
         * cygheap.cc (cygheap_profthr_all): New C-callable function that
         runs cygheap's threadlist handing each pthread's thread handle in
         turn to profthr_byhandle().
         * external.cc (cygwin_internal): Add case CW_CYGHEAP_PROFTHR_ALL.
         * gmon.c (_mcleanup): Add support for multiple simultaneous
         gmon.out* files named via environment variable GMON_OUT_PREFIX.
         * gmon.h (struct gmonparam): Make state decl volatile.
         * mcount.c (_MCOUNT_DECL): Change stores into gmonparam.state to use
         Interlocked operations. Add #include "winsup.h", update commentary.
         * profil.c (profthr_byhandle): New function abstracting out the
         updating of profile counters based on a thread handle.
         (profthr_func): Update to call profthr_byhandle() to sample the main
         thread then call cygheap_profthr_all() indirectly through
         cygwin_internal(CW_CYGHEAP_PROFTHR_ALL) to sample all other threads.

Thanks,

..mark

---
 winsup/cygwin/cygheap.cc           | 12 ++++++
 winsup/cygwin/external.cc          | 11 ++++++
 winsup/cygwin/gmon.c               | 81 ++++++++++++++++----------------------
(Continue reading)

Jon Turney | 18 Feb 11:50 2016
Picon
Gravatar

[PATCH] ssp: Fixes for 64-bit

Fix various 32/64-bit portability issues in ssp, the single-step profiler, and
also build it for 64-bit.

This didn't turn out to actually be very useful for what I wanted to use it for,
so it's only been lightly tested.

It appears that on x86_64, single-step exceptions occur for much more of the
code in system DLLs, unlike x86, so ssp may take much, much longer to profile
some programs.  There is existing code to use breakpoints to mitigate this, but
that is currently disabled.

Signed-off-by: Jon Turney <jon.turney <at> dronecode.org.uk>
---
 winsup/utils/ssp.c | 204 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 109 insertions(+), 95 deletions(-)

diff --git a/winsup/utils/ssp.c b/winsup/utils/ssp.c
index 3136a9f..c9165f3 100644
--- a/winsup/utils/ssp.c
+++ b/winsup/utils/ssp.c
 <at>  <at>  -13,20 +13,6  <at>  <at> 
  *
  */

-#ifdef __x86_64__
-
-#include <stdio.h>
-
-int
-main (int argc, char **argv)
(Continue reading)

Yaakov Selkowitz | 18 Feb 06:21 2016
Picon
Gravatar

[PATCH] cygwin: accept SIGIOT as alias of SIGABRT

	winsup/cygwin/
	* include/cygwin/signal.h (SIGIOT): Define SIGIOT in terms of SIGABRT.
	* strsig.cc (struct sigdesc): Ditto.

	winsup/doc/
	* utils.xml (kill): Document SIGIOT.

Signed-off-by: Yaakov Selkowitz <yselkowi <at> redhat.com>
---
 winsup/cygwin/include/cygwin/signal.h | 1 +
 winsup/cygwin/strsig.cc               | 3 ++-
 winsup/doc/utils.xml                  | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/include/cygwin/signal.h b/winsup/cygwin/include/cygwin/signal.h
index 04ddb69..e876dec 100644
--- a/winsup/cygwin/include/cygwin/signal.h
+++ b/winsup/cygwin/include/cygwin/signal.h
 <at>  <at>  -358,6 +358,7  <at>  <at>  struct sigaction
 #define	SIGILL	4	/* illegal instruction (not reset when caught) */
 #define	SIGTRAP	5	/* trace trap (not reset when caught) */
 #define	SIGABRT 6	/* used by abort */
+#define	SIGIOT	SIGABRT	/* synonym for SIGABRT on most systems */
 #define	SIGEMT	7	/* EMT instruction */
 #define	SIGFPE	8	/* floating point exception */
 #define	SIGKILL	9	/* kill (cannot be caught or ignored) */
diff --git a/winsup/cygwin/strsig.cc b/winsup/cygwin/strsig.cc
index 987e135..bb53e1b 100644
--- a/winsup/cygwin/strsig.cc
+++ b/winsup/cygwin/strsig.cc
(Continue reading)

Irányossy Knoblauch Artúr | 17 Feb 23:30 2016
Picon

[PATCH] Multiple timer issues

Dear Cygwin Maintainers,

First of all, thank you for your work, I really enjoy using this software!

However, I have noticed that adjusting the system time can cause some
programs to misbehave. I have found bugs in the POSIX timer
implementation and a bug in the select() function's timeout handling.

Please find the proposed patches attached.

Regarding POSIX timers:

I have also created a small test application (see timer_test.c and the
Makefile) to demonstrate the issue. Please try to run it on both Linux
and Cygwin!

The test tries to set the system time back and forth to see the effect
on different kinds of timers. Please note, that for setting the system
time, the test has to be run with the necessary administrative rights
provided.

Regarding select():

The timeout shall be immune to adjustments to the system clock in all
cases; so the 'gtod' clock shouldn't be used, because it is not
monotonic.

I have tried to keep the changes as minimal as possible.
I hope that signing a legal agreement is not necessary, since these
are just bugfixes; if you think otherwise, please let me know.
(Continue reading)

Mark Geisert | 17 Feb 06:28 2016

gprof profiling of multi-threaded Cygwin programs

I've attached a patch set modifying Cygwin's profiling support to sample PC 
values of all an application's threads, not just the main thread.  There is no 
change to how profiling is requested: just compile and link the app with "-pg" 
as usual.  The profiling info is dumped into file gmon.out as usual.

There is a behavioral change that ought to be documented somewhere:  If a 
gmon.out file exists when a profiled application exits, the app will now dump 
its profiling info into another file gmon.outXXXXXX where mkstemp() replaces the 
Xs with random alphanumerics.  I added this functionality to allow a profiled 
program to fork() yet retain profiling info for both parent and child.  The old 
behavior was to simply overwrite any existing gmon.out file.

There is no change to the normal Cygwin execution paths if profiling is not 
enabled.  And when it is enabled, only the one profiling thread per profiled app 
is doing more work than it used to.

Here's a change log of the modifications; all files are in winsup/cygwin:

         * common.din (cygheap_profthr_all): Export.
         * cygheap.cc (cygheap_profthr_all): Implement a C-callable function
         that runs cygheap's threadlist handing each pthread's thread handle
         in turn to profthr_byhandle().
         * gmon.c (_mcleanup): Added support for multiple simultaneous
         gmon.out* files created when necessary using mkstemp(). Added
         #include <errno.h>, added extern decl for _setmode().
         * gmon.h (struct gmonparam): Made state decl volatile.
         * mcount.c (_MCOUNT_DECL): Changed stores into gmonparam.state to use
         Interlocked operations. Added #include "winsup.h", updated commentary.
         * profil.c (profthr_byhandle): New function abstracting out the
         updating of profile counters based on a thread handle.
(Continue reading)

john hood | 14 Feb 09:09 2016

Cygwin select() issues and improvements

[I Originally sent this last week, but it bounced.]

Various issues with Cygwin's select() annoyed me, and I've spent some
time gnawing on them.

* With 1-byte reads, select() on Windows Console input would forget
about unread input data stored in the fhandler's readahead buffer.
Hitting F1 would send only the first ESC character, until you released
the key and another Windows event was generated.  (one-line fix, though
I'm not sure it's appropriate/correct)

* On Windows, select() timeouts have coarse 10-16ms granularity (not
fixed-- must use clock_setres(), which has its own issues)

This issue hurts Mosh pretty badly, since it often uses select() with
1-20ms timeouts. Running Mosh on localhost on Cygwin has around 80ms of
extra latency for typing, which is pretty noticeable. Using
clock_setres() mostly cures this.

Older Unix systems used to have this issue too, but modern OS X, FreeBSD
and Linux all do much better.

* select() uses old millisecond-granularity Windows timeouts-- I changed
this to microsecond granularity.  Any actual improvement from this is
small, since Windows doesn't seem to handle timers on a less than 500us
granularity, even when you do use clock_setres().  One thing this does
fix is that selects > 43 days now work, though this is not a big issue
in actual practice, or a POSIX requirement.

* Newer versions of Windows may return early on timers, causing select()
(Continue reading)

Václav Haisman | 12 Feb 11:20 2016
Picon
Gravatar

[PATCH] POSIX barrier implementation, take 2

Hi.

Here is a second take on the POSIX barrier API. This time it is tested
with the attached barrier.c file. Here is a change log.

Newlib:

	* libc/include/sys/features.h (_POSIX_BARRIERS): Define for Cygwin.
	* libc/include/sys/types.h (pthread_barrier_t)
	(pthread_barrierattr_t): Do not define for Cygwin.

Cygwin:

	* common.din (pthread_barrierattr_init)
	(pthread_barrierattr_setpshared, pthread_barrierattr_getpshared)
	(pthread_barrierattr_destroy, pthread_barrier_init)
	(pthread_barrier_destroy, pthread_barrier_wait): Export.
	* include/cygwin/types.h (pthread_barrierattr_t)
	(pthread_barrier_t): Declare.
	* include/pthread.h (PTHREAD_BARRIER_SERIAL_THREAD)
	(pthread_barrierattr_init, pthread_barrierattr_setpshared)
	(pthread_barrierattr_getpshared, pthread_barrierattr_destroy)
	(pthread_barrier_init, pthread_barrier_destroy)
	(pthread_barrier_wait): Declare.
	* cygwin/thread.h (PTHREAD_BARRIER_MAGIC)
	(PTHREAD_BARRIERATTR_MAGIC): Define.
	(class pthread_barrierattr, class pthread_barrier): Declare.
	* cygwin/thread.cc (delete_and_clear): New local helper function.
	(class pthread_barrierattr, class pthread_barrier): Implement.

(Continue reading)


Gmane