mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Solar Designer <solar@openwall.com>
To: musl@lists.openwall.com
Subject: cluts review
Date: Wed, 13 Jul 2011 15:07:23 +0400	[thread overview]
Message-ID: <20110713110723.GA22153@openwall.com> (raw)

Hi Luka, Rich -

I've just experimented with cluts a bit.  I'll start by posting a patch
containing only changes that I had to make for cluts to build (without
fixing any warnings, etc. - there are still lots of them).

The uses of SA_NODEFER appeared to be a bug anyway, so I am simply
removing them.

-std=c99 appears to be needed to get LLONG_MAX, etc. defined by glibc's
header files when compiling with older gcc (I used 3.4.5).

As it is, this patch is a hack.  I think that extensive cleanups to the
code being patched are needed.

I have other observations as well (such as from actually running the
tests), which I hope to post separately.

diff -urp cluts.orig/cluts.c cluts/cluts.c
--- cluts.orig/cluts.c	2011-07-09 11:26:23 +0000
+++ cluts/cluts.c	2011-07-13 10:13:29 +0000
@@ -1,3 +1,4 @@
+#define _BSD_SOURCE /* for scandir() and alphasort() */
 #include <dirent.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -5,6 +6,7 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <sys/wait.h>
+#include <sys/param.h> /* for PATH_MAX */
 
 /*
  * Copyright (c) 2011 Luka Marд█etiд┤<paxcoder@gmail.com>
diff -urp cluts.orig/makefile cluts/makefile
--- cluts.orig/makefile	2011-07-09 11:26:23 +0000
+++ cluts/makefile	2011-07-13 10:08:29 +0000
@@ -7,7 +7,7 @@
 # There's ABSOLUTELY NO WARRANTY, express or implied.
 #
 
-CFLAGS = -O2 -Wall -Wextra
+CFLAGS = -std=c99 -O2 -Wall -Wextra
 LIBS = -lpthread -lrt -lm
 SRC = $(wildcard tests/*.c) $(wildcard *.c)
 BIN = $(SRC:.c=)
diff -urp cluts.orig/tests/alloc.c cluts/tests/alloc.c
--- cluts.orig/tests/alloc.c	2011-07-09 11:26:23 +0000
+++ cluts/tests/alloc.c	2011-07-13 10:09:50 +0000
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE /* for sigaction() */
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
@@ -57,7 +58,7 @@ int main()
     sem_t sem; ///< semaphore is used for thread mutex
 
     act.sa_handler = bridge_sig_jmp;
-    act.sa_flags   = SA_NODEFER;
+    act.sa_flags   = 0;
     sigaction(SIGSEGV, &act, &oldact[0]);
     
     //make a head element for the ring-queue which will hold info about blocks:
@@ -230,7 +231,7 @@ int safe_free(void *vp, char *err_msg)
 {
         struct sigaction oldact, act;
         act.sa_handler = bridge_sig_jmp;
-        act.sa_flags   = SA_NODEFER;
+        act.sa_flags   = 0;
         
         sigaction(SIGABRT, &act, &oldact);
         if (!setjmp(env[1]))
diff -urp cluts.orig/tests/string.c cluts/tests/string.c
--- cluts.orig/tests/string.c	2011-07-09 11:26:23 +0000
+++ cluts/tests/string.c	2011-07-13 10:10:25 +0000
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE
 #include <signal.h>
 #include <stdio.h>
 #include <sys/mman.h>
@@ -54,7 +55,7 @@ int main()
 
     //call bridge_sig_jmp on segmentation fault:
     act.sa_handler=bridge_sig_jmp;
-    act.sa_flags=SA_NODEFER;
+    act.sa_flags=0;
     sigaction(SIGSEGV, &act, &oldact);
     for (i=0; i<sizeof(buf_size)/sizeof(buf_size[0]); ++i) {
         //stretch to a page size:

Alexander


             reply	other threads:[~2011-07-13 11:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 11:07 Solar Designer [this message]
2011-07-13 12:02 ` Luka Marčetić
2011-07-13 12:21   ` Solar Designer
2011-07-13 12:57     ` Luka Marčetić
2011-07-13 13:42       ` Rich Felker
2011-07-13 14:21         ` Solar Designer
2011-07-13 13:54       ` Solar Designer
2011-07-13 14:00         ` Rich Felker
2011-07-13 14:31           ` Solar Designer
2011-07-13 14:03     ` Rich Felker
2011-07-13 14:37       ` Solar Designer
2011-07-13 16:03   ` Solar Designer
2011-07-13 16:55     ` Luka Marčetić
2011-07-13 17:05       ` Solar Designer
2011-07-13 17:25         ` Luka Marčetić
2011-07-13 17:52           ` Solar Designer
2011-07-13 19:29             ` Luka Marčetić
2011-07-13 19:55               ` Rich Felker
2011-07-13 20:39               ` Solar Designer
2011-07-13 21:44                 ` Solar Designer
2011-07-13 19:52             ` Rich Felker
2011-07-13 20:03       ` Rich Felker
2011-07-14 18:56       ` Rich Felker
2011-07-13 13:38 ` Rich Felker
2011-07-13 14:12   ` Solar Designer
2011-07-13 14:26     ` Rich Felker
2011-07-13 14:46       ` Solar Designer
2011-07-13 16:25   ` Luka Marčetić
2011-07-13 17:03     ` Solar Designer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110713110723.GA22153@openwall.com \
    --to=solar@openwall.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).