You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2003/01/09 10:07:45 UTC

DO NOT REPLY [Bug 15914] New: - shmget returns EEXIST

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15914>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15914

shmget returns EEXIST

           Summary: shmget returns EEXIST
           Product: Apache httpd-2.0
           Version: 2.0.43
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Platform
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: eskil@e.kth.se


The following code in the file srclib/apr/shmem/unix/shm.c
        status = apr_file_open(&file, filename, 
                               APR_WRITE | APR_CREATE | APR_EXCL,
                               APR_OS_DEFAULT, pool);
        if (status != APR_SUCCESS) {
            return status;
        }

        /* ftok() (on solaris at least) requires that the file actually
         * exist before calling ftok(). */
        shmkey = ftok(filename, 1);
        if (shmkey == (key_t)-1) {
            return errno;
        }

        if ((new_m->shmid = shmget(shmkey, new_m->realsize,
                                   SHM_R | SHM_W | IPC_CREAT | IPC_EXCL)) < 0) {
            return errno;
        }


Results in the folowing systrace:
[pid  3806] unlink("/var/adm/httpd/httpd.scoreboard") = 0
[pid  3806] open("/var/adm/httpd/httpd.scoreboard", O_WRONLY|O_CREAT|O_EXCL,
0666) = 9
[pid  3806] stat64("/var/adm/httpd/httpd.scoreboard", {st_mode=S_IFREG|0644,
st_size=0, ...}) = 0
[pid  3806] shmget(16908467, 209176, IPC_CREAT|IPC_EXCL|0x180|0600) = -1 EEXIST
(File exists)


Quite obviously, creating a file exlusively will fail if tried twice.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org