我对一个信号使用sigaction,并使用了一个简单的结构。我实际上是从手册页上取的。有人能给我解释一下结构中的第二行是做什么的吗?还有一个错误:
error: expected declaration specifiers or '...' before 'siginfo_t'
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <assert.h>
#include <getopt.h>
#include <signal.h>
#include <sys/time.h>
#define _POSIX_C_SOURCE 200112L
#define MAX_WORD 256
void parseFile (FILE * fp, FILE *sketcher);
void handle_timeout(int signal);
struct sigaction {
void (*sa_handler)(int);
void (*sa_sigaction)(int, siginfo_t *, void *);
sigset_t sa_mask;
int sa_flags;
void (*sa_restorer)(void);
};发布于 2010-11-30 11:58:07
您不应该自己声明struct sigaction。它在手册页中提供供您参考,但实际上是由<signal.h>声明的。
结构中的第二行定义了一个函数指针(和第一行一样,但类型不同)。
https://stackoverflow.com/questions/4310319
复制相似问题