SCALE-RM
scale_sigvars.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
14  !-----------------------------------------------------------------------------
15  !
16  !++ used modules
17  !
18  use iso_c_binding
19  use scale_io
20  !-----------------------------------------------------------------------------
21  implicit none
22  private
23  !-----------------------------------------------------------------------------
24  !
25  !++ Public procedure
26  !
27  public :: sigvars_get_all
28 
29  !-----------------------------------------------------------------------------
30  !
31  !++ Public parameters & variables
32  !
33  integer(c_int), public :: sigint = -1
34  integer(c_int), public :: sigquit = -1
35  integer(c_int), public :: sigabrt = -1
36  integer(c_int), public :: sigfpe = -1
37  integer(c_int), public :: sigsegv = -1
38  integer(c_int), public :: sigterm = -1
39 
40  !-----------------------------------------------------------------------------
41  !
42  !++ Private procedure
43  !
44  interface
45  function get_sigint(ierr) bind(c)
46  import
47  integer(c_int),intent(out) :: ierr
48  integer(c_int) get_sigint
49  end function
50  end interface
51 
52  interface
53  function get_sigquit(ierr) bind(c)
54  import
55  integer(c_int),intent(out) :: ierr
56  integer(c_int) get_sigquit
57  end function
58  end interface
59 
60  interface
61  function get_sigabrt(ierr) bind(c)
62  import
63  integer(c_int),intent(out) :: ierr
64  integer(c_int) get_sigabrt
65  end function
66  end interface
67 
68  interface
69  function get_sigfpe(ierr) bind(c)
70  import
71  integer(c_int),intent(out) :: ierr
72  integer(c_int) get_sigfpe
73  end function
74  end interface
75 
76  interface
77  function get_sigsegv(ierr) bind(c)
78  import
79  integer(c_int),intent(out) :: ierr
80  integer(c_int) get_sigsegv
81  end function
82  end interface
83 
84  interface
85  function get_sigterm(ierr) bind(c)
86  import
87  integer(c_int),intent(out) :: ierr
88  integer(c_int) get_sigterm
89  end function
90  end interface
91 
92  !-----------------------------------------------------------------------------
93  !
94  !++ Private parameters & variables
95  !
96  !-----------------------------------------------------------------------------
97  contains
98  !-----------------------------------------------------------------------------
99 
100  !-----------------------------------------------------------------------------
102  subroutine sigvars_get_all( &
103  master )
104  implicit none
105  logical, intent(in) :: master ! master flag
106  integer(c_int) :: ierr
107  !---------------------------------------------------------------------------
108 
109  if( master ) write(*,*) ''
110  if( master ) write(*,*) 'Get system signals'
111 
112  sigint = get_sigint(ierr)
113  if ( ierr == 0 ) then
114  if( master ) write(*,*) '*** signal: SIGINT = ', sigint
115  else
116  if( master ) write(*,*) 'xxx [WARNING] Not Exist: SIGINT'
117  endif
118 
119  sigquit = get_sigquit(ierr)
120  if ( ierr == 0 ) then
121  if( master ) write(*,*) '*** signal: SIGQUIT = ', sigquit
122  else
123  if( master ) write(*,*) 'xxx [WARNING] Not Exist: SIGQUIT'
124  endif
125 
126  sigabrt = get_sigabrt(ierr)
127  if ( ierr == 0 ) then
128  if( master ) write(*,*) '*** signal: SIGABRT = ', sigabrt
129  else
130  if( master ) write(*,*) 'xxx [WARNING] Not Exist: SIGABRT'
131  endif
132 
133  sigfpe = get_sigfpe(ierr)
134  if ( ierr == 0 ) then
135  if( master ) write(*,*) '*** signal: SIGFPE = ', sigfpe
136  else
137  if( master ) write(*,*) 'xxx [WARNING] Not Exist: SIGFPE'
138  endif
139 
140  sigsegv = get_sigsegv(ierr)
141  if ( ierr == 0 ) then
142  if( master ) write(*,*) '*** signal: SIGSEGV = ', sigsegv
143  else
144  if( master ) write(*,*) 'xxx [WARNING] Not Exist: SIGSEGV'
145  endif
146 
147  sigterm = get_sigterm(ierr)
148  if ( ierr == 0 ) then
149  if( master ) write(*,*) '*** signal: SIGTERM = ', sigterm
150  else
151  if( master ) write(*,*) 'xxx [WARNING] Not Exist: SIGTERM'
152  endif
153 
154  return
155  end subroutine sigvars_get_all
156 
157 end module scale_sigvars
158 !-------------------------------------------------------------------------------
int get_sigint(int *ifail)
int get_sigsegv(int *ifail)
int get_sigquit(int *ifail)
subroutine, public sigvars_get_all(master)
Get signal values.
int get_sigterm(int *ifail)
integer(c_int), public sigterm
module sigvars
integer(c_int), public sigquit
integer(c_int), public sigint
integer(c_int), public sigabrt
int get_sigabrt(int *ifail)
int get_sigfpe(int *ifail)
integer(c_int), public sigsegv
module STDIO
Definition: scale_io.F90:10
integer(c_int), public sigfpe