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 8270541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:35:49+00:00 2026-06-08T06:35:49+00:00

Recently I was working on a software written in c which had about a

  • 0

Recently I was working on a software written in c which had about a 3-4 thousand lines of code.When I started to get segmentation faults ,I added a SIGSEGV handler.This helped me in pin pointing the error as the handler was made to give a backtrace.

My question is apart from SIGSEGV what are the important signals that should be handled when we have a big software, such that error detection will be easy.

This can optionally be used in preventing an attack. Ex The software receiving abort signal when it is doing critical updates/operation.The standard tells that SIGHUP,SIGINT,SIGKILL,SIGPIPE,SIGTERM and some more signals have the default property to terminate the process to which this signal is delivered.

So to add another layer of protection to my software will I have to change the behavior of these signals.By protection I mean that I don’t want my software to terminate when it is in between a crtical update, I will decide on when to abort.

EDIT:I Want to know how well designed software,handle SIGNAL ,use them like a safety net, which helps as the software is built along.

  • 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-06-08T06:35:51+00:00Added an answer on June 8, 2026 at 6:35 am

    Well, you aren’t 100% clear on what you expect from an answer but I’ll try to cover the general idea.

    First of all, what you could call a ‘debugging’ signals are (and when to expect them):

    1. SIGILL, SIGFPE — if program tries to run an illegal instruction, usually can appear with wrong CFLAGS and/or own assembly (or serious random breakages);
    2. SIGABRT — caused by the abort() call, for example in assert(). It can also come from libraries, so you usually should handle it;
    3. SIGSEGV — invalid memory access, you probably know all about it already;
    4. SIGBUS — can happen when doing I/O with mmap() and trying to read/write unaccessible memory; it also happened to me when mmap()-based I/O ran out-of-space;
    5. SIGPIPE — when doing I/O on pipes, and the pipe gets disconnected from the other side;
    6. POSIX also specifies SIGSYS for invalid system calls and you probably want to catch that as well (though I never managed to see one).

    I would say you need to handle those signals if you are using the relevant operations. They’re all in POSIX but I’m not sure if all systems implement them so you may want to use #ifdefs for them anyway (SIG* are guaranteed to be macros and thus suitable for #ifdef).

    Other signals you may encounter through the runtime of your program are:

    1. SIGALRM — when using alarm(),
    2. SIGPOLL — when using polling,
    3. SIGCHLD — when spawning processes…

    And these are basically signals which you are handling anyway when using the relevant operations and though they terminate by default, you should have other handlers for them anyway.

    And finally, if you expect to handle signals sent by user, that’s a harsh case — because user can practically send every signal. Thus, if you want to handle it all gracefully, you need to catch every signal from man signal which defaults to termination or abort actions.

    If you want to just catch a common subset of signals which you could expect, these would be:

    1. SIGHUP when the terminal with the program (or some other parent if relevant) dies,
    2. SIGINT for ^c key,
    3. SIGQUIT for ^\ key,
    4. SIGTERM for the termination request (sent by the kill program by default and other similar tools),
    5. SIGUSR1 and SIGUSR2 are user-defined signals and usually are used to perform program-specific actions. They are sent by user, and — for some reason — default to killing the program.

    There’s also SIGKILL but the standard doesn’t allow catching it.

    I hope I covered the most important signals. Note that I’m a Linux user, and other *nixes may have a few specific signals you also may want to catch.

    It usually all depends on what you want to achieve. Although preventing the software from being interrupted by random signals is a good idea, it’s usually not worth it to prevent it from being killed by all of them, and especially those which are only sent directly by user.

    If user wants to kill the app, he can achieve it anyway, and it should be enough to just handle the common ones — SIGINT and SIGTERM. I would personally expect SIGQUIT (^\ key) to kill the application without letting it finish even critical tasks (like SIGKILL does).

    Edit. And as a rationale for the last sentence, think about the following: I’ve just made something stupid, like removed some important data. Or simply noticed there’s something wrong with the cleanup-on-exit procedure. I really want to terminate the program ensuring my signal won’t be caught but cause it to return immediately. Even if it would result in broken data, sometimes I would really prefer to have broken data (hoping I would be able to recover what I need) than no data.

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

Sidebar

Related Questions

I recently started working with a client that had an index.html file with this
I recently started working with MVC or MVC2 to be more exact. I found
I'm working on a software that does extensive queries to a database which is
I've recently begun working in an enterprise software environment with hundreds of different applications
I've recently begun working with a new software development firm. One of the things
I recently started working on a small CMS. I usually develop .NET applications in
I am recently working on some long and obscure codes written by some other
I was recently working on a piece of C++ code for a side project
I'm recently working on a project in which I need to port a portion
I recently started working with KnockoutJs and quickly realized using the default Json(myModelWithADate) resulted

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.