linux手册翻译——ucontext(3)

2021-06-22  本文已影响0人  蟹蟹宁

\color{#A00000}{NAME}
ucontext —— 用户线程上下文

\color{#A00000}{LIBRARY}
Standard C Library (libc, -lc)

\color{#A00000}{SYNOPSIS}

#include <ucontext.h> 

/* Userlevel context.  */
typedef struct ucontext_t
  {
    unsigned long int __ctx(uc_flags);
    struct ucontext_t *uc_link;
    stack_t uc_stack;
    mcontext_t uc_mcontext;
    sigset_t uc_sigmask;
    struct _libc_fpstate __fpregs_mem;
    __extension__ unsigned long long int __ssp[4];
  } ucontext_t;

\color{#A00000}{DESCRIPTION}
ucontext_t 是用于保存用户线程的上下文的结构类型。 线程的上下文包括其堆栈、寄存器和阻塞信号列表(即信号掩码)。
ucontext_t 结构至少包含以下字段:

当上下文的入口点函数返回时,uc_link 字段指向要恢复的上下文。 如果 uc_link 等于 NULL,则在此上下文返回时进程退出
uc_mcontext 字段依赖于具体的CPU硬件,可移植应用程序应将其视为不透明的。
此外定义了以下函数来操作 ucontext_t:

int getcontext(ucontext_t *);
ucontext_t * getcontextx(void);
int setcontext(const ucontext_t *);
void makecontext(ucontext_t *, void (*)(void), int, ...);
int swapcontext(ucontext_t *, const ucontext_t *);
上一篇 下一篇

猜你喜欢

热点阅读