SysErrorDetail.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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"
10 #include "error/SysErrorDetail.h"
11 #include "sbuf/SBuf.h"
12 #include "sbuf/Stream.h"
13 
14 SBuf
16 {
17  return SysErrorDetail(errorNo).brief();
18 }
19 
20 SBuf
22 {
23  return ToSBuf("errno=", errorNo);
24 }
25 
26 SBuf
28 {
29  return SBuf(xstrerr(errorNo));
30 }
31 
32 std::ostream &
33 operator <<(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 
const char * xstrerr(int error)
Definition: xstrerror.cc:83
int errorNo
errno(3) set by the last failed system call or equivalent
SBuf brief() const override
SBuf verbose(const HttpRequestPointer &) const override
Definition: SBuf.h:93
a stream manipulator for printing a system call error (if any)
SysErrorDetail(const int anErrorNo)
static SBuf Brief(int errorNo)
static std::ostream & Extra(std::ostream &)
Definition: debug.cc:1316
std::ostream & operator<<(std::ostream &os, const ReportSysError rse)
reports a system call error (if any) on a dedicated Debug::Extra line
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition: Stream.h:63

 

Introduction

Documentation

Support

Miscellaneous