> Hi Jon,
> so the only remaining issue with eum64 is currently the fact that
> fcntl() gives a runtime error on the Mac:
>> MacBook-Air:picoLispEmu jkleiser$ ./pil +
>> [/Users/jkleiser/.pil/history:1] File lock: Invalid argument
> This happens when it tries to lock the history file of the line editor
> in debug mode. But it will probably also happen in other cases where
> files need to be locked (e.g. in the database).
> The corresponding source is line 28 of "src64/io.l":
> (code 'lockFileAC)
> st2 (Flock) # 'l_type'
> ld (Flock L_START) 0 # Start position ('l_whence' is SEEK_SET)
> shr A 16 # Get length
> ld (Flock L_LEN) A # Length
> cc fcntl(C F_SETLKW Flock) # Try to lock
> This boils down to (line 19477 of "src64/emu.base.c"):
> // lockFileAC:
> 2644, // 18454: st2 (Flock)
> 2645, // 18455: ld (Flock . 4) 0
> 2646, // 18456: shr A 16
> 2647, // 18457: ld (Flock . 12) A
> 2650, // 18458: cc fcntl (C 14 Flock)
> The '14' here is the value of F_SETLKW on x86-32 Debian. It is system
> dependent, and is perhaps different on the Mac.
Yes, this is from my Mac's ...Headers/sys/fcntl.h:
#define F_SETLKW 9 /* F_SETLK; wait if blocked */
Does this "9" explain our fcntl() problem?
> The last line results in the call (line 39073):
> case 2650: // cc fcntl (C 14 Flock)
> A.l = (uint32_t)fcntl((int)C.n, 14, (int)((uint64_t)(unsigned
> So either the value '14' is wrong here, or the whole call to fcntl().
> The value of F_SETLKW is taken from the standard output of the command
> 'src64/sysdefs', which is compiled in the build process on the host
> Anybody has an idea what is wrong? Any Mac programmer awake?
> - Alex