~ubuntu-branches/ubuntu/intrepid/tomcat5.5/intrepid

« back to all changes in this revision

Viewing changes to connectors/jk/native/common/jk_shm.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-09-27 11:19:17 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060927111917-wov6fmkz3x6rsl68
Tags: 5.5.17-1ubuntu1
(Build-) depend on libmx4j-java (>= 3.0).

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
/***************************************************************************
18
18
 * Description: Shared Memory support                                      *
19
19
 * Author:      Mladen Turk <mturk@jboss.com>                              *
20
 
 * Version:     $Revision: 301060 $                                          *
 
20
 * Version:     $Revision: 386627 $                                          *
21
21
 ***************************************************************************/
22
22
 
23
23
#include "jk_global.h"
253
253
        return 0;
254
254
    }
255
255
    jk_shmem.filename = fname;
256
 
    jk_shmem.attached = attached;
 
256
    if (attached)
 
257
        jk_shmem.attached = (int)getpid();
 
258
    else
 
259
        jk_shmem.attached = 0;
257
260
 
258
261
    jk_shmem.size = JK_SHM_ALIGN(sizeof(jk_shm_header_t) + sz);
259
262
 
361
364
{
362
365
    int rc;
363
366
    if (jk_shmem.hdr) {
 
367
        if (jk_shmem.attached) {
 
368
            int p = (int)getpid();
 
369
            if (p != jk_shmem.attached) {
 
370
                /* In case this is a forked child
 
371
                 * do not close the shared memory.
 
372
                 * It will be closed by the parent.
 
373
                 */
 
374
                 return;
 
375
            }
 
376
        }
364
377
        if (jk_shmem.fd_lock >= 0) {
365
378
            close(jk_shmem.fd_lock);
366
379
        }