当前位置:网站首页>Attempt to redefine 'timeout' at line 2 solution
Attempt to redefine 'timeout' at line 2 solution
2022-06-30 05:37:00 【Xiaomei】
Original code
local ffi = require("ffi")
ffi.cdef[[
struct timeval {
long int tv_sec;
long int tv_usec;
};
int gettimeofday(struct timeval *tv, void *tz);
]];
local gettimeofday_struct = ffi.new("struct timeval")
local function gettimeofday()
ffi.C.gettimeofday(gettimeofday_struct, nil)
return tonumber(gettimeofday_struct.tv_sec) * 1000000 + tonumber(gettimeofday_struct.tv_usec)
endOperation error reporting
[error] 4028#0: *5 lua entry thread aborted: runtime error: /opt/olwaf/olaccess.lua:126: attempt to redefine 'timeval' at line 2
stack traceback:
coroutine 0:
[C]: in function 'cdef'
/opt/olwaf/olaccess.lua:126: in main chunk, client: 127.0.0.1, server: www.olwaf.com, request: "POST /api/v2/dict_info HTTP/1.1", host: "www.olwaf.com"
Normal after modification
local ffi = require("ffi")
if pcall(ffi.typeof, "struct timeval") then
-- check if already defined.
else
ffi.cdef[[
typedef struct timeval {
long tv_sec;
long tv_usec;
} timeval;
int gettimeofday(struct timeval* t, void* tzp);
]]
end
local gettimeofday_struct = ffi.new("struct timeval")
local function gettimeofday()
ffi.C.gettimeofday(gettimeofday_struct, nil)
return tonumber(gettimeofday_struct.tv_sec) * 1000000 + tonumber(gettimeofday_struct.tv_usec)
end边栏推荐
- 《谁动了我的奶酪》读后感
- Answer sheet for online assignment of "motor and drive" of Xijiao 21 autumn (IV) [standard answer]
- Learning about functions QAQ
- Codeforces Round #390 (Div. 2) D. Fedor and coupons
- Database SQL language 06 single line function
- Database SQL language 04 subquery and grouping function
- Unity determines whether the UI is clicked
- VFPBS上传EXCEL并保存MSSQL到数据库中
- Remote sensing image /uda:curriculum style local to global adaptation for cross domain remote sensing image segmentation
- Solidy - fallback function - 2 trigger execution modes
猜你喜欢
![[chestnut sugar GIS] global mapper - how to assign the elevation value of the grid to the point](/img/bb/ea0e78065ba54ff253995faeeb6901.png)
[chestnut sugar GIS] global mapper - how to assign the elevation value of the grid to the point

Database SQL language 03 sorting and paging

Who is promoting the new inflection point of audio and video industry in 2022?

14x1.5cm竖向标签有点难,VFP调用BarTender来打印

【LeetCode】Easy | 232. Using stack to realize queue (pure C manual tearing stack)

Visualization of 3D geological model based on borehole data by map flapping software

Baiwen.com 7 days Internet of things smart home learning experience punch in the third day

How to create a CSR (certificate signing request) file?

剑指 Offer 18. 删除链表的节点

Vfpbs uploads excel and saves MSSQL to the database
随机推荐
Sound network, standing in the "soil" of the Internet of things
Array pointers and pointer arrays
【LeetCode】Easy | 232. Using stack to realize queue (pure C manual tearing stack)
pytorch中常用损失函数总结
SSL证书续费相关问题详解
VFPBS在IIS下调用EXCEL遇到的Access is denied
Why can transformer break into the CV world and kill CNN?
Sword finger offer 18 Delete the node of the linked list
Set a plane to camera viewport
炒股用指南针开户交易安全吗?
Rotating frame target detection mmrotate v0.3.1 training dota data set (II)
Vfpbs uploads excel and saves MSSQL to the database
East Tower attack and defense world - XSS bypasses the safety dog
Solidity - 安全 - 重入攻击(Reentrancy)
Digital signature——
El table lazy load refresh
Database SQL language 05 SQL exercise
You don't know how to deduce the location where HashSet stores elements?
Stack overflow caused by C # using protobuf stack overflow
VFPBS上传EXCEL并保存MSSQL到数据库中