diff --git a/docs/changes.txt b/docs/changes.txt index 92669dd..9abd6bc 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -214,3 +214,7 @@ v0.8.1 * nfqws2: conntrack_feed * winws2: use windivert bulk mode * nfqws2: template free import + +0.9.1 + +* nfqws2: 'stat', 'clock_getfloattime' luacalls diff --git a/docs/manual.en.md b/docs/manual.en.md index e68117c..764d8bd 100644 --- a/docs/manual.en.md +++ b/docs/manual.en.md @@ -75,6 +75,7 @@ - [uname](#uname) - [clock\_gettime](#clock_gettime) - [getpid](#getpid) + - [stat](#stat) - [Packet handling options](#packet-handling-options) - [standard reconstruct](#standard-reconstruct) - [standard rawsend](#standard-rawsend) @@ -1954,9 +1955,11 @@ On Windows, it returns a string starting with "CYGWIN" followed by the version. ``` function clock_gettime() +function clock_getfloattime() ``` -Retrieves the precise time. Returns two values: Unix time in seconds and the nanosecond component. The built-in `os.time()` function does not provide nanoseconds. +clock_gettime retrieves the precise time. Returns two values: Unix time in seconds and the nanosecond component. The built-in `os.time()` function does not provide nanoseconds. +clock_getfloattime returns unixtime in the floating point format. Nanoseconds go to the fractional part. #### getpid @@ -1968,6 +1971,24 @@ function gettid() - `getpid()` returns the current process identifier (PID). - `gettid()` returns the current thread identifier (TID). +#### stat + +``` +function stat(filename) +``` + +If successful returns the following table : + +| Field | Type | Description | +| :------- | :----- | :---------- | +| type | string | file type : file, dir, symlink, socket, blockdev, chardev, fifo, unknown | +| size | number | file size | +| mtime | number | modification unixtime in floating point format | +| inode | number | inode. In Windows doesn't fit into number datatype in luajit but fits into integer datatype of Lua5.3+ | +| dev | number | device id | + +In case of error returns 3 values : nil, error string, error number (errno). + ### Packet handling options The following functions use standard sets of options: `rawsend` and `reconstruct`. diff --git a/docs/manual.md b/docs/manual.md index b887172..6f46e6e 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -72,6 +72,7 @@ - [uname](#uname) - [clock\_gettime](#clock_gettime) - [getpid](#getpid) + - [stat](#stat) - [Опции по работе с пакетами](#опции-по-работе-с-пакетами) - [standard reconstruct](#standard-reconstruct) - [standard rawsend](#standard-rawsend) @@ -2101,9 +2102,11 @@ function uname() ``` function clock_gettime() +function clock_getfloattime() ``` -Узнать точное время. Возвращает 2 значения - unixtime в секундах и наносекунды. Встроенная функция `os.time()` не выдает наносекунды. +Узнать точное время. clock_gettime возвращает 2 значения - unixtime в секундах и наносекунды. Встроенная функция `os.time()` не выдает наносекунды. +clock_getfloattime возвращает unixtime в формате с плавающей точкой. Наносекунды идут в дробную часть. #### getpid @@ -2115,6 +2118,25 @@ function gettid() - getpid() возвращает идентификатор текущего процесса - PID - gettid() возвращает идентификатор текущего потока - TID +#### stat + +``` +function stat(filename) +``` + +В случае успеха возвращает таблицу : + +| Поле | Тип | Описание | +| :------- | :----- | :---------- | +| type | string | тип файла : file, dir, symlink, socket, blockdev, chardev, fifo, unknown | +| size | number | размер файла | +| mtime | number | unixtime время модификации в формате с плавающей точкой | +| inode | number | inode. на Windows не влезает в тип number luajit, но влезает в integer Lua 5.3+ | +| dev | number | device id | + +В случае неудачи возвращает 3 результата : nil, строка ошибки, код ошибки errno. + + ### Опции по работе с пакетами В следующих функциях будут использоваться стандартные наборы опций - rawsend и reconstruct.