当前位置:网站首页>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边栏推荐
- Unity3d- use animator and code to control task walking
- How to prevent source code leakage in enterprises and institutions
- D. Big Brush
- Word frequency statistics (string, list)
- [typescript] cannot redeclare block range variables
- Responsive flow layout
- [note] usage model tree of the unity resource tree structure virtualizingtreeview
- Xiaosha's lunch
- Codeforces Round #390 (Div. 2) D. Fedor and coupons
- Responding with flow layout
猜你喜欢

Installation and getting started with pytoch

Unity ugui text value suspended enlarged display add text background

终端便捷ssh(免密)连接

mmcv常用API介绍

The minecraft server address cannot be refreshed.

Unity screenshot method

Unityshader learning notes - Basic Attributes

Solidy - fallback function - 2 trigger execution modes

RedisTemplate 常用方法汇总

Sword finger offer 18 Delete the node of the linked list
随机推荐
Unity gets the resolution of the game view
SSL证书续费相关问题详解
Xctf--Web--Challenge--area Wp
Xijiao 21 autumn "motor and drive" online homework answer sheet (I) [standard answer]
Intellj idea generates jar packages for projects containing external lib to other projects. The method refers to the jar package written by itself
token 过期后,如何自动续期?
Unity- the camera follows the player
Database SQL language 06 single line function
How to judge the quality of network transformer? What symptom is network filter transformer broken?
Xi'an Jiaotong 21st autumn "computerized accounting" online homework answer sheet (I) [standard answer]
Bessel curve with n control points
Golden code of programmer interview
/Path/to/ idiom, not a command
Word frequency statistics (string, list)
使用码云PublicHoliday项目判断某天是否为工作日
D. Big Brush
Fifty years ago, the go code first submitted by the inventor of Hello world was as long as this
Bev instance prediction based on monocular camera (iccv 2021)
Xi'an Jiaotong 21st autumn economics online homework answer sheet (III) [standard answer]
What kind of answer has Inspur given in the big AI model landing test?