File: dcap_signal.c

package info (click to toggle)
dcap 2.47.12-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,372 kB
  • sloc: ansic: 14,608; makefile: 313; python: 75; sh: 58
file content (60 lines) | stat: -rw-r--r-- 1,089 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 *   DCAP - dCache Access Protocol client interface
 *
 *   Copyright (C) 2000,2004 DESY Hamburg DMG-Division.
 *
 *   AUTHOR: Tigran Mkrtchayn (tigran.mkrtchyan@desy.de)
 *
 *   This program can be distributed under the terms of the GNU LGPL.
 *   See the file COPYING.LIB
 *
 */


/*
 * $Id: dcap_signal.c,v 1.9 2004-11-01 19:33:29 tigran Exp $
 */

#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#ifndef __CYGWIN__
#    ifdef HAVE_STROPTS_H
#        include <stropts.h>
#    endif /* HAVE_STROPTS_H */
#endif /* __CYGWIN__ */

#include "dcap.h"
#include "dcap_signal.h"
#include "debug_level.h"

static void pipe_handler(int s);


void pipe_handler(int s)
{

	dc_debug(DC_ERROR, "SIGPIPE received");
	dc_debug(DC_ERROR, "->Signal handling is not fully implemented yet");
	dc_debug(DC_ERROR, "->Ignoring...");

	return;
}


int
dcap_signal()
{
	struct sigaction sa_pipe;

	sa_pipe.sa_handler = pipe_handler;
	sigemptyset(&sa_pipe.sa_mask);
	sa_pipe.sa_flags = 0;


	if (sigaction(SIGPIPE, &sa_pipe, NULL) < 0) {
		dc_debug(DC_ERROR,"Sigaction failed!");
	}

	return 0;
}