2009-07-08 13:19:16 -07:00
|
|
|
/*
|
2013-05-09 10:54:04 -07:00
|
|
|
* Copyright (c) 2008, 2009, 2010, 2013 Nicira, Inc.
|
2009-07-08 13:19:16 -07:00
|
|
|
*
|
2009-06-15 15:11:30 -07:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at:
|
2009-07-08 13:19:16 -07:00
|
|
|
*
|
2009-06-15 15:11:30 -07:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2009-07-08 13:19:16 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FATAL_SIGNAL_H
|
|
|
|
#define FATAL_SIGNAL_H 1
|
|
|
|
|
2014-05-23 14:15:28 -07:00
|
|
|
#ifndef _WIN32
|
|
|
|
#include <signal.h>
|
|
|
|
#endif
|
2009-07-08 13:19:16 -07:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
/* Basic interface. */
|
2013-05-09 10:54:04 -07:00
|
|
|
void fatal_signal_init(void);
|
2010-01-15 15:28:14 -08:00
|
|
|
void fatal_signal_add_hook(void (*hook_cb)(void *aux),
|
|
|
|
void (*cancel_cb)(void *aux), void *aux,
|
|
|
|
bool run_at_exit);
|
2009-07-08 13:19:16 -07:00
|
|
|
void fatal_signal_fork(void);
|
2009-12-08 14:11:22 -08:00
|
|
|
void fatal_signal_run(void);
|
|
|
|
void fatal_signal_wait(void);
|
2014-02-26 10:44:46 -08:00
|
|
|
void fatal_ignore_sigpipe(void);
|
2014-05-28 15:07:31 -07:00
|
|
|
void fatal_signal_atexit_handler(void);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
/* Convenience functions for unlinking files upon termination.
|
|
|
|
*
|
|
|
|
* These functions also unlink the files upon normal process termination via
|
|
|
|
* exit(). */
|
|
|
|
void fatal_signal_add_file_to_unlink(const char *);
|
|
|
|
void fatal_signal_remove_file_to_unlink(const char *);
|
2009-09-21 12:37:20 -07:00
|
|
|
int fatal_signal_unlink_file_now(const char *);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
/* Interface for other code that catches one of our signals and needs to pass
|
|
|
|
* it through. */
|
|
|
|
void fatal_signal_handler(int sig_nr);
|
|
|
|
|
2014-05-23 14:15:28 -07:00
|
|
|
#ifndef _WIN32
|
|
|
|
void fatal_signal_block(sigset_t *prev_mask);
|
|
|
|
#endif
|
|
|
|
|
2009-07-08 13:19:16 -07:00
|
|
|
#endif /* fatal-signal.h */
|