RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [email protected]
  Module: rpm                              Date:   13-Sep-2014 19:50:52
  Branch: rpm-5_4                          Handle: 2014091317504902

  Modified files:           (Branch: rpm-5_4)
    rpm                     CHANGES configure.ac
    rpm/rpmio               rpmio.c

  Log:
    - rpmio: use funopen(3) on *BSD when available (untested).

  Summary:
    Revision    Changes     Path
    1.3501.2.439+1  -0      rpm/CHANGES
    2.472.2.115 +12 -1      rpm/configure.ac
    1.230.2.18  +25 -7      rpm/rpmio/rpmio.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3501.2.438 -r1.3501.2.439 CHANGES
  --- rpm/CHANGES       11 Sep 2014 18:46:19 -0000      1.3501.2.438
  +++ rpm/CHANGES       13 Sep 2014 17:50:49 -0000      1.3501.2.439
  @@ -1,4 +1,5 @@
   5.4.15 -> 5.4.16:
  +    - jbj: rpmio: use funopen(3) on *BSD when available (untested).
       - jbj: rpmct: add %{copy foo bar:} embedding.
       - jbj: rpmpopt: fix: escaped newline was fubar, grr.
       - jbj: lua: upgrade to lua-5.2.3.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/configure.ac
  ============================================================================
  $ cvs diff -u -r2.472.2.114 -r2.472.2.115 configure.ac
  --- rpm/configure.ac  8 Sep 2014 20:55:51 -0000       2.472.2.114
  +++ rpm/configure.ac  13 Sep 2014 17:50:50 -0000      2.472.2.115
  @@ -224,6 +224,11 @@
       if test ".$enableval" = .yes; then
           if test ".`$CC --version 2>&1 | grep 'clang'`" != .; then
               CFLAGS="$CFLAGS -fsanitize=address"
  +#            CFLAGS="$CFLAGS -fsanitize=thread"
  +#            CFLAGS="$CFLAGS -fsanitize=memory 
-fsanitize-memory-track-origins=2 -fno-omit-frame-pointer"
  +#            CFLAGS="$CFLAGS -fsanitize=integer"
  +#            CFLAGS="$CFLAGS -fsanitize=undefined"
  +#            CFLAGS="$CFLAGS -fsanitize=undefined-trap"
           fi
       fi
   ])
  @@ -741,7 +746,7 @@
       sys/utsname.h sys/prctl.h sys/wait.h netinet/in_systm.h dnl
       machine/types.h mntent.h sys/mnttab.h sys/systemcfg.h dnl
       sys/param.h sys/mount.h sys/mntctl.h sys/vmount.h dnl
  -    libio.h err.h mcheck.h limits.h libgen.h float.h dnl
  +    err.h mcheck.h limits.h libgen.h float.h dnl
       glob.h poll.h netinet/in.h arpa/inet.h dnl
       langinfo.h dnl
   ])
  @@ -809,6 +814,12 @@
   AC_CHECK_HEADERS(search.h)
   AC_CHECK_FUNC(insque, [], [ AC_CHECK_LIB(compat, insque) ])
   
  +dnl # POSIX fmemopen(3) et al API.
  +AC_CHECK_FUNCS(fmemopen open_memstream open_wmemstream)
  +AC_CHECK_HEADERS(libio.h)
  +AC_CHECK_FUNCS(fopencookie)
  +AC_CHECK_FUNCS(funopen)
  +
   dnl # POSIX pthreads API
   WITH_PTHREADS=no
   AC_ARG_WITH([pthreads],
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.c
  ============================================================================
  $ cvs diff -u -r1.230.2.17 -r1.230.2.18 rpmio.c
  --- rpm/rpmio/rpmio.c 11 Sep 2014 18:18:33 -0000      1.230.2.17
  +++ rpm/rpmio/rpmio.c 13 Sep 2014 17:50:51 -0000      1.230.2.18
  @@ -91,8 +91,12 @@
   #include <rpmsp.h>
   #include <rpmsx.h>
   
  -#if defined(HAVE_LIBIO_H) && defined(_G_IO_IO_FILE_VERSION)
  +#if defined(HAVE_FOPENCOOKIE) && defined(HAVE_LIBIO_H) && 
defined(_G_IO_IO_FILE_VERSION)
   #define      _USE_LIBIO      1
  +#elif defined(HAVE_FUNOPEN)
  +#define      _USE_LIBIO      1
  +#else
  +#define      _USE_LIBIO      0
   #endif
   
   /* XXX HP-UX w/o -D_XOPEN_SOURCE needs */
  @@ -162,11 +166,7 @@
   /**
    */
   /*@unchecked@*/
  -#if _USE_LIBIO
  -int noLibio = 0;
  -#else
  -int noLibio = 1;
  -#endif
  +int noLibio = _USE_LIBIO;
   
   #define TIMEOUT_SECS 60
   
  @@ -2720,7 +2720,7 @@
        *f = flags;
   }
   
  -#if _USE_LIBIO
  +#if defined(HAVE_FOPENCOOKIE)
   #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 0
   /* XXX retrofit glibc-2.1.x typedef on glibc-2.0.x systems */
   typedef _IO_cookie_io_functions_t cookie_io_functions_t;
  @@ -2815,6 +2815,7 @@
        FILE * fp = NULL;
   
   #if _USE_LIBIO
  +#if defined(HAVE_FOPENCOOKIE)
        {   cookie_io_functions_t ciof;
            ciof.read = iof->read;
            ciof.write = iof->write;
  @@ -2823,6 +2824,23 @@
            fp = fopencookie(fd, stdio, ciof);
   DBGIO(fd, (stderr, "<-- fopencookie(%p,\"%s\",*%p) returns fp %p\n", fd, 
stdio, iof, fp));
        }
  +#elif defined(HAVE_FUNOPEN)
  +     {   void * cookie = (void *) fd;
  +         int    (*readfn)  (void *cookie, char *, int) =
  +                     (int (*) (void *, char *, int)) iof->read;
  +         int    (*writefn) (void *cookie, const char *, int) =
  +                     (int (*) (void *, const char *, int)) iof->write;
  +         fpos_t (*seekfn)  (void *cookie, fpos_t, int) =
  +                     (fpos_t (*) (void *, fpos_t, int)) iof->seek =
  +         int    (*closefn) (void *cookie) =
  +                     (int (*) (void *)) iof->close;
  +         /* XXX FIXME: read/write/seek/close vectors based on stdio fmode. */
  +         fp = funopen(cookie, readfn, writefn, seekfn, closefn);
  +DBGIO(fd, (stderr, "<-- funopen(%p,...) mode %s returns fp %p\n", fd, stdio, 
fp));
  +     }
  +#else
  +#error       _USE_LIBIO needs either fopencookie(3) or funopen(3).
  +#endif
   #endif
   
        if (fp) {
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to