Mark H Weaver <m...@netris.org> skribis: > l...@gnu.org (Ludovic Courtès) writes:
[...] >> ;; The libc interface to sys_clone is not useful for Scheme programs, so the >> -;; low-level system call is wrapped instead. >> +;; low-level system call is wrapped instead. The 'syscall' function is >> +;; declared in <unistd.h> as a variadic function; in practice, it expects 6 >> +;; pointer-sized arguments, as shown in, e.g., x86_64/syscall.S. >> (define clone >> (let* ((ptr (dynamic-func "syscall" (dynamic-link))) >> - (proc (pointer->procedure int ptr (list int int '*))) >> + (proc (pointer->procedure long ptr >> + (list long ;sysno >> + unsigned-long ;flags > > 'long' and 'unsigned long' might not be the same size as a pointer. > Better to use 'size_t' for both of these. While not strictly guaranteed > to be the same size as a pointer, in practice they should be the same > except on architectures with segmented memory models. > > What do you think? I had the same reaction, but posix/unistd.h in libc really uses these types for ‘syscall’ so I thought it’d be best to stick to them. WDYT? Ludo’.