Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4336950
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:52:38+00:00 2026-05-21T10:52:38+00:00

Hi I have a signal handler defined in one file, from where the signal

  • 0

Hi
I have a signal handler defined in one file, from where the signal is generated. I have defined a “static struct sigaction” to define a signal handler which is non-static.

We know using “static” we can also put scope limitation to one single file, so using this technique can we restrict the signal handler to catch signals from only the file in which it is defined?

My “file” – File1, which is linked with other file – File2, File2 can generate signals, which should not be caught by File1 handler. So can i achieve this, if i put “static struct sigaction” in File1?

enter code here
File1.c

static struct sigaction;
void sigHandler(int sig); // also a handler for SIG_NO but should catch signals generated for only File1.c (sig handler is non-static)

File2.c
kill(getpid(), SIG_NO)

File1.c and File2.c are linked together.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:52:39+00:00Added an answer on May 21, 2026 at 10:52 am

    It really doesn’t matter where you declare / define the handler. If you get to install the handler, it handles ALL the signals of that type received by the process.

    So, no matter the scope and linkage of your identifiers, once you install the handler it handles everything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my signal.h file I have added a signal handler like this: #define SIG_WPG
I've made the follow signal handler struct sigaction pipeIn; pipeIn.sa_handler = updateServer; sigemptyset(&pipeIn.sa_mask); sa.sa_flags
I have a Python script which uses a glade file to define its UI,
My requirement is: I have a signal handler in my tool, which is registered
I have a library which installs a signal handler for SIGSEGV for debugging purpose.
I have a simple Python script that uses a signal handler for Ctl-C. If
I have a shutdown hook handler defined in a SINGLE threaded C application. int
I have a custom shell program in which I have included signal.h , unistd.h
Although including <signal.h> I get an error saying that struct sigaction is an incomplete
I have a signal handler to handle ctrl-c interrupt. If in the signal handler

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.