carta
Tcl_ErrnoMsg(3tcl)

Tcl_ErrnoMsg3tcl

Manipulate errno to store and retrieve error codes

Part of Tcl_SetErrno(3tcl).

Usage

void

int

const char *

const char *


    


    

Arguments

int errorCode (in)

A POSIX error code such as ENOENT.


    


            

Overview

Tcl_SetErrno and Tcl_GetErrno provide portable access to the errno variable, which is used to record a POSIX error code after system calls and other operations such as Tcl_Gets. These procedures are necessary because global variable accesses cannot be made across module boundaries on some platforms.

Tcl_SetErrno sets the errno variable to the value of the errorCode argument C procedures that wish to return error information to their callers via errno should call Tcl_SetErrno rather than setting errno directly.

Tcl_GetErrno returns the current value of errno. Procedures wishing to access errno should call this procedure instead of accessing errno directly.

Tcl_ErrnoId and Tcl_ErrnoMsg return string representations of errno values. Tcl_ErrnoId returns a machine-readable textual identifier such as “EACCES” that corresponds to the current value of errno. Tcl_ErrnoMsg returns a human-readable string such as “permission denied” that corresponds to the value of its errorCode argument. The errorCode argument is typically the value returned by Tcl_GetErrno. The strings returned by these functions are statically allocated and the caller must not free or modify them.

Keywords

errno, error code, global variables

History

  • Debian 13 (Trixie) to Debian 11 (Bullseye): the text shown here
  • Debian 10 (Buster) to Debian 8 (Jessie)
  • Debian 7 (Wheezy)
  • Debian 6.0 (Squeeze)
  • Debian 5.0 (Lenny)
  • Debian 4.0 (Etch) to Debian 3.1 (Sarge)
  • Debian 3.0 (Woody)

From tcl8.6-doc 8.6.16+dfsg-1 in Debian 13 (Trixie). Also shipped by tcl9.0-doc. Parsed by carta from the page's man source.