.\" -*- coding: UTF-8 -*- '\" t .\" Copyright (C) 2001 Andries Brouwer (aeb@cwi.nl) .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH getcontext 3 "20 ​​Julio 2023" "Páginas de manual de Linux 6.05.01" .SH NOMBRE getcontext, setcontext \- consulta o establece el contexto de usuario .SH BIBLIOTECA Biblioteca Estándar C (\fIlibc\fP, \fI\-lc\fP) .SH SINOPSIS .nf \fB#include \fP .PP \fBint getcontext(ucontext_t *\fP\fIucp\fP\fB);\fP \fBint setcontext(const ucontext_t *\fP\fIucp\fP\fB);\fP .fi .SH DESCRIPCIÓN En un entorno del tipo System V, se encuentran los dos tipos \fImcontext_t\fP y \fIucontext_t\fP definidos en \fI\fP y las cuatro funciones \fBgetcontext\fP(), \fBsetcontext\fP(), \fBmakecontext\fP() y \fBswapcontext\fP() que permiten el intercambio del contexto del nivel de usuario entre múltiples hilos de control dentro de un proceso. .PP El tipo \fImcontext_t\fP es dependiente de la máquina y opaco. El tipo \fIucontext_t\fP es una estructura que tiene al menos los campos siguientes: .PP .in +4n .EX typedef struct ucontext_t { struct ucontext_t *uc_link; sigset_t uc_sigmask; stack_t uc_stack; mcontext_t uc_mcontext; ... } ucontext_t; .EE .in .PP de los cuales \fIsigset_t\fP y \fIstack_t\fP están definidos en \fI\fP. \fIuc_link\fP apunta al contexto que será reanudado cuando termine el contexto actual (en el caso de que el contexto actual haya sido creado usando \fBmakecontext\fP(3)), \fIuc_sigmask\fP es el conjunto de señales bloqueadas en este contexto (véase \fBsigprocmask\fP(2)), \fIuc_stack\fP es la pila usada por este contexto (véase \fBsigaltstack\fP(2)), y \fIuc_mcontext\fP es la representación del contexto guardado específica de la máquina, que incluye los registros de la máquina para el hilo invocador. .PP La función \fBgetcontext\fP() inicializa la estructura apuntada por \fIucp\fP al contexto activo actualmente. .PP The function \fBsetcontext\fP() restores the user context pointed to by \fIucp\fP. A successful call does not return. The context should have been obtained by a call of \fBgetcontext\fP(), or \fBmakecontext\fP(3), or received as the third argument to a signal handler (see the discussion of the \fBSA_SIGINFO\fP flag in \fBsigaction\fP(2)). .PP Si el contexto se obtuvo mediante una llamada a \fBgetcontext\fP(), la ejecución del programa continúa como si esta llamada simplemente regresara. .PP Si el contexto fue obtenido mediante una llamada a \fBmakecontext\fP(3), la ejecución del programa continua por la llamada a la función \fIfunc\fP especificada como segundo argumento en la llamada a \fBmakecontext\fP(3). Cuando la función \fIfunc\fP regresa, se continua con el miembro \fIuc_link\fP de la estructura \fIucp\fP especificada como primer argumento en la llamada a \fBmakecontext\fP(3). Cuando este miembro es NULL, el hilo termina. .PP Cuando el contexto se obtiene mediante una llamada a un manejador de señales, se solía decir que "la ejecución del programa continua con la instrucción de programa siguiente a la instrucción interrumpida por la señal". Sin embargo, esta sentencia fue eliminada en SUSv2, y ahora se establece que "el resultado es indefinido". .SH "VALOR DEVUELTO" Cuando tiene éxito, \fBgetcontext\fP() devuelve 0 y \fBsetcontext\fP() no regresa. En caso de error, ambas devuelven \-1 y modifican \fIerrno\fP con el valor apropiado. .SH ERRORES No se definen errores. .SH ATRIBUTOS Para obtener una explicación de los términos usados en esta sección, véase \fBattributes\fP(7). .TS allbox; lbx lb lb l l l. Interfaz Atributo Valor T{ .na .nh \fBgetcontext\fP(), \fBsetcontext\fP() T} Seguridad del hilo MT\-Safe race:ucp .TE .sp 1 .SH ESTÁNDARES None. .SH HISTORIAL SUSv2, POSIX.1\-2001. .PP POSIX.1\-2008 removes these functions, citing portability issues, and recommending that applications be rewritten to use POSIX threads instead. .SH NOTAS The earliest incarnation of this mechanism was the \fBsetjmp\fP(3)/ \fBlongjmp\fP(3) mechanism. Since that does not define the handling of the signal context, the next stage was the \fBsigsetjmp\fP(3)/ \fBsiglongjmp\fP(3) pair. The present mechanism gives much more control. On the other hand, there is no easy way to detect whether a return from \fBgetcontext\fP() is from the first call, or via a \fBsetcontext\fP() call. The user has to invent their own bookkeeping device, and a register variable won't do since registers are restored. .PP Cuando ocurre una señal, el contexto de usuario actual se guarda y el núcleo crea un nuevo contexto para el manejador de señales. No deje al manejador usar \fBlongjmp\fP(3) \- es indefinido que ocurriría con contextos. Use \fBsiglongjmp\fP(3) o \fBsetcontext\fP() en su lugar. .SH "VÉASE TAMBIÉN" \fBsigaction\fP(2), \fBsigaltstack\fP(2), \fBsigprocmask\fP(2), \fBlongjmp\fP(3), \fBmakecontext\fP(3), \fBsigsetjmp\fP(3), \fBsignal\fP(7) .PP .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Miguel Pérez Ibars y Marcos Fouces . .PP Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. .PP Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org .ME .