Hello
麻烦你贴下 error_log, 理论上O_RDWR这些宏为nil,bor函数应该会报错吧。
在 2016年11月29日 下午5:08,xiaoyao Wu <wypsm...@gmail.com> 写道:
> hi, detailyang, 是代码片段
>
> ffi.cdef[[
> int write(int fd,const char *buf,int nbyte);
> int open(const char* path,int access,int mode);
> int close(int fd);
> ]]
>
> 然后调用的时候,返回-1
> local loggerFd = ffi.C.open(fileName,bit.bor(O_RDWR,O_CREAT,O_APPEND),
> bit.bor(S_IRWXU,S_IRGRP,S_IROTH))
> if loggerFd == -1 then
> ngx.log(ngx.ERR, "open error ", NGX_ERROR) // 这样打印不出错误
> end
>
> 想看一下出错信息,但是不知道怎么获得 错误信息
>
>
>
> 在 2016年11月29日星期二 UTC+8下午3:10:34,detailyang写道:
>>
>> Hello.
>>
>> 你的代码片段是全部的吗,如果是的话,这段代码应该会报错,luajit 的 ffi 不支持 c 的宏包括这里的
>> O_RDWR、S_IRWXU,NGX_ERROR 等, 具体你可以参考 http://luajit.org/ext_ffi_api.html C
>> declarations are not passed through a C pre-processor
>>
>> 在 2016年11月29日星期二 UTC+8上午11:42:05,xiaoyao Wu写道:
>>>
>>> local loggerFd =
>>> ffi.C.open(fileName,bit.bor(O_RDWR,O_CREAT,O_APPEND),
>>> bit.bor(S_IRWXU,S_IRGRP,S_IROTH))
>>> if loggerFd == -1 then
>>> ngx.log(ngx.ERR, "open error ", NGX_ERROR) // 这样打印不出错误
>>> end
>>>
> --
>