MCPcopy Create free account
hub / github.com/facebook/time / waitForHWTS

Function waitForHWTS

timestamp/timestamp_linux.go:234–246  ·  view source on GitHub ↗
(connFd int)

Source from the content-addressed store, hash-verified

232type pollFunc func(fds []unix.PollFd, timeout *unix.Timespec, sigmask *unix.Sigset_t) (int, error)
233
234func waitForHWTS(connFd int) error {
235 return pollForHWTS(connFd, unix.Ppoll)
236}
237
238// pollForHWTS waits until the TX timestamp is ready, for at most TimeoutTXTS.
239// unix.Poll is deliberately not used: it takes whole milliseconds as an int and
240// passes anything negative to ppoll as "no timeout", so a lossy conversion there
241// would reintroduce the unbounded wait this deadline exists to prevent.
242func pollForHWTS(connFd int, poll pollFunc) error {
243 fds := []unix.PollFd{{Fd: int32(connFd), Events: unix.POLLERR, Revents: 0}} //nolint:gosec // fd is always small
244 // a restarted poll must share one deadline, otherwise every EINTR grants
245 // another full TimeoutTXTS and the caller's attempt budget bounds nothing
246 deadline := time.Now().Add(TimeoutTXTS)
247 for {
248 remaining := time.Until(deadline)
249 if remaining <= 0 {

Callers 2

ReadTXtimestampBufFunction · 0.85
ReadTimeStampSeqIDBufFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…