I want to get the file's basic infomation with the lstat function by in my ngx_lua programme. The init.lua's content as fallow:
local ffi = require "ffi"
local ffi_C = ffi.C
local ffi_new = ffi.new
ffi.cdef[[
typedef long long time_t;
typedef struct timespec {
time_t tv_sec;
long tv_nsec;
...;
};
typedef struct stat {
struct timespec st_mtim;
...;
};
int lstat(const char *path, struct stat *buf);
]]
buf = ffi_new("struct stat *")
function checkfile (filename, buf)
ffi_C.lstat(filename, buf)
end
When I start my nginx, there are some errors happen. The content as fallow:
- 2014/04/25 15:00:39 [error] 26396#0: lua entry thread aborted: runtime error: /home/nginx/conf/cop/init.lua:42: /usr/local/lib/libluajit-5.1.so.2: undefined symbol: lstat stack traceback: coroutine 0: [C]: in function '__index' /home/nginx/conf/cop/init.lua:42: in function 'checkfile' /home/nginx/conf/cop/check1.lua:37: in function , context: ngx.timer