---
name: "sg_set_error_with_errno_code"
section: "3"
platform: "linux"
package: "libstatgrab"
version: "0.92.1-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/sg_set_error_with_errno_code"
---

# sg\_set\_error\_with\_errno\_code(3)

sets the error condition

## NAME

sg\_set\_error, sg\_set\_error\_with\_errno, sg\_set\_error\_with\_errno\_code, sg\_clear\_error - sets the error condition

## SYNOPSIS

```
FC#include <statgrab.h>F[0]
```

FCsg\_error **sg\_set\_error**F\[0\]  FC(sg\_error *code*, const char \**arg*);F\[0\]

FCsg\_error **sg\_set\_error\_with\_errno**F\[0\]  FC(sg\_error *code*, const char \**arg*);F\[0\]

FCsg\_error **sg\_set\_error\_with\_errno\_code**F\[0\]  FC(sg\_error *code*, const char \**arg*, int *errno\_value*);F\[0\]

FCvoid **sg\_clear\_error**F\[0\]  FC(void);F\[0\]

## DESCRIPTION

FC**sg\_set\_error**F\[0\]() sets the occurred error condition together with an argument. The argument is usually descriptive, eg. the file name which failed to open.

FC**sg\_set\_error\_with\_errno**F\[0\]() sets the occurred error condition together with an argument and the value of the system libraries FCerrnoF\[0\] value. The argument is usually descriptive, eg. the name of the failed FC**sysctl**F\[0\]() call.

FC**sg\_set\_error\_with\_errno\_code**F\[0\]() sets the occurred error condition together with an argument and an error value of a system library call which doesn't set the FCerrnoF\[0\] value (eg. the pthread\_\* calls). The argument is usually descriptive, eg. the name of the mutex failed to get locked.

FC**sg\_clear\_error**F\[0\]() clears the current error condition.

## SEE ALSO

[**statgrab**(3)](/statgrab/3.md)

## WEBSITE

⟨https://libstatgrab.org/⟩
