SysErrorDetail.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2022 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 
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 &os)
prefixes each grouped debugs() line after the first one in the group
Definition: Stream.h:117
a stream manipulator for printing a system call error (if any)
Definition: SBuf.h:94
virtual SBuf brief() const override
static SBuf Brief(int errorNo)
SysErrorDetail(const int anErrorNo)
virtual 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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors