Re: src/sys/kern/subr_prf.c r1.161

2017-10-27 Thread Christos Zoulas
In article ,
Christos Zoulas  wrote:
>In article <85853ac7-a205-b412-2f5b-39101dc51...@gmx.com>,
>Kamil Rytarowski   wrote:

Or better, since we provide the decl anyway:

--- a/sys/syz-extract/fetch.go
+++ b/sys/syz-extract/fetch.go
@@ -144,7 +144,9 @@ var srcTemplate = template.Must(template.New("").Parse(`
 
 {{.AddSource}}
 
+#ifndef __NetBSD__
 int printf(const char *format, ...);
+#endif
 
 int main() {
int i;

christos



Re: src/sys/kern/subr_prf.c r1.161

2017-10-27 Thread Christos Zoulas
In article <85853ac7-a205-b412-2f5b-39101dc51...@gmx.com>,
Kamil Rytarowski   wrote:
>
>Fixed in HEAD. printf(9) change has been reverted.

It is simple enough to fix in syscaller:
Anyway, this needs a lot more work but commenting out the os.Remove()
calls (so that you can see what it produces) and fixing the printf prototype
gets you further. You'll need to add the right symlinks to make it go even
more as you discover :-)

christos

diff --git a/Makefile b/Makefile
index 5a3250b..8f50303 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,8 @@ GO := go
 EXE :=
 
 ifeq ("$(TARGETARCH)", "amd64")
-   CC = "x86_64-linux-gnu-gcc"
+#  CC = "x86_64-linux-gnu-gcc"
+   CC = "gcc"
 else ifeq ("$(TARGETARCH)", "386")
CC = "x86_64-linux-gnu-gcc"
ADDCFLAGS = "-m32"
diff --git a/sys/syz-extract/fetch.go b/sys/syz-extract/fetch.go
index b1ed2ce..fcf49ef 100644
--- a/sys/syz-extract/fetch.go
+++ b/sys/syz-extract/fetch.go
@@ -7,7 +7,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
-   "os"
+// "os"
"os/exec"
"regexp"
"strconv"
@@ -61,7 +61,7 @@ func extract(info *compiler.ConstInfo, cc string, args 
[]string, addSource strin
return nil, nil, fmt.Errorf("failed to run compiler: 
%v\n%v", err, string(out))
}
}
-   defer os.Remove(bin)
+// defer os.Remove(bin)
 
out, err = exec.Command(bin).CombinedOutput()
if err != nil {
@@ -100,9 +100,9 @@ func compile(cc string, args []string, data *CompileData) 
(bin string, out []byt
return "", nil, fmt.Errorf("failed to create temp file: %v", 
err)
}
srcFile.Close()
-   os.Remove(srcFile.Name())
+// os.Remove(srcFile.Name())
srcName := srcFile.Name() + ".c"
-   defer os.Remove(srcName)
+// defer os.Remove(srcName)
src := new(bytes.Buffer)
if err := srcTemplate.Execute(src, data); err != nil {
return "", nil, fmt.Errorf("failed to generate source: %v", err)
@@ -125,7 +125,7 @@ func compile(cc string, args []string, data *CompileData) 
(bin string, out []byt
cmd := exec.Command(cc, args...)
out, err = cmd.CombinedOutput()
if err != nil {
-   os.Remove(binFile.Name())
+// os.Remove(binFile.Name())
return "", out, err
}
return binFile.Name(), nil, nil
@@ -144,7 +144,7 @@ var srcTemplate = template.Must(template.New("").Parse(`
 
 {{.AddSource}}
 
-int printf(const char *format, ...);
+void printf(const char *format, ...);
 
 int main() {
int i;





Re: src/sys/kern/subr_prf.c r1.161

2017-10-27 Thread Kamil Rytarowski
On 27.10.2017 14:13, Frédéric Fauberteau wrote:
> Hi,
> 
> Since revision 1.161 of src/sys/kern/subr_prf.c, I encounter the
> following error:
> /home/triaxx/netbsd8/usr/src/sys/kern/subr_lockdebug.c: In function
> 'lockdebug_barrier':
> /home/triaxx/netbsd8/usr/src/sys/kern/subr_lockdebug.c:683:24: error:
> passing argument 2 of 'lockdebug_dump' from incompatible pointer type
> [-Werror=incompatible-pointer-types]
>  lockdebug_dump(ld, printf);
> ^
> /home/triaxx/netbsd8/usr/src/sys/kern/subr_lockdebug.c:106:13: note:
> expected 'void (*)(const char *)' but argument is of type 'int (*)(const
> char *)'
>  static void lockdebug_dump(lockdebug_t *, void (*)(const char *, ...)
> 
> I fixed it by casting printf:
> +
> + lockdebug_dump(ld, (void (*)(const char *, ...))printf);
> +
> but it does not appear as an elegant solution...
> 

Fixed in HEAD. printf(9) change has been reverted.



signature.asc
Description: OpenPGP digital signature


src/sys/kern/subr_prf.c r1.161

2017-10-27 Thread Frédéric Fauberteau
Hi,

Since revision 1.161 of src/sys/kern/subr_prf.c, I encounter the
following error:
/home/triaxx/netbsd8/usr/src/sys/kern/subr_lockdebug.c: In function
'lockdebug_barrier':
/home/triaxx/netbsd8/usr/src/sys/kern/subr_lockdebug.c:683:24: error:
passing argument 2 of 'lockdebug_dump' from incompatible pointer type
[-Werror=incompatible-pointer-types]
 lockdebug_dump(ld, printf);
^
/home/triaxx/netbsd8/usr/src/sys/kern/subr_lockdebug.c:106:13: note:
expected 'void (*)(const char *)' but argument is of type 'int (*)(const
char *)'
 static void lockdebug_dump(lockdebug_t *, void (*)(const char *, ...)

I fixed it by casting printf:
+
+ lockdebug_dump(ld, (void (*)(const char *, ...))printf);
+
but it does not appear as an elegant solution...



signature.asc
Description: OpenPGP digital signature