rbb         99/04/20 13:46:43

  Modified:    apr/file_io/unix Makefile
               include  apr_file_io.h
               docs     fileio.txt threadproc.txt
  Added:       apr/file_io/unix pipe.c
  Log:
  added create_pipe and create_namedpipe calls to apr.  These are untested,
  because I will be using the createprocess stuff to test them as soon as I 
write
  it.  They do compile though.
  
  Revision  Changes    Path
  1.7       +2 -1      apache-apr/apr/file_io/unix/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/Makefile,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Makefile  1999/04/12 17:48:19     1.6
  +++ Makefile  1999/04/20 20:46:40     1.7
  @@ -48,7 +48,7 @@
   LIB=  libfile.a
   
   OBJS= open.o readwrite.o filedup.o filestat.o seek.o dir.o\
  -      fileacc.o
  +      fileacc.o pipe.o
   .c.o:
        $(CC) -c $(INCLUDES) $(CFLAGS) $<
   
  @@ -89,3 +89,4 @@
   seek.o: seek.c
   dir.o: dir.c
   fileacc.o: fileacc.c
  +pipe.o: pipe.c
  
  
  
  1.1                  apache-apr/apr/file_io/unix/pipe.c
  
  Index: pipe.c
  ===================================================================
  /* ====================================================================
   * Copyright (c) 1999 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. All advertising materials mentioning features or use of this
   *    software must display the following acknowledgment:
   *    "This product includes software developed by the Apache Group
   *    for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * 4. The names "Apache Server" and "Apache Group" must not be used to
   *    endorse or promote products derived from this software without
   *    prior written permission. For written permission, please contact
   *    [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 6. Redistributions of any form whatsoever must retain the following
   *    acknowledgment:
   *    "This product includes software developed by the Apache Group
   *    for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
   * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Group.
   * For more information on the Apache Group and the Apache HTTP server
   * project, please see <http://www.apache.org/>.
   *
   */
  
  #include "apr_file_io.h"
  #include "apr_general.h"
  #include <errno.h>
  #include <string.h>
  #include <stdio.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  
  apr_status_t apr_create_pipe(apr_file_t *in, apr_file_t *out)
  {
      int filedes[2];
  
      if (pipe(filedes) == -1) {
          return APR_FAILURE;
      }
      
      in->filedes = filedes[0];
      in->fname = strdup("PIPE");
  
      out->filedes = filedes[1];
      out->fname = strdup("PIPE");
  
      return APR_SUCCESS;
  }
  
  char *apr_create_namedpipe(char *dirpath, apr_fileperms_t mode)
  {
      char *tmp;
  
      tmp = tempnam(dirpath, NULL);
      if (mkfifo(tmp, mode) == -1) {
          free(tmp);
          return NULL;
      }
      return tmp;
  } 
          
   
  
  
  
  1.16      +3 -0      apache-apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_file_io.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- apr_file_io.h     1999/04/12 17:50:43     1.15
  +++ apr_file_io.h     1999/04/20 20:46:42     1.16
  @@ -126,6 +126,9 @@
   apr_status_t apr_make_dir(const char *, apr_fileperms_t);
   apr_status_t apr_remove_dir(const char *);
   
  +apr_status_t apr_create_pipe(apr_file_t *, apr_file_t *);
  +char *apr_create_namedpipe(char *, apr_fileperms_t);
  +
   /*accessor and general file_io functions. */
   apr_status_t apr_valid_file(apr_file_t *);
   char *apr_get_filename(apr_file_t *);
  
  
  
  1.14      +20 -0     apache-apr/docs/fileio.txt
  
  Index: fileio.txt
  ===================================================================
  RCS file: /home/cvs/apache-apr/docs/fileio.txt,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- fileio.txt        1999/04/12 18:54:48     1.13
  +++ fileio.txt        1999/04/20 20:46:43     1.14
  @@ -166,7 +166,27 @@
        arg 1)  File to get the name of 
        return) filename.  NULL on failure 
   
  + apr_status_t apr_create_pipe(apr_file_t *, apr_file_t *)
  +        create an unnamed pipe
  +     Arguments:
  +        arg 1)  File for reading from the pipe.
  +        arg 2)  File for writing to the pipe.
  +        return) APR_SUCCESS or APR_FAILURE
  +NOTE:  Unnamed pipes are ALWAYS inherited by any child process created by the
  +       process which created the pipes.  If the platform is storing the file
  +       name internally in apr, for pipes, this should be set to "PIPE" all 
in 
  +       caps.  This allows the program to easily determine what is a pipe, 
and 
  +       what isn't.  All other fields are left to the individual platform to
  +       set appropriately.  
   
  +char *apr_create_namedpipe(char *, apr_fileperms_t)
  +       create a uniquely named pipe in the temp directory.
  +     Arguments:
  +       arg 1)  The directory to create the named pipe in.  Can BE NULL! 
  +       arg 2)  The permissions for the named pipe.
  +       return) The name of the newly created pipe. (fully defined path)
  +NOTE:  If directory name is NULL, the platform decides where it is best to 
put
  +       the pipe.  To get it in the current dir, use "." here :) 
   
   **************** IMPLEMENTATION DETAILS **************
   
  
  
  
  1.2       +2 -3      apache-apr/docs/threadproc.txt
  
  Index: threadproc.txt
  ===================================================================
  RCS file: /home/cvs/apache-apr/docs/threadproc.txt,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- threadproc.txt    1999/04/20 15:12:27     1.1
  +++ threadproc.txt    1999/04/20 20:46:43     1.2
  @@ -22,11 +22,10 @@
          to produce this function should define it as NULL, so that there are
          no compile time errors. 
           
  -apr_status_t apr_createprocattr_init(apr_procattr_t *);
  +apr_procattr_t *apr_createprocattr_init(void);
           create a new process attr type with OS dependant defaults
        Arguments:
  -        arg 1)  New process attribute type.
  -        return) APR_SUCCESS or APR_FAILURE.
  +        return) New process attribute type.
   
   apr_status_t apr_setprocattr_io(apr_procattr_t *, apr_int32_t, apr_int32_t, 
apr_int32_t)
           setup stdin, stdout, and stderr attributes for the new proc
  
  
  

Reply via email to