+2016-06-22 Florian Weimer <fweimer@redhat.com>
+
+ * test-skeleton.c (write_message): New function.
+ * malloc/tst-mallocfork2.c (write_message): Remove.
+ * debug/tst-longjmp_chk2.c (write_indented): New function.
+ (write_message): Remove.
+ (stackoverflow_handler): Call write_indented.
+
2016-06-22 Joseph Myers <joseph@codesourcery.com>
* sysdeps/i386/fpu/s_nearbyint.S (__nearbyint): Do not mask
#include <sys/resource.h>
#include <unistd.h>
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
static jmp_buf mainloop;
static sigset_t mainsigset;
static volatile sig_atomic_t pass;
static void
-write_message (const char *message)
+write_indented (const char *str)
{
- ssize_t unused __attribute__ ((unused));
for (int i = 0; i < pass; ++i)
- unused = write (STDOUT_FILENO, " ", 1);
- unused = write (STDOUT_FILENO, message, strlen (message));
+ write_message (" ");
+ write_message (str);
}
static void
/* Sanity check to keep test from looping forever (in case the longjmp
chk code is slightly broken). */
pass++;
- assert (pass < 5);
sigaltstack (NULL, &altstack);
- write_message ("in signal handler\n");
+ write_indented ("in signal handler\n");
if (altstack.ss_flags & SS_ONSTACK)
- write_message ("on alternate stack\n");
+ write_indented ("on alternate stack\n");
siglongjmp (mainloop, pass);
}
return 0;
}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
/* How many signals need to be delivered before the test exits. */
enum { signal_count = 1000 };
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
/* Process ID of the subprocess which sends SIGUSR1 signals. */
static pid_t sigusr1_sender_pid;
progress. Checked by liveness_signal_handler. */
static volatile sig_atomic_t progress_indicator = 1;
-/* Write the message to standard output. Usable from signal
- handlers. */
-static void
-write_message (const char *str)
-{
- write (STDOUT_FILENO, str, strlen (str));
-}
-
static void
sigusr1_handler (int signo)
{
return 0;
}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
return p;
}
+/* Write a message to standard output. Can be used in signal
+ handlers. */
+static void
+__attribute__ ((unused))
+write_message (const char *message)
+{
+ ssize_t unused __attribute__ ((unused));
+ unused = write (STDOUT_FILENO, message, strlen (message));
+}
+
/* List of temporary files. */
struct temp_name_list
{