Closed lipp closed 10 years ago
with PR #130 this gets the problem:
luajit -lsyscall
luajit: ./syscall/bsd/types.lua:88: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'pairs'
./syscall/bsd/types.lua:88: in function <./syscall/bsd/types.lua:10>
./syscall/types.lua:612: in function 'init'
./syscall.lua:33: in main chunk
[C]: at 0x01000280a0
[C]: at 0x0100001590
Yes sorry, I merged in FreeBSD support just recently, which disrupted things a bit. It should make things easier though, as most of the missing OSX stuff can probably just be copied directly from FreeBSD as they are largly the same, with just a few tweaks...
I have pushed a lot of fixes, not quite there yet but the tests run...
OK, more fixes pushed. The largest issue now is that 'ls' is not working as getdirentries is broken. There are some warnings in the man page about this so I need to check the correct fix.
Now I get this:
git log -n 1
commit 04e0cc5e94c29336aa17650322c128d51679c1b8
Author: Justin Cormack <justin@specialbusservice.com>
Date: Thu Dec 26 19:06:01 2013 +0000
cast last ioctl argument to void always
bunsen:ljsyscall preuss$ luajit -e "require'syscall'.socket('inet','stream,nonblock')"
luajit: ./syscall/syscalls.lua:169: bad argument #2 to 'socket' (cannot convert 'nil' to 'int')
stack traceback:
[C]: in function 'socket'
./syscall/syscalls.lua:169: in function 'socket'
(command line):1: in main chunk
[C]: at 0x0100001590
I changed the tests to not have that in. OSX does not have a nonblock flags for sockets, so you can't use 'stream,nonblock' just stream and set the socket to nonblock after...
Fixed all except one of the tests - just some issues with the pty calls to fix now.
thanks for pointing osx nonblock issue out.
We are getting closer :) Now I get this:
luajit: /usr/local/share/lua/5.1/syscall/syscalls.lua:216: attempt to index field 'SO' (a nil value)
stack traceback:
/usr/local/share/lua/5.1/syscall/syscalls.lua:216: in function 'setsockopt'
OK, added the SO constants and some tests for setsockopt and getsockopt...
:+1: I am trying to do node like implementation of sockets etc. Currently I am evaluating using your great ljsyscall. Target is an embedded powerpc system. I am developing under OSX though.
BTW: I looked for TCP_NODELAY option and cannot grep it. Do you have a hint?
I tried the obvious:
sock:setsockopt('socket','nodelay',true)
Have added those as #134 - had missed them...
I guess you will be wanting kqueue on OSX? Had been meaning to sort that out - its there for NetBSD so means moving it to the generic BSD section instead and filling in the structs that should be similar...
I don't think so (yet). So far I am happy with lua-ev as event loop.
In the future it might be nice to have ALL the stuff (poll,etc) just by using ljsyscall and luajit.
Well I added it anyway as I had been meaning to, and fixed the other issue, so all tests passing.