mirror of
https://github.com/libssh2/libssh2.git
synced 2026-10-24 03:48:58 +03:00
To honor the actual millisecond timeout set via `libssh2_session_set_timeout()`, to open the possibility for the same in other APIs, and to use monotonic time if available. - add internal abstract time types and macros for handling point in time and time intervals, and use them throughout the codebase. - bump internal abstract time resolution to milliseconds (from seconds). Use signed 64-bit integers. - replace existing millisecond-resolution code in `libssh2_poll()` with the internal abstract time interface. - bump 'now' function to retrieve millisecond-resolution monotonic time from the system, if available. Also: - append `_s` or `_ms` to public API arguments to tell the time unit. - keepalive: minor tidy-ups. - make `ssh2_now()` return at least 1 in the fallback, `time(NULL)`-based codepath to not confuse a zero value with unset time. Credits: Stefan Eissing Ref:5649b21297Ref: https://github.com/curl/curl/pull/21034 - this leaves existing `ssh2_gettimeofday()` (together with its Windows-specific local implementation) with a single caller, `ssh2_deb_low()`. Refs: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html https://www.man7.org/linux/man-pages/man3/clock_gettime.3.html https://pubs.opengroup.org/onlinepubs/009604599/functions/gettimeofday.html https://www.man7.org/linux/man-pages/man2/gettimeofday.2.html https://learn.microsoft.com/windows/win32/api/profileapi/nf-profileapi-queryperformancefrequency https://learn.microsoft.com/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter https://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows Reported-and-patch-proposal-by: Trzik on github Based-on-patch-proposals-by: Ryan Kelley Fixes #1497 Ref: #1818 Closes #1893 Follow-up to772abc7a85#1919 Closes #2341
42 lines
1.1 KiB
Markdown
42 lines
1.1 KiB
Markdown
---
|
|
c: Copyright (C) The libssh2 project and its contributors.
|
|
SPDX-License-Identifier: BSD-3-Clause
|
|
Title: libssh2_poll
|
|
Section: 3
|
|
Source: libssh2
|
|
See-also:
|
|
- libssh2_poll_channel_read(3)
|
|
---
|
|
|
|
# NAME
|
|
|
|
libssh2_poll - poll for activity on a socket, channel or listener
|
|
|
|
# SYNOPSIS
|
|
|
|
~~~c
|
|
#include <libssh2.h>
|
|
|
|
int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeout_ms);
|
|
~~~
|
|
|
|
# DESCRIPTION
|
|
|
|
This function is deprecated. Do not use. We encourage users to instead use
|
|
the *poll(3)* or *select(3)* functions to check for socket activity or
|
|
when specific sockets are ready to get received from or send to.
|
|
|
|
Poll for activity on a socket, channel, listener, or any combination of these
|
|
three types. The calling semantics for this function generally match
|
|
*poll(2)* however the structure of fds is somewhat more complex in order
|
|
to accommodate the disparate datatypes, POLLFD constants have been namespaced
|
|
to avoid platform discrepancies, and revents has additional values defined.
|
|
|
|
# AVAILABILITY
|
|
|
|
Marked as deprecated since 1.2.0
|
|
|
|
# RETURN VALUE
|
|
|
|
Number of fds with interesting events.
|