Debian Codegraph @

doc/SetErrno.3

raw
1 '\"
2 '\" Copyright (c) 1996 Sun Microsystems, Inc.
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\"
7 .TH Tcl_SetErrno 3 8.3 Tcl "Tcl Library Procedures"
8 .so man.macros
9 .BS
10 .SH NAME
11 Tcl_SetErrno, Tcl_GetErrno, Tcl_ErrnoId, Tcl_ErrnoMsg \- manipulate errno to store and retrieve error codes
12 .SH SYNOPSIS
13 .nf
14 \fB#include <tcl.h>\fR
15 .sp
16 void
17 \fBTcl_SetErrno\fR(\fIerrorCode\fR)
18 .sp
19 int
20 \fBTcl_GetErrno\fR()
21 .sp
22 const char *
23 \fBTcl_ErrnoId\fR()
24 .sp
25 const char *
26 \fBTcl_ErrnoMsg\fR(\fIerrorCode\fR)
27 .sp
28 .SH ARGUMENTS
29 .AS int errorCode
30 .AP int errorCode in
31 A POSIX error code such as \fBENOENT\fR.
32 .BE
33
34 .SH DESCRIPTION
35 .PP
36 \fBTcl_SetErrno\fR and \fBTcl_GetErrno\fR provide portable access
37 to the \fBerrno\fR variable, which is used to record a POSIX error
38 code after system calls and other operations such as \fBTcl_Gets\fR.
39 These procedures are necessary because global variable accesses cannot
40 be made across module boundaries on some platforms.
41 .PP
42 \fBTcl_SetErrno\fR sets the \fBerrno\fR variable to the value of the
43 \fIerrorCode\fR argument
44 C procedures that wish to return error information to their callers
45 via \fBerrno\fR should call \fBTcl_SetErrno\fR rather than setting
46 \fBerrno\fR directly.
47 .PP
48 \fBTcl_GetErrno\fR returns the current value of \fBerrno\fR.
49 Procedures wishing to access \fBerrno\fR should call this procedure
50 instead of accessing \fBerrno\fR directly.
51 .PP
52 \fBTcl_ErrnoId\fR and \fBTcl_ErrnoMsg\fR return string
53 representations of \fBerrno\fR values. \fBTcl_ErrnoId\fR
54 returns a machine-readable textual identifier such as
55 .QW EACCES
56 that corresponds to the current value of \fBerrno\fR.
57 \fBTcl_ErrnoMsg\fR returns a human-readable string such as
58 .QW "permission denied"
59 that corresponds to the value of its
60 \fIerrorCode\fR argument. The \fIerrorCode\fR argument is
61 typically the value returned by \fBTcl_GetErrno\fR.
62 The strings returned by these functions are
63 statically allocated and the caller must not free or modify them.
64
65 .SH KEYWORDS
66 errno, error code, global variables