c - Can someone explain to me how 'sigaction' works? -


i'm having difficulties understanding way sigaction() works.

in <signal.h>, sigaction defined as

int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) 

but sigaction defined in bits/sigaction.h structure. i'm confused here, can struct in c made callable?

can please give me brief explanation on this?

the function called sigaction, structure called struct sigaction. functions , structures exist in different namespaces in c. similar way can this:

#include <stdio.h>  struct x {         int x; };  static int x(struct x *x) {         return x->x; }  int main(void) {         struct x y;         /* not "struct x x" want call "x" function below. */          y.x = 1;         printf("%d\n", x(&y));         return 0; } 

and compiler can sort out x various namespaces. example rather excessive , dirty looks if did in real life.


Comments