jim         96/03/17 17:55:57

  Modified:    src       CHANGES conf.h http_main.c mod_cgi.c mod_userdir.c
                         CHANGES conf.h http_main.c mod_cgi.c mod_userdir.c
                        
-----------------------------------------------------------------
                        conf.h: Added FLOCK_SERIALIZED_ACCEPT to A/UX
                        http_main.c: created FLOCK_SERIALIZED_ACCEPT for
                        systems that need it,  but using fcntl() locking is
                        expensive (esp. running NFS) mod_cgi.c: Cliff
                        Skolnick's read_client_block check mod_userdir.c:
                        If we hit the end of the UserDir list, and we
                        haven't  found a file, return NOT_FOUND; we were
                        returning OK before  with junk in the r->filename
                        slot
  Log:
  Committing in apache/src
  
  Revision  Changes    Path
  1.11      +11 -0     apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -C3 -r1.10 -r1.11
  *** CHANGES   1996/03/17 08:41:32     1.10
  --- CHANGES   1996/03/18 01:55:35     1.11
  ***************
  *** 1,3 ****
  --- 1,14 ----
  +   *) Added FLOCK_SERIALIZED_ACCEPT for those systems, like A/UX,
  +      that need mutex-capability but using fcntl-locking is
  +      expensive. [Jim Jagielski]
  + 
  +   *) Fixed translate_userdir(): return NOT_FOUND when at the end
  +      of the UserDir list (was returning OK and junk in the filename).
  +      [Jim Jagielski]
  + 
  +   *) Added in Cliff Skolnick's read_client_block patch (check for
  +      no reads and break) [Jim Jagielski]
  + 
      *) If there was no default MIME type defined, Apache sent Content-type:
         without a newline, thus swallowing the next header. Changed to send no
         Content-type: at all. [Ben Laurie]
  
  
  
  1.9       +2 -0      apache/src/conf.h
  
  Index: conf.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/conf.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -C3 -r1.8 -r1.9
  *** conf.h    1996/03/15 11:28:24     1.8
  --- conf.h    1996/03/18 01:55:37     1.9
  ***************
  *** 224,229 ****
  --- 224,231 ----
    #undef NO_SETSID
    #define NEED_STRDUP
    #define JMP_BUF sigjmp_buf
  + /* fcntl() locking is expensive with NFS */
  + #define FLOCK_SERIALIZED_ACCEPT
    #define HAVE_SHMGET
    #define MOVEBREAK           0x4000000
    
  
  
  
  1.9       +65 -4     apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -C3 -r1.8 -r1.9
  *** http_main.c       1996/03/15 11:28:25     1.8
  --- http_main.c       1996/03/18 01:55:38     1.9
  ***************
  *** 145,158 ****
    
    int one_process = 0;
    
  ! #ifdef FCNTL_SERIALIZED_ACCEPT
    static struct flock lock_it = { F_WRLCK, 0, 0, 0 };
    static struct flock unlock_it = { F_UNLCK, 0, 0, 0 };
    
    static int lock_fd=-1;
    
    /*
  !  * Initialise mutex lock.
     * Must be safe to call this on a restart.
     */
    void
  --- 145,158 ----
    
    int one_process = 0;
    
  ! #if defined(FCNTL_SERIALIZED_ACCEPT)
    static struct flock lock_it = { F_WRLCK, 0, 0, 0 };
    static struct flock unlock_it = { F_UNLCK, 0, 0, 0 };
    
    static int lock_fd=-1;
    
    /*
  !  * Initialize mutex lock.
     * Must be safe to call this on a restart.
     */
    void
  ***************
  *** 172,178 ****
        if (lock_fd == -1)
        {
        perror ("open");
  !     fprintf (stderr, "Cannot open lcok file\n");
        exit (1);
        }
        unlink(lock_fname);
  --- 172,178 ----
        if (lock_fd == -1)
        {
        perror ("open");
  !     fprintf (stderr, "Cannot open lock file\n");
        exit (1);
        }
        unlink(lock_fname);
  ***************
  *** 201,206 ****
  --- 201,260 ----
        exit(1);
        }
    }
  + #elif defined(FLOCK_SERIALIZED_ACCEPT)
  + 
  + static int lock_fd=-1;
  + 
  + /*
  +  * Initialize mutex lock.
  +  * Must be safe to call this on a restart.
  +  */
  + void
  + accept_mutex_init(pool *p)
  + {
  +     char lock_fname[30];
  + 
  +     strcpy(lock_fname, "/usr/tmp/htlock.XXXXXX");
  +     
  +     if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0')
  +     {
  +     fprintf (stderr, "Cannot assign name to lock file!\n");
  +     exit (1);
  +     }
  + 
  +     lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY, 0644);
  +     if (lock_fd == -1)
  +     {
  +     perror ("open");
  +     fprintf (stderr, "Cannot open lock file\n");
  +     exit (1);
  +     }
  +     unlink(lock_fname);
  + }
  + 
  + void accept_mutex_on()
  + {
  +     int ret;
  +     
  +     while ((ret = flock(lock_fd, LOCK_EX)) < 0 && errno == EINTR)
  +     continue;
  + 
  +     if (ret < 0) {
  +     log_unixerr("flock", "LOCK_EX", "Error getting accept lock. Exiting!",
  +                 server_conf);
  +     exit(1);
  +     }
  + }
  + 
  + void accept_mutex_off()
  + {
  +     if (flock (lock_fd, LOCK_UN) < 0)
  +     {
  +     log_unixerr("flock", "LOCK_UN", "Error freeing accept lock. Exiting!",
  +                 server_conf);
  +     exit(1);
  +     }
  + }
    #else
    /* Default --- no serialization.  Other methods *could* go here,
     * as #elifs...
  ***************
  *** 1022,1028 ****
        
        update_child_status (child_num, SERVER_BUSY);
        conn_io = bcreate(ptrans, B_RDWR);
  !     bpushfd(conn_io, csd, csd);
    
        current_conn = new_connection (ptrans, server_conf, conn_io,
                                       (struct sockaddr_in *)&sa_client,
  --- 1076,1089 ----
        
        update_child_status (child_num, SERVER_BUSY);
        conn_io = bcreate(ptrans, B_RDWR);
  !     dupped_csd = csd;
  ! #if defined(NEED_DUPPED_CSD)
  !     if ((dupped_csd = dup(csd)) < 0) {
  !         log_unixerr("dup", NULL, "couldn't duplicate csd", server_conf);
  !         dupped_csd = csd;   /* Oh well... */
  !     }
  ! #endif
  !     bpushfd(conn_io, csd, dupped_csd);
    
        current_conn = new_connection (ptrans, server_conf, conn_io,
                                       (struct sockaddr_in *)&sa_client,
  
  
  
  1.5       +2 -0      apache/src/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_cgi.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -C3 -r1.4 -r1.5
  *** mod_cgi.c 1996/03/01 03:01:07     1.4
  --- mod_cgi.c 1996/03/18 01:55:39     1.5
  ***************
  *** 306,311 ****
  --- 306,313 ----
            if (len_to_read > HUGE_STRING_LEN) len_to_read = HUGE_STRING_LEN;
            
            len_read = read_client_block (r, argsbuffer, len_to_read);
  +         if (len_read == 0)
  +             break;
            fwrite (argsbuffer, 1, len_read, script_out);
            remaining -= len_read;
        }
  
  
  
  1.4       +5 -2      apache/src/mod_userdir.c
  
  Index: mod_userdir.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_userdir.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -C3 -r1.3 -r1.4
  *** mod_userdir.c     1996/03/01 02:59:14     1.3
  --- mod_userdir.c     1996/03/18 01:55:39     1.4
  ***************
  *** 173,183 ****
    
          }
    
  !       /* Now see if it exists, or we're at the last entry */
  !       if (!*userdirs || stat(filename, &r->finfo) != -1) {
        r->filename = pstrcat(r->pool, filename, dname, NULL);
        return OK;
          }
        }
    
      return DECLINED;    
  --- 173,186 ----
    
          }
    
  !       /* Now see if it exists */
  !       if (stat(filename, &r->finfo) != -1) {
        r->filename = pstrcat(r->pool, filename, dname, NULL);
        return OK;
          }
  +       /* At last entry? Then NOT_FOUND */
  +       if (!*userdirs) 
  +     return NOT_FOUND;
        }
    
      return DECLINED;    
  
  
  
  1.11      +11 -0     apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -C3 -r1.10 -r1.11
  *** CHANGES   1996/03/17 08:41:32     1.10
  --- CHANGES   1996/03/18 01:55:35     1.11
  ***************
  *** 1,3 ****
  --- 1,14 ----
  +   *) Added FLOCK_SERIALIZED_ACCEPT for those systems, like A/UX,
  +      that need mutex-capability but using fcntl-locking is
  +      expensive. [Jim Jagielski]
  + 
  +   *) Fixed translate_userdir(): return NOT_FOUND when at the end
  +      of the UserDir list (was returning OK and junk in the filename).
  +      [Jim Jagielski]
  + 
  +   *) Added in Cliff Skolnick's read_client_block patch (check for
  +      no reads and break) [Jim Jagielski]
  + 
      *) If there was no default MIME type defined, Apache sent Content-type:
         without a newline, thus swallowing the next header. Changed to send no
         Content-type: at all. [Ben Laurie]
  
  
  
  1.9       +2 -0      apache/src/conf.h
  
  Index: conf.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/conf.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -C3 -r1.8 -r1.9
  *** conf.h    1996/03/15 11:28:24     1.8
  --- conf.h    1996/03/18 01:55:37     1.9
  ***************
  *** 224,229 ****
  --- 224,231 ----
    #undef NO_SETSID
    #define NEED_STRDUP
    #define JMP_BUF sigjmp_buf
  + /* fcntl() locking is expensive with NFS */
  + #define FLOCK_SERIALIZED_ACCEPT
    #define HAVE_SHMGET
    #define MOVEBREAK           0x4000000
    
  
  
  
  1.9       +65 -4     apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -C3 -r1.8 -r1.9
  *** http_main.c       1996/03/15 11:28:25     1.8
  --- http_main.c       1996/03/18 01:55:38     1.9
  ***************
  *** 145,158 ****
    
    int one_process = 0;
    
  ! #ifdef FCNTL_SERIALIZED_ACCEPT
    static struct flock lock_it = { F_WRLCK, 0, 0, 0 };
    static struct flock unlock_it = { F_UNLCK, 0, 0, 0 };
    
    static int lock_fd=-1;
    
    /*
  !  * Initialise mutex lock.
     * Must be safe to call this on a restart.
     */
    void
  --- 145,158 ----
    
    int one_process = 0;
    
  ! #if defined(FCNTL_SERIALIZED_ACCEPT)
    static struct flock lock_it = { F_WRLCK, 0, 0, 0 };
    static struct flock unlock_it = { F_UNLCK, 0, 0, 0 };
    
    static int lock_fd=-1;
    
    /*
  !  * Initialize mutex lock.
     * Must be safe to call this on a restart.
     */
    void
  ***************
  *** 172,178 ****
        if (lock_fd == -1)
        {
        perror ("open");
  !     fprintf (stderr, "Cannot open lcok file\n");
        exit (1);
        }
        unlink(lock_fname);
  --- 172,178 ----
        if (lock_fd == -1)
        {
        perror ("open");
  !     fprintf (stderr, "Cannot open lock file\n");
        exit (1);
        }
        unlink(lock_fname);
  ***************
  *** 201,206 ****
  --- 201,260 ----
        exit(1);
        }
    }
  + #elif defined(FLOCK_SERIALIZED_ACCEPT)
  + 
  + static int lock_fd=-1;
  + 
  + /*
  +  * Initialize mutex lock.
  +  * Must be safe to call this on a restart.
  +  */
  + void
  + accept_mutex_init(pool *p)
  + {
  +     char lock_fname[30];
  + 
  +     strcpy(lock_fname, "/usr/tmp/htlock.XXXXXX");
  +     
  +     if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0')
  +     {
  +     fprintf (stderr, "Cannot assign name to lock file!\n");
  +     exit (1);
  +     }
  + 
  +     lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY, 0644);
  +     if (lock_fd == -1)
  +     {
  +     perror ("open");
  +     fprintf (stderr, "Cannot open lock file\n");
  +     exit (1);
  +     }
  +     unlink(lock_fname);
  + }
  + 
  + void accept_mutex_on()
  + {
  +     int ret;
  +     
  +     while ((ret = flock(lock_fd, LOCK_EX)) < 0 && errno == EINTR)
  +     continue;
  + 
  +     if (ret < 0) {
  +     log_unixerr("flock", "LOCK_EX", "Error getting accept lock. Exiting!",
  +                 server_conf);
  +     exit(1);
  +     }
  + }
  + 
  + void accept_mutex_off()
  + {
  +     if (flock (lock_fd, LOCK_UN) < 0)
  +     {
  +     log_unixerr("flock", "LOCK_UN", "Error freeing accept lock. Exiting!",
  +                 server_conf);
  +     exit(1);
  +     }
  + }
    #else
    /* Default --- no serialization.  Other methods *could* go here,
     * as #elifs...
  ***************
  *** 1022,1028 ****
        
        update_child_status (child_num, SERVER_BUSY);
        conn_io = bcreate(ptrans, B_RDWR);
  !     bpushfd(conn_io, csd, csd);
    
        current_conn = new_connection (ptrans, server_conf, conn_io,
                                       (struct sockaddr_in *)&sa_client,
  --- 1076,1089 ----
        
        update_child_status (child_num, SERVER_BUSY);
        conn_io = bcreate(ptrans, B_RDWR);
  !     dupped_csd = csd;
  ! #if defined(NEED_DUPPED_CSD)
  !     if ((dupped_csd = dup(csd)) < 0) {
  !         log_unixerr("dup", NULL, "couldn't duplicate csd", server_conf);
  !         dupped_csd = csd;   /* Oh well... */
  !     }
  ! #endif
  !     bpushfd(conn_io, csd, dupped_csd);
    
        current_conn = new_connection (ptrans, server_conf, conn_io,
                                       (struct sockaddr_in *)&sa_client,
  
  
  
  1.5       +2 -0      apache/src/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_cgi.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -C3 -r1.4 -r1.5
  *** mod_cgi.c 1996/03/01 03:01:07     1.4
  --- mod_cgi.c 1996/03/18 01:55:39     1.5
  ***************
  *** 306,311 ****
  --- 306,313 ----
            if (len_to_read > HUGE_STRING_LEN) len_to_read = HUGE_STRING_LEN;
            
            len_read = read_client_block (r, argsbuffer, len_to_read);
  +         if (len_read == 0)
  +             break;
            fwrite (argsbuffer, 1, len_read, script_out);
            remaining -= len_read;
        }
  
  
  
  1.4       +5 -2      apache/src/mod_userdir.c
  
  Index: mod_userdir.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_userdir.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -C3 -r1.3 -r1.4
  *** mod_userdir.c     1996/03/01 02:59:14     1.3
  --- mod_userdir.c     1996/03/18 01:55:39     1.4
  ***************
  *** 173,183 ****
    
          }
    
  !       /* Now see if it exists, or we're at the last entry */
  !       if (!*userdirs || stat(filename, &r->finfo) != -1) {
        r->filename = pstrcat(r->pool, filename, dname, NULL);
        return OK;
          }
        }
    
      return DECLINED;    
  --- 173,186 ----
    
          }
    
  !       /* Now see if it exists */
  !       if (stat(filename, &r->finfo) != -1) {
        r->filename = pstrcat(r->pool, filename, dname, NULL);
        return OK;
          }
  +       /* At last entry? Then NOT_FOUND */
  +       if (!*userdirs) 
  +     return NOT_FOUND;
        }
    
      return DECLINED;    
  
  
  
                       
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
                       
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  
  No                   revision
  
  
  
  

Reply via email to