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

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   21-Apr-2017 04:58:44
  Branch: rpm-5_4                          Handle: 2017042102584301

  Modified files:           (Branch: rpm-5_4)
    rpm                     CHANGES configure.ac
    rpm/rpmio               librpmio.vers rpmdefs.h rpmio.c rpmio.h
                            rpmio_internal.h rpmrpc.c
    rpm/tools               rpmdigest.c rpmmtree.c

  Log:
    - autofu: refactor to add 
--with-{aio,clock,mq,sched,search,sem,shm,timer,xattr,attr,cap,acl,keyutils} 
subsystem detection build options.
    - rpmio: add memfd_create+add_key+request_key+keyctl syscalls.

  Summary:
    Revision    Changes     Path
    1.3501.2.535+2  -0      rpm/CHANGES
    2.472.2.162 +402 -48    rpm/configure.ac
    2.199.2.69  +1  -0      rpm/rpmio/librpmio.vers
    1.1.2.4     +2  -0      rpm/rpmio/rpmdefs.h
    1.230.2.43  +22 -0      rpm/rpmio/rpmio.c
    1.97.2.13   +5  -0      rpm/rpmio/rpmio.h
    2.127.2.12  +3  -0      rpm/rpmio/rpmio_internal.h
    2.99.2.9    +210 -327   rpm/rpmio/rpmrpc.c
    2.18.4.7    +1  -1      rpm/tools/rpmdigest.c
    2.17.2.9    +2  -2      rpm/tools/rpmmtree.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3501.2.534 -r1.3501.2.535 CHANGES
  --- rpm/CHANGES       19 Apr 2017 20:42:14 -0000      1.3501.2.534
  +++ rpm/CHANGES       21 Apr 2017 02:58:43 -0000      1.3501.2.535
  @@ -1,4 +1,6 @@
   5.4.17 -> 5.4.18:
  +    - jbj: autofu: refactor to add 
--with-{aio,clock,mq,sched,search,sem,shm,timer,xattr,attr,cap,acl,keyutils} 
subsystem detection build options.
  +    - jbj: rpmio: add memfd_create.
       - jbj: rpmio: add fgetxattr+flistxattr+fremovexattr+fsetxattr
       - jbj: rpmio: add getrandom+getentropy
       - jbj: rpmio: add syncfs+ftruncate+futimens
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/configure.ac
  ============================================================================
  $ cvs diff -u -r2.472.2.161 -r2.472.2.162 configure.ac
  --- rpm/configure.ac  19 Apr 2017 20:42:14 -0000      2.472.2.161
  +++ rpm/configure.ac  21 Apr 2017 02:58:43 -0000      2.472.2.162
  @@ -1301,8 +1301,8 @@
       sys/ioctl.h sys/ipc.h sys/mman.h sys/mntctl.h sys/mnttab.h dnl
       sys/mount.h sys/param.h sys/prctl.h sys/resource.h dnl
       sys/select.h sys/socket.h sys/statfs.h sys/statvfs.h dnl
  -    sys/stdtypes.h sys/systemcfg.h sys/time.h sys/timeb.h dnl
  -    sys/types.h sys/utsname.h sys/vfs.h sys/vmount.h sys/wait.h dnl
  +    sys/stdtypes.h sys/systemcfg.h sys/time.h sys/timeb.h sys/types.h dnl
  +    sys/utsname.h sys/vfs.h sys/vmount.h sys/xattr.h sys/wait.h dnl
       syslog.h termio.h termios.h unistd.h utime.h utmp.h utmpx.h dnl
       wchar.h dnl
   ])
  @@ -1355,22 +1355,58 @@
   AC_CHECK_FUNC(socket,        [], [ AC_CHECK_LIB(socket, socket) ])
   
   dnl # specific functions (for linking against *external* Berkeley-DB under 
Solaris)
  -AC_CHECK_FUNC(fdatasync,     [], [ AC_CHECK_LIB(rt, fdatasync) ])
  -AC_CHECK_FUNC(sched_yield,   [], [ AC_CHECK_LIB(rt, sched_yield) ])
  -AC_CHECK_FUNC(clock_gettime, [], [ AC_CHECK_LIB(rt, clock_gettime) ])
  +AC_CHECK_FUNC(fdatasync,          [], [ AC_CHECK_LIB(rt, fdatasync) ])
  +AC_CHECK_FUNC(sched_yield,        [], [ AC_CHECK_LIB(rt, sched_yield) ])
  +AC_CHECK_FUNC(clock_gettime,      [], [ AC_CHECK_LIB(rt, clock_gettime) ])
   
   dnl # specific functions (generic)
  -AC_CHECK_FUNCS(vsnprintf snprintf)
  +AC_CHECK_FUNCS(fclose fdopen fopen fread freopen fwrite)
  +AC_CHECK_FUNCS(fgetc fgets getc getchar ungetc)
  +AC_CHECK_FUNCS(getdelim getline)
  +AC_CHECK_FUNCS(asprintf dprintf fprintf printf sprintf snprintf)
  +AC_CHECK_FUNCS(vasprintf vdprintf vfprintf vprintf vsprintf vsnprintf)
   AC_CHECK_FUNCS(strcoll strverscmp)
   
   dnl # Error API
   AC_CHECK_HEADERS(error.h)
  -AC_CHECK_FUNCS(error)
  +AC_CHECK_FUNCS(error error_at_line)
   
  -dnl # linux getrandom(2) and OpenBSD getentropy(2) syscalls
  -AC_CHECK_HEADERS(sys/syscall.h linux/random.h)
  -AC_CHECK_FUNCS(getrandom)
  +dnl # oddball system calls
  +AC_CHECK_HEADERS(sys/syscall.h)
  +AC_CHECK_HEADERS(linux/random.h)
   AC_CHECK_FUNCS(getentropy)
  +AC_CHECK_FUNCS(getrandom)
  +
  +AC_CHECK_FUNCS(splice tee vmsplice)
  +AC_CHECK_FUNCS(sendfile)
  +
  +AC_CHECK_HEADERS(sys/memfd.h)
  +AC_CHECK_FUNCS(memfd_create)
  +
  +AC_CHECK_HEADERS(sched.h linux/kcmp.h)
  +AC_CHECK_FUNCS(clone kcmp setns unshare)
  +
  +AC_CHECK_HEADERS(sys/mman.h)
  +AC_CHECK_FUNCS(mincore mprotect mremap msync munmap)
  +AC_CHECK_FUNCS(mlock munlock mlockall)
  +
  +AC_CHECK_FUNCS(fadvise   posix_fadvise)
  +AC_CHECK_FUNCS(fallocate posix_fallocate)
  +AC_CHECK_FUNCS(madvise   posix_madvise)
  +AC_CHECK_FUNCS(memalign  posix_memalign)
  +AC_CHECK_FUNCS(aligned_alloc valloc pvalloc)
  +AC_CHECK_FUNCS(posix_mem_offset)
  +AC_CHECK_FUNCS(posix_typed_mem_open)
  +AC_CHECK_FUNCS(remap_file_pages)
  +AC_CHECK_FUNCS(syncfs)
  +
  +AC_CHECK_HEADERS(sys/prctl.h)
  +AC_CHECK_FUNCS(prctl)
  +
  +# Find the best function to set timestamps.
  +AC_CHECK_FUNCS(utime gettimeofday localtime_r tzset)
  +AC_CHECK_FUNCS(utimes lutimes futimes futimesat)
  +AC_CHECK_FUNCS(utimensat futimens)
   
   dnl # POSIX search(3) API
   AC_CHECK_HEADERS(search.h)
  @@ -1481,9 +1517,6 @@
        AC_DEFINE(HAVE_S_ISVTX, 1, [Define as 1 if <sys/stat.h> defines 
S_ISVTX])
   fi
   
  -# Find the best function to set timestamps.
  -AC_CHECK_FUNCS([futimens futimes futimesat utimes utime], [break])
  -
   dnl # The command line tool can copy high resolution timestamps if such
   dnl # information is available in struct stat. Otherwise one second accuracy
   dnl # is used.
  @@ -1577,35 +1610,127 @@
   dnl     strtol strtoul dnl
   dnl ])
   AC_CHECK_FUNCS([dnl
  -    asprintf atexit basename chflags clearenv clock_gettime clone dnl
  -    confstr dup2 endgrent endpwent fallocate fchdir fchflags dnl
  -    fchmod fdatasync fgetxattr flistxattr floor fremovexattr dnl
  -    fsetxattr fsync ftok ftruncate getaddrinfo dnl
  -    getattrlist getcwd getdelim gethostbyaddr gethostbyname dnl
  -    gethostname getline getmode getmntent getmntinfo dnl
  -    getnameinfo getpass getpassphrase gettimeofday getwd dnl
  -    getxattr hasmntopt iconv inet_aton inet_ntoa isascii dnl
  -    lchflags lchmod lchown lgetxattr localtime_r lsetxattr dnl
  -    lutimes madvise mbrlen memchr mempcpy memset mincore mkdir dnl
  -    mkdtemp mkfifo mkstemp mremap msync mtrace munmap nl_langinfo dnl
  -    pathconf posix_fadvise posix_fallocate posix_madvise posix_memalign dnl
  -    posix_memalign posix_mem_offset posix_typed_mem_open dnl
  -    pow prctl putenv realpath regcomp rmdir rpmatch dnl
  -    __secure_getenv secure_getenv dnl
  -    select sendfile setattrlist setenv setmode setns setxattr dnl
  -    sigaction sigaddset sigdelset sigemptyset sighold sigpause dnl
  -    sigprocmask sigrelse sigsuspend setlocale socket splice sqrt dnl
  -    stpcpy stpncpy strcspn strdup strerror strmode dnl
  -    strncasecmp strndup strpbrk strspn strstr strtol strtoul strtoull dnl
  -    syncfs tee tzset uname unshare vmsplice dnl
  +    mbrlen dnl
  +    memchr memrchr rawmemchr dnl
  +    memcmp memcpy memmove dnl
  +    mempcpy wmempcpy dnl
  +    memset dnl
  +dnl
  +    atoi atol atoll dnl
  +    rpmatch dnl
  +    stpcpy stpncpy dnl
  +    strcasecmp strncasecmp dnl
  +    strcat strncat dnl
  +    strchr strrchr strchrnul dnl
  +    strcmp strncmp dnl
  +    strdup strndup dnl
  +    strdupa strndupa dnl
  +    strerror strerror_r strerror_l dnl
  +    strspn strcspn dnl
  +    strstr strcasestr dnl
  +    strtok strtok_r dnl
  +    strtol strtoll dnl
  +    strtoul strtoull dnl
  +    strpbrk dnl
  +    strsep dnl
  +dnl
  +    atexit dnl
  +    getcwd getwd get_current_dir_name dnl
  +    chdir fchdir dnl
  +    chmod fchmod lchmod dnl
  +    chown fchown lchown dnl
  +    chflags fchflags lchflags dnl
  +    getattrlist fgetattrlist getattrlistat dnl
  +    setattrlist fsetattrlist dnl
  +    pathconf fpathconf dnl
  +    truncate ftruncate dnl
  +    realpath dnl
  +    floor pow sqrt dnl
  +dnl
  +    dup dup2 dup3 dnl
  +    link linkat dnl
  +    mkdir mkdirat dnl
  +    mkfifo mkfifoat dnl
  +    open openat creat dnl
  +    rmdir dnl
  +    symlink symlinkat dnl
  +    clearenv putenv setenv unsetenv secure_getenv __secure_getenv dnl
  +dnl
  +    signal signalfd dnl
  +    kill killpg dnl
  +    tkill tgkill dnl
  +    pause dnl
  +    raise dnl
  +    sigaction sigpending sigreturn sigsuspend sigtimedwait dnl
  +    sigpause dnl
  +    sigprocmask pthread_sigmask dnl
  +    sigqueue pthread_sigqueue dnl
  +    sigwait sigwaitinfo dnl
  +    sigemptyset sigfillset sigaddset sigdelset sigismember dnl
  +    sigset sighold sigrelse sigignore dnl
  +    sigvec sigmask sigblock siggetmask sigsetmask dnl
  +dnl
  +    socket dnl
  +dnl
  +    wait waitpid waitid wait3 wait4  dnl
  +dnl
  +    getaddrinfo freeaddrinfo gai_strerror dnl
  +    getnameinfo dnl
  +    inet_aton inet_ntoa dnl
  +    inet_addr inet_network inet_makeaddr inet_lnaof inet_netof dnl
  +dnl
  +    syslog vsyslog openlog closelog setlogmask dnl
  +    getmode setmode strmode dnl
  +dnl    setproctitle setproctitle_init dnl
  +    getpriority setpriority nice dnl
  +dnl
  +    basename dirname dnl
  +    confstr dnl
  +    getgrent setgrent endgrent dnl
  +    getpwent setpwent endpwent dnl
  +    gethostbyaddr gethostbyaddr dnl
  +    gethostbyname gethostbyname2 dnl
  +    gethostbyname_r gethostbyname2_r dnl
  +    gethostent sethostent endhostent gethostent_r dnl
  +    herror hstrerror dnl
  +    gethostname sethostname dnl
  +    getmntent setmntent endmntent addmntent hasmntopt getmntent_r dnl
  +    mntctl dnl
  +    getmntinfo getmntinfo_r dnl
  +    uname dnl
  +dnl
  +    poll ppoll dnl
  +    select pselect dnl
  +    mkdtemp dnl
  +    mkstemp mkstemps dnl
  +    mkostemp mkostemps dnl
  +dnl
  +    getopt getopt_long getopt_long_only dnl
  +dnl
  +    regcomp regexec regerror regfree dnl
  +dnl
  +    setlocale iconv nl_langinfo nl_langinfo_l dnl
  +dnl
  +    isalpha isascii isdigit isprint isspace dnl
  +dnl
  +    ftok dnl
  +    getpass getpassphrase dnl
  +    bsearch qsort qsort_r dnl
  +    rand rand_r srand dnl
  +    random srandom initstate setstate dnl
  +dnl
  +    asctime asctime_r dnl
  +    ctime ctime_r dnl
  +    gmtime gmtime_r dnl
  +    localtime localtime_r dnl
  +    mktime dnl
  +    strftime dnl
  +    time dnl
   ])
   
  -dnl # specific additional tests needed to replace Berkeley-DB db_config.h 
with RPM config.h
  -AC_CHECK_FUNCS([dnl
  -    isalpha isdigit isprint isspace localtime memcmp memcpy memmove printf 
dnl
  -    qsort raise rand strcasecmp strcat strchr strncat strncmp strrchr strsep 
dnl
  -    time atoi atol getopt fclose fgetc fgets fopen fwrite dnl
  -])
  +dnl # glibc malloc tracing.
  +AC_CHECK_HEADERS(mcheck.h)
  +AC_CHECK_FUNCS(mtrace muntrace)
   
   dnl # check for getmntent and alternatives
   AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have 
the getmntent() function]), [
  @@ -1630,13 +1755,25 @@
     done
   fi
   
  -AC_CHECK_FUNCS(setproctitle)
  -if test $ac_cv_func_setproctitle = no; then
  -  # setproctitle is not in the default libraries.  See if it's in some other.
  -  AC_CHECK_LIB(setproctitle, setproctitle, [AC_DEFINE(HAVE_SETPROCTITLE)
  -  LIBS="$LIBS -lsetproctitle"])
  +AC_CHECK_FUNCS(getmode)
  +if test $ac_cv_func_getmode = no; then
  +  AC_CHECK_HEADERS(bsd/unistd.h)
  +  # getmode is not in the default libraries.  See if it's in some other.
  +  for lib in bsd; do
  +    AC_CHECK_LIB(bsd, getmode, [AC_DEFINE(HAVE_SYSLOG)
  +      LIBS="$LIBS -l$lib"; break])
  +  done
   fi
   
  +dnl AC_CHECK_FUNCS(setproctitle)
  +dnl if test $ac_cv_func_setproctitle = no; then
  +dnl   AC_CHECK_HEADERS(bsd/unistd.h)
  +dnl   # setproctitle is not in the default libraries.  See if it's in some 
other.
  +dnl   for lib in bsd setproctitle; do
  +dnl     AC_CHECK_LIB($lib, setproctitle, [AC_DEFINE(HAVE_SETPROCTITLE)
  +dnl       LIBS="$LIBS -l$lib"; break])
  +dnl fi
  +
   dnl # Check how to find out the amount of physical memory in the system. The
   dnl # xz command line tool uses this to automatically limit its memory usage.
   dnl # - sysconf() gives all the needed info on GNU+Linux and Solaris.
  @@ -2880,17 +3017,200 @@
         fi
       ], [])
   
  +dnl # Glibc AIO
  +RPM_CHECK_LIB(
  +    [AIO], [aio],
  +    [rt], [aio_init], [aio.h],
  +    [no,external:none], [],
  +    [
  +        AC_CHECK_FUNC(aio_cancel)
  +        AC_CHECK_FUNC(aio_error)
  +        AC_CHECK_FUNC(aio_fsync)
  +        AC_CHECK_FUNC(aio_read)
  +        AC_CHECK_FUNC(aio_return)
  +        AC_CHECK_FUNC(aio_suspend)
  +        AC_CHECK_FUNC(aio_write)
  +        AC_CHECK_FUNC(aio_init)
  +        AC_CHECK_FUNC(lio_listio)
  +    ], [])
  +
  +dnl # Glibc CLOCK
  +RPM_CHECK_LIB(
  +    [CLOCK], [clock],
  +    [rt], [clock_gettime], [time.h],
  +    [no,external:none], [],
  +    [
  +        AC_CHECK_FUNCS(clock_adjtime)
  +        AC_CHECK_FUNCS(clock_getcpuclockid)
  +        AC_CHECK_FUNCS(clock_getres)
  +        AC_CHECK_FUNCS(clock_gettime)
  +        AC_CHECK_FUNCS(clock_nanosleep)
  +        AC_CHECK_FUNCS(clock_settime)
  +    ], [])
  +
  +dnl # POSIX Message Queues
  +RPM_CHECK_LIB(
  +    [POSIX Message Queues], [mq],
  +    [rt], [mq_open], [mqueue.h],
  +    [no,external:none], [],
  +    [
  +        AC_CHECK_FUNCS(mq_close)
  +        AC_CHECK_FUNCS(mq_getattr)
  +        AC_CHECK_FUNCS(mq_notify)
  +        AC_CHECK_FUNCS(mq_open)
  +        AC_CHECK_FUNCS(mq_receive)
  +        AC_CHECK_FUNCS(mq_send)
  +        AC_CHECK_FUNCS(mq_setattr)
  +        AC_CHECK_FUNCS(mq_timedreceive)
  +        AC_CHECK_FUNCS(mq_timedsend)
  +        AC_CHECK_FUNCS(mq_unlink)
  +    ], [])
  +
  +dnl # POSIX Scheduler
  +RPM_CHECK_LIB(
  +    [SCHED], [sched],
  +    [c], [sched-yield], [sched.h],
  +    [no,external:none], [],
  +    [
  +        AC_CHECK_FUNCS(sched_getaffinity)
  +        AC_CHECK_FUNCS(sched_setaffinity)
  +        AC_CHECK_FUNCS(sched_getparam)
  +        AC_CHECK_FUNCS(sched_setparam)
  +        AC_CHECK_FUNCS(sched_getscheduler)
  +        AC_CHECK_FUNCS(sched_setscheduler)
  +        AC_CHECK_FUNCS(sched_getattr)
  +        AC_CHECK_FUNCS(sched_setattr)
  +        AC_CHECK_FUNCS(sched_getcpu)
  +        AC_CHECK_FUNCS(sched_get_priority_max)
  +        AC_CHECK_FUNCS(sched_get_priority_min)
  +        AC_CHECK_FUNCS(sched_rr_get_interval)
  +        AC_CHECK_FUNCS(sched_yield)
  +    ], [])
  +
  +dnl # Glibc SEARCH
  +RPM_CHECK_LIB(
  +    [SEARCH], [search],
  +    [c], [insque], [search.h],
  +    [no,external:none], [],
  +    [
  +        AC_CHECK_FUNCS(insque)
  +        AC_CHECK_FUNCS(remque)
  +        AC_CHECK_FUNCS(hcreate)
  +        AC_CHECK_FUNCS(hsearch)
  +        AC_CHECK_FUNCS(hdestroy)
  +        AC_CHECK_FUNCS(hcreate_r)
  +        AC_CHECK_FUNCS(hsearch_r)
  +        AC_CHECK_FUNCS(hdestroy_r)
  +        AC_CHECK_FUNCS(lfind)
  +        AC_CHECK_FUNCS(lsearch)
  +        AC_CHECK_FUNCS(tsearch)
  +        AC_CHECK_FUNCS(tfind)
  +        AC_CHECK_FUNCS(tdelete)
  +        AC_CHECK_FUNCS(twalk)
  +        AC_CHECK_FUNCS(tdestroy)
  +    ], [])
  +
  +dnl # POSIX Semaphores
  +RPM_CHECK_LIB(
  +    [POSIX Semaphores], [sem],
  +    [pthread c], [sem_init], [semaphore.h],
  +    [no,external:none], [],
  +    [
  +        AC_CHECK_FUNCS(sem_close)
  +        AC_CHECK_FUNCS(sem_destroy)
  +        AC_CHECK_FUNCS(sem_getvalue)
  +        AC_CHECK_FUNCS(sem_init)
  +        AC_CHECK_FUNCS(sem_open)
  +        AC_CHECK_FUNCS(sem_post)
  +        AC_CHECK_FUNCS(sem_unlink)
  +        AC_CHECK_FUNCS(sem_wait)
  +    ], [])
  +
  +dnl # Glibc SHM
  +RPM_CHECK_LIB(
  +    [SHM], [shm],
  +    [rt], [shm_open], [sys/mman.h],
  +    [no,external:none], [],
  +    [
  +        AC_CHECK_FUNCS(shm_open)
  +        AC_CHECK_FUNCS(shm_unlink)
  +    ], [])
  +
  +dnl # Glibc TIMER
  +RPM_CHECK_LIB(
  +    [TIMER], [timer],
  +    [rt], [timer_create], [time.h],
  +    [no,external:none], [],
  +    [
  +        AC_CHECK_FUNCS(timer_create)
  +        AC_CHECK_FUNCS(timer_delete)
  +        AC_CHECK_FUNCS(timer_gettime)
  +        AC_CHECK_FUNCS(timer_getoverrun)
  +        AC_CHECK_FUNCS(timer_settime)
  +        AC_CHECK_FUNCS(timerfd_create)
  +        AC_CHECK_FUNCS(timerfd_gettime)
  +        AC_CHECK_FUNCS(timerfd_settime)
  +    ], [])
  +
  +dnl # Glibc XATTR
  +RPM_CHECK_LIB(
  +    [XATTR], [xattr],
  +    [c], [getxattr], [sys/xattr.h],
  +    [yes,external:none], [],
  +    [
  +        AC_CHECK_FUNCS(getxattr lgetxattr fgetxattr)
  +        AC_CHECK_FUNCS(setxattr lsetxattr fsetxattr)
  +        AC_CHECK_FUNCS(listxattr llistxattr flistxattr)
  +        AC_CHECK_FUNCS(removexattr lremovexattr fremovexattr)
  +    ], [])
  +
   dnl # FIXME: AutoFu tests for <sys/acl.h> and -lacl are needed w/o --with-xar
   RPM_CHECK_LIB(
       [ATTR], [attr],
  -    [attr], [attr_get], [sys/xattr.h],
  +    [attr], [attr_get], [attr/attributes.h],
       [no,external:none], [],
  -    [], [])
  +    [
  +        AC_CHECK_FUNCS(attr_get attr_getf)
  +        AC_CHECK_FUNCS(attr_set attr_setf)
  +        AC_CHECK_FUNCS(attr_remove attr_removef)
  +        AC_CHECK_FUNCS(attr_list attr_listf)
  +        AC_CHECK_FUNCS(attr_multi attr_multif)
  +    ], [])
  +
  +dnl # Linux Capabilities
  +RPM_CHECK_LIB(
  +    [Linux Capabilities], [cap],
  +    [cap], [cap_init], [sys/capability.h],
  +    [no,external:none], [],
  +    [
  +        AC_CHECK_FUNCS(cap_dup cap_free cap_init)
  +        AC_CHECK_FUNCS(cap_get_flag cap_set_flag cap_clear cap_clear_flag)
  +        AC_CHECK_FUNCS(cap_get_fd cap_get_file cap_set_fd cap_set_file)
  +        AC_CHECK_FUNCS(cap_get_proc cap_get_pid cap_set_proc)
  +        AC_CHECK_FUNCS(cap_get_bound cap_drop_bound)
  +        AC_CHECK_FUNCS(cap_size cap_copy_ext cap_copy_int)
  +        AC_CHECK_FUNCS(cap_from_text cap_to_text cap_from_name cap_to_name)
  +        AC_CHECK_FUNCS(cap_compare capset capget capgetp)
  +    ], [])
  +
  +dnl # ACL API
   RPM_CHECK_LIB(
       [ACL], [acl],
       [acl], [acl_free], [sys/acl.h],
       [no,external:none], [],
  -    [], [])
  +    [
  +        AC_CHECK_FUNCS(acl_t acl_init acl_t acl_dup acl_free acl_valid)
  +        AC_CHECK_FUNCS(acl_copy_entry acl_create_entry)
  +        AC_CHECK_FUNCS(acl_delete_entry acl_get_entry)
  +        AC_CHECK_FUNCS(acl_add_perm acl_calc_mask acl_clear_perms)
  +        AC_CHECK_FUNCS(acl_delete_perm acl_get_permset acl_set_permset)
  +        AC_CHECK_FUNCS(acl_get_qualifier acl_get_tag_type)
  +        AC_CHECK_FUNCS(acl_set_qualifier acl_set_tag_type)
  +        AC_CHECK_FUNCS(acl_copy_ext acl_copy_int acl_from_text)
  +        AC_CHECK_FUNCS(acl_size acl_to_text)
  +        AC_CHECK_FUNCS(acl_delete_def_file acl_get_fd acl_get_file)
  +        AC_CHECK_FUNCS(acl_set_fd acl_set_file)
  +    ], [])
   
   dnl # XAR
   RPM_CHECK_LIB(
  @@ -2932,6 +3252,40 @@
       [keyutils], [keyctl_read], [keyutils.h],
       [no,external:none], [],
       [ WITH_KEYUTILS_RPMKEY="rpmkey"
  +        AC_CHECK_FUNCS(add_key)
  +        AC_CHECK_FUNCS(request_key)
  +        AC_CHECK_FUNCS(keyctl)
  +        AC_CHECK_FUNCS(keyctl_get_keyring_ID)
  +        AC_CHECK_FUNCS(keyctl_join_session_keyring)
  +        AC_CHECK_FUNCS(keyctl_update)
  +        AC_CHECK_FUNCS(keyctl_revoke)
  +        AC_CHECK_FUNCS(keyctl_chown)
  +        AC_CHECK_FUNCS(keyctl_setperm)
  +        AC_CHECK_FUNCS(keyctl_describe)
  +        AC_CHECK_FUNCS(keyctl_clear)
  +        AC_CHECK_FUNCS(keyctl_link)
  +        AC_CHECK_FUNCS(keyctl_unlink)
  +        AC_CHECK_FUNCS(keyctl_search)
  +        AC_CHECK_FUNCS(keyctl_read)
  +        AC_CHECK_FUNCS(keyctl_instantiate)
  +        AC_CHECK_FUNCS(keyctl_negate)
  +        AC_CHECK_FUNCS(keyctl_set_reqkey_keyring)
  +        AC_CHECK_FUNCS(keyctl_set_timeout)
  +        AC_CHECK_FUNCS(keyctl_assume_authority)
  +        AC_CHECK_FUNCS(keyctl_get_security)
  +        AC_CHECK_FUNCS(keyctl_session_to_parent)
  +        AC_CHECK_FUNCS(keyctl_reject)
  +        AC_CHECK_FUNCS(keyctl_instantiate_iov)
  +        AC_CHECK_FUNCS(keyctl_invalidate)
  +        AC_CHECK_FUNCS(keyctl_get_persistent)
  +        AC_CHECK_FUNCS(keyctl_dh_compute)
  +        AC_CHECK_FUNCS(keyctl_describe_alloc)
  +        AC_CHECK_FUNCS(keyctl_read_alloc)
  +        AC_CHECK_FUNCS(keyctl_get_security_alloc)
  +        AC_CHECK_FUNCS(keyctl_dh_compute_alloc)
  +        AC_CHECK_FUNCS(recursive_key_scan)
  +        AC_CHECK_FUNCS(recursive_session_key_scan)
  +        AC_CHECK_FUNCS(find_key_by_type_and_desc)
       ], [])
   AC_SUBST(WITH_KEYUTILS_RPMKEY)
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.199.2.68 -r2.199.2.69 librpmio.vers
  --- rpm/rpmio/librpmio.vers   19 Apr 2017 20:42:15 -0000      2.199.2.68
  +++ rpm/rpmio/librpmio.vers   21 Apr 2017 02:58:43 -0000      2.199.2.69
  @@ -217,6 +217,7 @@
       _max_load_depth;
       _rpmmire_debug;
       _rpmmirePool;
  +    Memfd_create;
       mireAppend;
       mireApply;
       mireClean;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmdefs.h
  ============================================================================
  $ cvs diff -u -r1.1.2.3 -r1.1.2.4 rpmdefs.h
  --- rpm/rpmio/rpmdefs.h       6 Mar 2017 17:48:05 -0000       1.1.2.3
  +++ rpm/rpmio/rpmdefs.h       21 Apr 2017 02:58:43 -0000      1.1.2.4
  @@ -106,8 +106,10 @@
   
   #if    __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
   #  define RPM_GNUC_INTERNAL __attribute__((visibility("hidden")))
  +#  define RPM_GNUC_WEAK __attribute__((weak))
   #else
   #  define RPM_GNUC_INTERNAL
  +#  define RPM_GNUC_WEAK
   #endif
   
   /* if !__clang__ &&  __GNUC__ == 4 && __GNUC_MINOR__ >= 7 */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.c
  ============================================================================
  $ cvs diff -u -r1.230.2.42 -r1.230.2.43 rpmio.c
  --- rpm/rpmio/rpmio.c 19 Apr 2017 20:42:15 -0000      1.230.2.42
  +++ rpm/rpmio/rpmio.c 21 Apr 2017 02:58:43 -0000      1.230.2.43
  @@ -17,6 +17,10 @@
   # include <sys/socket.h>
   #endif
   
  +#if defined(HAVE_SYS_XATTR_H)
  +# include <sys/xattr.h>
  +#endif
  +
   #ifndef NI_MAXHOST
   #define NI_MAXHOST      1025
   #endif
  @@ -563,6 +567,24 @@
       return rc;
   }
   
  +int Memfd_create(const char *name, unsigned int flags)
  +{
  +    int rc = -2;
  +#if defined(HAVE_MEMFD_CREATE)
  +    rc = memfd_create(name, flags);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_memfd_create)
  +    rc = syscall(SYS_memfd_create, name, flags);
  +#else
  +    errno = ENOSYS;
  +#endif
  +    if (rc < 0)
  +     rpmlog(RPMLOG_ERR, _("%s(%s,0x%x) failed: %m\n"),
  +             __FUNCTION__, name, flags);
  +if (_rpmio_debug)
  +fprintf(stderr, _("<-- %s(%s,0x%x) rc %d\n"), __FUNCTION__, name, flags, rc);
  +    return rc;
  +}
  +
   static int _oflagmask = (O_RDONLY|O_WRONLY|O_RDWR
        /* -- linux */
   #ifdef       O_APPEND
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.h
  ============================================================================
  $ cvs diff -u -r1.97.2.12 -r1.97.2.13 rpmio.h
  --- rpm/rpmio/rpmio.h 19 Apr 2017 20:42:15 -0000      1.97.2.12
  +++ rpm/rpmio/rpmio.h 21 Apr 2017 02:58:43 -0000      1.97.2.13
  @@ -358,6 +358,11 @@
   int Mincore(void * addr, size_t len, unsigned char * vec);
   
   /**
  + * memfd_create(2) clone.
  + */
  +int Memfd_create(const char *name, unsigned int flags);
  +
  +/**
    * splice(2) clone.
    */
   ssize_t Splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out,
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio_internal.h
  ============================================================================
  $ cvs diff -u -r2.127.2.11 -r2.127.2.12 rpmio_internal.h
  --- rpm/rpmio/rpmio_internal.h        19 Apr 2017 20:42:15 -0000      
2.127.2.11
  +++ rpm/rpmio/rpmio_internal.h        21 Apr 2017 02:58:43 -0000      
2.127.2.12
  @@ -52,6 +52,7 @@
       FDSTAT_FSYNC     = 22,   /*!< fsync statistics index. */
       FDSTAT_SYNCFS    = 23,   /*!< syncfs statistics index. */
       FDSTAT_FINCORE   = 24,   /*!< fincore statistics index. */
  +    FDSTAT_MEMFD     = 25,   /*!< memfd_create statistics index. */
   
       FDSTAT_MAX
   } fdOpX;
  @@ -62,6 +63,7 @@
   typedef enum fdFlags_e {
       RPMFD_FLAG_NONE          = 0,
        /* 0 - 23 unused */
  +    RPMFD_FLAG_MEMFD         = (1 << 23),
       RPMFD_FLAG_SYNCFS                = (1 << 24),
       RPMFD_FLAG_FSYNC         = (1 << 25),
       RPMFD_FLAG_FDATASYNC     = (1 << 26),
  @@ -464,6 +466,7 @@
            [FDSTAT_SYNCFS]             = "      syncfs",
   
            [FDSTAT_FINCORE]            = "     fincore",
  +         [FDSTAT_MEMFD]              = "       memfd",
        };
        rpmop op = &fd->stats->ops[opx];
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmrpc.c
  ============================================================================
  $ cvs diff -u -r2.99.2.8 -r2.99.2.9 rpmrpc.c
  --- rpm/rpmio/rpmrpc.c        18 Apr 2017 11:14:42 -0000      2.99.2.8
  +++ rpm/rpmio/rpmrpc.c        21 Apr 2017 02:58:43 -0000      2.99.2.9
  @@ -402,9 +402,6 @@
        /*@fallthrough@*/
       case URL_IS_UNKNOWN:
        break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_MONGO:       /* XXX FIXME */
       default:
        errno = EINVAL;
        goto exit;
  @@ -1514,12 +1511,128 @@
       return rc;
   }
   
  +#if defined(HAVE_SYS_SYSCALL_H)
  +#include <sys/syscall.h>
  +#endif
  +
  +/* XXX added in kernel >= 3.17, wrapped in glibc >= 2.25 */
  +int Getrandom(void *buf, size_t buflen, unsigned int flags);
  +int Getrandom(void *buf, size_t buflen, unsigned int flags)
  +{
  +    int rc = -2;
  +#if defined(HAVE_GETRANDOM)
  +    rc = getrandom(buf, buflen, flags);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_getrandom)
  +    rc = syscall(SYS_getrandom, buf, buflen, flags);
  +#else
  +    errno = ENOSYS;
  +#endif
  +    if (rc < 0)
  +     rpmlog(RPMLOG_ERR, _("%s(%p[%u],0x%x) failed: %m\n"),
  +             __FUNCTION__, buf, (unsigned)buflen, flags);
  +if (_rpmio_debug)
  +fprintf(stderr, _("<-- %s(%p[%u],0x%x) rc %d\n"), __FUNCTION__, buf, 
(unsigned)buflen, flags, rc);
  +    return rc;
  +}
  +
  +#if defined(HAVE_KEYUTILS_H)
  +#include <keyutils.h>
  +
  +key_serial_t Add_key(const char *type, const char *description,
  +                            const void *payload, size_t plen,
  +                            key_serial_t keyring);
  +key_serial_t Add_key(const char *type, const char *description,
  +                            const void *payload, size_t plen,
  +                            key_serial_t keyring)
  +{
  +    key_serial_t rc = -2;
  +#if defined(HAVE_ADD_KEY)
  +    rc = add_key(type, description, payload, plen, keyring);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_add_key)
  +    rc = syscall(SYS_add_key, type, description, payload, plen, keyring);
  +#else
  +    errno = ENOSYS;
  +#endif
  +    if (rc < 0)
  +     rpmlog(RPMLOG_ERR, _("%s(%s,%s,%p[%u],%ld) failed: %m\n"),
  +             __FUNCTION__, type, description, payload, (unsigned)plen, 
(long)keyring);
  +if (_rpmio_debug)
  +fprintf(stderr, _("<-- %s(%s,%s,%p[%u],%ld) rc %ld\n"), __FUNCTION__, type, 
description, payload, (unsigned)plen, (long)keyring, (long)rc);
  +    return rc;
  +}
  +
  +key_serial_t Keyctl(int cmd, ...);
  +key_serial_t Keyctl(int cmd, ...)
  +{
  +    long rc = -2;
  +    va_list va;
  +    unsigned long arg2, arg3, arg4, arg5;
  +  
  +    va_start(va, cmd);
  +    arg2 = va_arg(va, unsigned long);
  +    arg3 = va_arg(va, unsigned long);
  +    arg4 = va_arg(va, unsigned long);
  +    arg5 = va_arg(va, unsigned long);
  +    va_end(va);
  +
  +#if defined(HAVE_KEYCTL)
  +    rc = keyctl(cmd, arg2, arg3, arg4, arg5);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_keyctl)
  +    rc = syscall(SYS_keyctl, cmd, arg2, arg3, arg4, arg5);
  +#else
  +    errno = ENOSYS;
  +#endif
  +    if (rc < 0)
  +     rpmlog(RPMLOG_ERR, _("%s(%d) failed: %m\n"),
  +             __FUNCTION__, cmd);
  +if (_rpmio_debug)
  +fprintf(stderr, _("<-- %s(%d) rc %ld\n"), __FUNCTION__, cmd, (long)rc);
  +    return rc;
  +}
  +
  +key_serial_t request_key(const char *type,
  +                                const char *description,
  +                                const char *callout_info,
  +                                key_serial_t keyring);
  +key_serial_t request_key(const char *type,
  +                                const char *description,
  +                                const char *callout_info,
  +                                key_serial_t keyring)
  +{
  +    key_serial_t rc = -2;
  +#if defined(HAVE_REQUEST_KEY)
  +    rc = request_key(type, description, callout_info, keyring);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_request_key)
  +    rc = syscall(SYS_request_key, type, description, callout_info, keyring);
  +#else
  +    errno = ENOSYS;
  +#endif
  +    if (rc < 0)
  +     rpmlog(RPMLOG_ERR, _("%s(%s,%s,%s,%ld) failed: %m\n"),
  +             __FUNCTION__, type, description, callout_info, (long)keyring);
  +if (_rpmio_debug)
  +fprintf(stderr, _("<-- %s(%s,%s,%s,%ld) rc %ld\n"), __FUNCTION__, type, 
description, callout_info, (long)keyring, (long)rc);
  +    return rc;
  +}
  +
  +#endif       /* HAVE_KEYUTILS_H */
  +
   #ifdef       NOTYET
  +
  +#if defined(HAVE_SYS_SENDFILE_H)
   #include <sys/sendfile.h>
  +#endif
  +
   /* XXX kernel < 2.6.33, one of {in,out}_fd must be a socket. */
  +ssize_t Sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
   ssize_t Sendfile(int out_fd, int in_fd, off_t *offset, size_t count)
   {
  -    int rc = sendfile(out_fd, in_fd, offset, count);
  +    int rc;
  +#if defined(HAVE_SENDFILE)
  +    rc = sendfile(out_fd, in_fd, offset, count);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_sendfile)
  +    rc = syscall(SYS_sendfile, out_fd, in_fd, offset, count);
  +#endif
       if (rc < 0)
        rpmlog(RPMLOG_ERR, _("%s(%d, %d, %p, %u) failed: %m\n"),
                __FUNCTION__, out_fd, in_fd, offset, (unsigned)count);
  @@ -1530,23 +1643,24 @@
   
   /* XXX if off_{in,out} are NULL, fd_{in_out} offset is changed. */
   /* XXX if off_{in,out} are not NULL, fd_{in_out} offset are not changed. */
  -static loff_t
  -copy_file_range(int fd_in, loff_t *off_in, int fd_out,
  -             loff_t *off_out, size_t len, unsigned int flags)
  -{
  -    return syscall(__NR_copy_file_range, fd_in, off_in, fd_out,
  -                                     off_out, len, flags);
  -}
  -
  -ssize_t Copy_file_range(int fd_in, loff_t *off_in, int fd_out, loff_t 
*off_out,
  +loff_t Copy_file_range(int fd_in, loff_t *off_in, int fd_out, loff_t 
*off_out,
  +             size_t len, unsigned int flags);
  +loff_t Copy_file_range(int fd_in, loff_t *off_in, int fd_out, loff_t 
*off_out,
                size_t len, unsigned int flags)
   {
  -    int rc = copy_file_range(fd_in, off_in, fd_out, off_out, len, flags);
  +    loff_t  rc = -2;
  +#if defined(HAVE_COPY_FILE_RANGE)
  +    rc = copy_file_range(fd_in, off_in, fd_out, off_out, len, flags);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_copy_file_range)
  +    rc = syscall(SYS_copy_file_range, fd_in, off_in, fd_out, off_out, len, 
flags);
  +#else
  +    errno = ENOSYS;
  +#endif
       if (rc < 0)
        rpmlog(RPMLOG_ERR, _("%s(%d,%p, %d,%p, %u, %u) failed: %m\n"),
                __FUNCTION__, fd_in, off_in, fd_out, off_out, (unsigned)len, 
flags);
   if (_rpmio_debug)
  -fprintf(stderr, _("<-- %s(%d,%p, %d,%p, %u, %u) rc %d\n"),
  +fprintf(stderr, _("<-- %s(%d,%p, %d,%p, %u, %u) rc %ld\n"),
                __FUNCTION__, fd_in, off_in, fd_out, off_out, (unsigned)len, 
flags, rc);
       return rc;
   }
  @@ -1554,11 +1668,15 @@
   
   /* XXX same note as copy_file_range. one of fd_{in,out} must be a pipe. */
   ssize_t Splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out,
  +             size_t len, unsigned int flags);
  +ssize_t Splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out,
                size_t len, unsigned int flags)
   {
       int rc = -2;
  -#ifdef       HAVE_SPLICE
  +#if defined(HAVE_SPLICE)
       rc = splice(fd_in, off_in, fd_out, off_out, len, flags);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_splice)
  +    rc = syscall(SYS_splice, fd_in, off_in, fd_out, off_out, len, flags);
   #else
       errno = ENOSYS;
   #endif
  @@ -1571,11 +1689,14 @@
   }
   
   /* XXX both fd_{in,out} must be pipes. */
  +ssize_t Tee(int fd_in, int fd_out, size_t len, unsigned int flags);
   ssize_t Tee(int fd_in, int fd_out, size_t len, unsigned int flags)
   {
       int rc = -2;
  -#ifdef       HAVE_TEE
  +#if defined(HAVE_TEE)
       rc = tee(fd_in, fd_out, len, flags);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_tee)
  +    rc = syscall(SYS_tee, fd_in, fd_out, len, flags);
   #else
       errno = ENOSYS;
   #endif
  @@ -1589,11 +1710,15 @@
   
   /* XXX fd must be a pipe. */
   ssize_t Vmsplice(int fd, const struct iovec *iov,
  +             unsigned long nr_segs, unsigned int flags);
  +ssize_t Vmsplice(int fd, const struct iovec *iov,
                unsigned long nr_segs, unsigned int flags)
   {
       int rc = -2;
  -#ifdef       HAVE_VMSPLICE
  +#if defined(HAVE_VMSPLICE)
       rc = vmsplice(fd, iov, nr_segs, flags);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_vmsplice)
  +    rc = syscall(SYS_vmsplice, fd, iov, nr_segs, flags);
   #else
       errno = ENOSYS;
   #endif
  @@ -1605,15 +1730,19 @@
       return rc;
   }
   
  -#ifdef       HAVE_PRCTL
  +#if defined(HAVE_PRCTL)
   #include <sys/prctl.h>
   #endif
   int Prctl(int option, unsigned long arg2, unsigned long arg3,
  +                 unsigned long arg4, unsigned long arg5);
  +int Prctl(int option, unsigned long arg2, unsigned long arg3,
                    unsigned long arg4, unsigned long arg5)
   {
       int rc = -2;
  -#ifdef       HAVE_PRCTL
  +#if defined(HAVE_PRCTL)
       rc = prctl(option, arg2, arg3, arg4, arg5);
  +#elif defined(linux) && defined(x86_64) && defined(SYS_prctl)
  +    rc = syscall(SYS_prctl, option, arg2, arg3, arg4, arg5);
   #else
       errno = ENOSYS;
   #endif
  @@ -1628,347 +1757,127 @@
   int Chown(const char * path, uid_t owner, gid_t group)
   {
       int rc = -2;
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = chown(path, owner, group);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%u,%u) rc %d\n", __FUNCTION__, path, 
(unsigned)owner, (unsigned)group, rc);
  -    return rc;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
  +    rc = lpath != NULL
  +     ? chown(lpath, owner, group)
  +     : -2;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Lchown(const char * path, uid_t owner, gid_t group)
   {
       int rc = -2;
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = lchown(path, owner, group);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%u,%u)\n", __FUNCTION__, path, (unsigned)owner, 
(unsigned)group);
  -    return rc;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
  +    rc = lpath != NULL
  +     ? lchown(lpath, owner, group)
  +     : -2;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Chmod(const char * path, mode_t mode)
   {
       int rc = -2;
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = chmod(path, mode);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%0o) rc %d\n", __FUNCTION__, path, (int)mode, rc);
  -    return rc;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
  +    rc = lpath != NULL
  +     ? chmod(lpath, mode)
  +     : -2;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Lchmod(const char * path, mode_t mode)
   {
       int rc = -2;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
   #if defined(HAVE_LCHMOD)
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = lchmod(path, mode);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%0o) rc %d\n", __FUNCTION__, path, (int)mode, rc);
  +    rc = lpath != NULL
  +     ? lchmod(lpath, mode)
  +     : -2;
   #else
       errno = ENOSYS;
   #endif
  -    return rc;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Chflags(const char * path, unsigned int flags)
   {
       int rc = -2;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
   #if defined(HAVE_CHFLAGS)
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -if (_rpmio_debug)
  -fprintf(stderr, "--> Chflags(%s,0x%x)\n", path, flags);
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = chflags(path, flags);
  -exit:
  +    rc = lpath != NULL
  +     ? chflags(lpath, flags)
  +     : -2;
   #else
       errno = ENOSYS;
   #endif
  -    return rc;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Lchflags(const char * path, unsigned int flags)
   {
       int rc = -2;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
   #if defined(HAVE_LCHFLAGS)
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -if (_rpmio_debug)
  -fprintf(stderr, "--> Lchflags(%s,0x%x)\n", path, flags);
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = lchflags(path, flags);
  -exit:
  +    rc = lpath != NULL
  +     ? lchflags(lpath, flags)
  +     : -2;
   #else
       errno = ENOSYS;
   #endif
  -    return rc;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Mkfifo(const char * path, mode_t mode)
   {
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
       int rc = -2;
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = mkfifo(path, mode);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%0o) rc %d\n", __FUNCTION__, path, (int)mode, rc);
  -    return rc;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
  +    rc = lpath != NULL
  +     ? mkfifo(lpath, mode)
  +     : -2;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Mknod(const char * path, mode_t mode, dev_t dev)
   {
       int rc = -2;
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = mknod(path, mode, dev);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%0o, 0x%x) rc %d\n", __FUNCTION__, path, 
(int)mode, (int)dev, rc);
  -    return rc;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
  +    rc = lpath != NULL
  +     ? mknod(lpath, mode, dev)
  +     : -2;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Utime(const char * path, const struct utimbuf *buf)
   {
       int rc = -2;
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = utime(path, buf);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%p) rc %d\n", __FUNCTION__, path, buf, rc);
  -    return rc;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
  +    rc = lpath != NULL
  +     ? utime(lpath, buf)
  +     : -2;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Utimes(const char * path, const struct timeval times[2])
   {
       int rc = -2;
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = utimes(path, times);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%p) rc %d\n", __FUNCTION__, path, times, rc);
  -    return rc;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
  +    rc = lpath != NULL
  +     ? utimes(lpath, times)
  +     : -2;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Lutimes(const char * path, const struct timeval times[2])
   {
       int rc = -2;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
   #ifdef HAVE_LUTIMES
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = lutimes(path, times);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%p) rc %d\n", __FUNCTION__, path, times, rc);
  +    rc = lpath != NULL
  +     ? lutimes(lpath, times)
  +     : -2;
   #else
       errno = ENOSYS;
   #endif
  -    return rc;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   int Symlink(const char * oldpath, const char * newpath)
  @@ -1987,14 +1896,8 @@
        /*@fallthrough@*/
       case URL_IS_UNKNOWN:
        break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
       default:
  -     errno = EINVAL;         /* XXX W2DO? */
  +     errno = EINVAL;
        goto exit;
        break;
       }
  @@ -2046,31 +1949,11 @@
   int Access(const char * path, int amode)
   {
       int rc = -2;
  -    const char * lpath;
  -    int ut = urlPath(path, &lpath);
  -
  -    switch (ut) {
  -    case URL_IS_PATH:
  -     path = lpath;
  -     /*@fallthrough@*/
  -    case URL_IS_UNKNOWN:
  -     break;
  -    case URL_IS_DASH:
  -    case URL_IS_HKP:
  -    case URL_IS_FTP:         /* XXX TODO: implement. */
  -    case URL_IS_HTTP:                /* XXX TODO: implement. */
  -    case URL_IS_HTTPS:               /* XXX TODO: implement. */
  -    case URL_IS_MONGO:       /* XXX FIXME */
  -    default:
  -     errno = EINVAL;         /* XXX W2DO? */
  -     goto exit;
  -     break;
  -    }
  -    rc = access(path, amode);
  -exit:
  -if (_rpmio_debug)
  -fprintf(stderr, "<-- %s(%s,%d) rc %d\n", __FUNCTION__, path, amode, rc);
  -    return rc;
  +    const char * lpath = fdSyscallPrePath(__FUNCTION__, path, 1);;
  +    rc = lpath != NULL
  +     ? access(lpath, amode)
  +     : -2;
  +    return fdSyscallPostPath(__FUNCTION__, lpath, rc);
   }
   
   /* glob_pattern_p() taken from bash
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmdigest.c
  ============================================================================
  $ cvs diff -u -r2.18.4.6 -r2.18.4.7 rpmdigest.c
  --- rpm/tools/rpmdigest.c     24 Sep 2014 16:19:07 -0000      2.18.4.6
  +++ rpm/tools/rpmdigest.c     21 Apr 2017 02:58:44 -0000      2.18.4.7
  @@ -604,7 +604,7 @@
       }
   
       (void) rpmswAdd(&dc->readops, fdstat_op(dc->fd, FDSTAT_READ));
  -    (void) rpmswAdd(&dc->digestops, fdstat_op(dc->fd, FDSTAT_DIGEST));
  +    (void) rpmswAdd(&dc->digestops, fdstat_op(dc->fd, FDSTAT_FDIGEST));
       Fclose(dc->fd);
       dc->fd = NULL;
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmmtree.c
  ============================================================================
  $ cvs diff -u -r2.17.2.8 -r2.17.2.9 rpmmtree.c
  --- rpm/tools/rpmmtree.c      17 Jun 2016 08:07:28 -0000      2.17.2.8
  +++ rpm/tools/rpmmtree.c      21 Apr 2017 02:58:44 -0000      2.17.2.9
  @@ -2311,7 +2311,7 @@
   cleanup:
        if (fd != NULL) {
            (void) rpmswAdd(&dc_readops, fdstat_op(fd, FDSTAT_READ));
  -         (void) rpmswAdd(&dc_digestops, fdstat_op(fd, FDSTAT_DIGEST));
  +         (void) rpmswAdd(&dc_digestops, fdstat_op(fd, FDSTAT_FDIGEST));
            (void) Fclose(fd);
            fd = NULL;
        }
  @@ -2681,7 +2681,7 @@
   cleanup:    /* Accumulate statistics and clean up. */
            if (fd != NULL) {
                (void) rpmswAdd(&dc_readops, fdstat_op(fd, FDSTAT_READ));
  -             (void) rpmswAdd(&dc_digestops, fdstat_op(fd, FDSTAT_DIGEST));
  +             (void) rpmswAdd(&dc_digestops, fdstat_op(fd, FDSTAT_FDIGEST));
                (void) Fclose(fd);
                fd = NULL;
            }
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to