ERRSTR(2) ERRSTR(2) NAME errstr, werrstr - description of last system call error SYNOPSIS #include <u.h> #include <libc.h> int errstr(char *err) void werrstr(char *fmt, ...) DESCRIPTION When a system call fails it returns -1 and records a string describing the error in a per-process buffer. Errstr swaps the contents of that buffer with the contents of the array err. Err should contain at least ERRLEN characters (defined in <libc.h>). Usually errstr will be called with an empty string, but the exchange property provides a mechanism for libraries to set the return value for the next call to errstr. If no system call has generated an error since the last call to errstr with an empty string, the result is an empty string. The verb r in print(2) calls errstr and outputs the error string. Werrstr takes a print style format as its argument and uses it to format a string to pass to errstr. The string returned from errstr is discarded. SOURCE /sys/src/libc/9syscall /sys/src/libc/9sys/werrstr.c DIAGNOSTICS Errstr always returns 0. SEE ALSO intro(2), perror(2) Page 1 Plan 9 (printed 11/17/24)