Reputation: 717
I noticed that sigaction
is defined as both a struct and a function(http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html):
int sigaction(int, const struct sigaction *restrict,
struct sigaction *restrict);
And an example of using it is:
struct sigaction sa;
/* Set up handler */
sa.sa_flags = SA_SIGINFO|SA_RESTART;
sa.sa_sigaction = timer_expiry;
/* Setup signal watchdog */
if (sigaction(SIG_WDOG, &sa, NULL) == -1) {
printf("ERROR: Failed to set wdog signal with %s",
strerror(errno));
}
Upvotes: 5
Views: 897
Reputation: 145899
C has several name spaces for identifiers; and function identifiers and structure tag identifiers live in different name spaces.
(C11, 6.2.3 Name spaces of identifiers p1) "If more than one declaration of a particular identifier is visible at any point in a translation unit, the syntactic context disambiguates uses that refer to different entities. Thus, there are separate name spaces for various categories of identifiers, as follows:
label names (disambiguated by the syntax of the label declaration and use);
the tags of structures, unions, and enumerations (disambiguated by following any32) of the keywords struct, union, or enum);
the members of structures or unions; each structure or union has a separate name space for its members (disambiguated by the type of the expression used to access the member via the . or -> operator);
all other identifiers, called ordinary identifiers (declared in ordinary declarators or as enumeration constants)
.
Upvotes: 6