Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

SIG_ERR unknown in module ifport

billuart__philippe
385 Views

Dear,

 

I would like to modify the handling of a few signal in order to terminate correctly my running process (I'm actually using shared memory and semaphores that I want to close) in case of hardware of software errors triggering signals. To implement that, I'm using the function signal. This function should normally return SIG_ERR in case of error during the handling change but this MACRO seems to be not defined in the ifport module ? Indeed, I wrote the following line code :

subroutine change_sig_handler

    use yales2_m, only: error_and_exit

    use ifport, only: signal, SIGTERM, SIGSEGV, SIGFPE, SIGINT, &

                      SIGKILL, SIGABRT, SIGILL, SIG_ERR !seembs to be unknown

 

    implicit none

 

    integer, external :: sig_handler

    integer :: err

 

    ! ------------- Signal handling --------------

    err = signal(SIGTERM, sig_handler,-1)

    if(err == SIG_ERR) then

      call error_and_exit("signal")

    end if 

    !err=signal(SIGBUS, sig_handler, -1) ! not known by intel ifort

    err = signal(SIGSEGV, sig_handler,-1)

    if(err == SIG_ERR) then

      call error_and_exit("signal")

    end if

    err = signal(SIGFPE, sig_handler,-1)

    if(err == SIG_ERR) then

      call error_and_exit("signal")

    end if

    err = signal(SIGINT, sig_handler,-1)

    if(err == SIG_ERR) then

      call error_and_exit("signal")

    end if

    err = signal(SIGKILL, sig_handler,-1)

    if(err == SIG_ERR) then

      call error_and_exit("signal")

    end if

    err =signal(SIGABRT, sig_handler,-1)

    if(err == SIG_ERR) then

      call error_and_exit("signal")

    end if

    err = signal(SIGILL, sig_handler,-1)

    if(err == SIG_ERR) then

      call error_and_exit("signal")

    end if

    ! --------------------------------------------

 

end subroutine change_sig_handler

 

And I got the following errors :

 

small_cylinder.f90(104): error #6580: Name in only-list does not exist or is not accessible.   [SIG_ERR]

    use iflport, only: signal, SIG_ERR, SIGTERM, SIGSEGV, SIGFPE, SIGINT, &

 

This name does not have a type, and must have an explicit type.   [SIG_ERR]

    if(signal(SIGTERM, sig_handler,-1) == SIG_ERR) then

 

Ma version of intel is 2018.2.199.

Thank you in advance for your answer,

Philippe Billuart 

0 Kudos
2 Replies
Juergen_R_R
Valued Contributor I
385 Views

When you grep for SIG_ERR in the library directory of the Intel Fortran Compiler then both libifport and libifportmt depend on it, but maybe SIG_ERR is not public inside the ifport module. I fear only someone from Intel can answer this question. 

0 Kudos
Steve_Lionel
Honored Contributor III
385 Views

Well, no, ifport.f90's source is provided with the compiler. Indeed, I don't see SIG_ERR there. You can define your own value as -1 - that seems to be what it is. I suggest filing a ticket at https://supporttickets.intel.com/?lang=en-US asking that this be added, since it is referenced by the documentation of the SIGNAL routine in IFPORT:

"A return value of SIG_ERR indicates an error, in which case a call to IERRNO returns EINVAL. "

0 Kudos
Reply