PR# 13742 Many library routine calls in runtime don't check for errno == EINTR and retry

Problem Report Summary
Submitter: prestoat2000
Category: Runtime
Priority: Medium
Date: 2007/12/10
Class: Bug
Severity: Serious
Number: 13742
Release: 6.1.71223
Confidential: No
Status: Open
Responsible:
Environment: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.0.7) Gecko/20060915 Firefox/1.5.0.7 Solaris 9 on SPARC
Synopsis: Many library routine calls in runtime don't check for errno == EINTR and retry

Description
There are a large number of library routines called by the runtime which can
fail with errno == EINTR.  In such cases, the caller of the library routine
should check for errno == EINTR and retry the operation in this case
until it either succeeds or returns an errno value other than EINTR,
unless signals are blocked (really blocked, not via SIGBLOCK).  I believe
operations files on NFS-mounted file systems can fail with EINTR, depending
on how the the file systems are exported.  There are some places in the runtime
that already check for EINTR and react appropriately, but many places do not
check.

I recommend constructing (or hopefully finding on the web) a list of routines
that can fail with EINTR and then fixing all calls to these routines in
the runtime.

Here are some few specific examples of such routines:

        accept
        access
        chdir
        chmod
        chown
        close
        closedir
        cond_wait
        connect
        dup, dup2
        execl, execv, execle, excve, execlp, execvp
        fclose
        fcntl (with F_SETLKW or F_SETLKW64)
        fflush
        fgetc
        fopen, freopen
        fprintf
        fputc
        fread
        frtruncate
        fscanf
        fseek, fseeko
        fsync
        fwrite
        getgrnam, getgrgid, getgrent, fgetgrent, fgetgrent_r
        getmsg
        ioctl
        link
        nanosleep
        open
        pause
        poll
        printf
        putmsg
        read, readv, pwrite
        recv, recvfrom, recvmsg
        scanf
        select
        sem_wait, sema_wait
        semop, semtimedop
        send, sendto, sendmsg
        sigpause
        sigsuspend
        sigwait
        stat, lstat
        system
        truncate
        unlink
        ustat
        utimes
        wait
        waitpid
        write, writev, pwrite
To Reproduce

										
Problem Report Interactions