Squid Web Cache master
Loading...
Searching...
No Matches
SysErrorDetail.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for sys_error_details.
7 */
8
9#include "squid.h"
11#include "sbuf/SBuf.h"
12#include "sbuf/Stream.h"
13
14SBuf
16{
18}
19
20SBuf
22{
23 return ToSBuf("errno=", errorNo);
24}
25
26SBuf
31
32std::ostream &
33operator <<(std::ostream &os, const ReportSysError rse)
34{
35 if (const auto errorNo = rse.errorNo)
36 os << Debug::Extra << "system call error: " << xstrerr(errorNo);
37 return os;
38}
39
std::ostream & operator<<(std::ostream &os, const ReportSysError rse)
reports a system call error (if any) on a dedicated Debug::Extra line
static std::ostream & Extra(std::ostream &)
Definition debug.cc:1316
a stream manipulator for printing a system call error (if any)
Definition SBuf.h:94
system call failure detail based on standard errno(3)/strerror(3) APIs
SBuf brief() const override
static SBuf Brief(int errorNo)
SBuf verbose(const HttpRequestPointer &) const override
int errorNo
errno(3) set by the last failed system call or equivalent
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition Stream.h:63
const char * xstrerr(int error)
Definition xstrerror.cc:83