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:   23-May-2017 21:26:48
  Branch: rpm-5_4                          Handle: 2017052319264800

  Modified files:           (Branch: rpm-5_4)
    rpm/rpmio               fanotify.c

  Log:
    - WIP.

  Summary:
    Revision    Changes     Path
    1.1.2.5     +49 -4      rpm/rpmio/fanotify.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/fanotify.c
  ============================================================================
  $ cvs diff -u -r1.1.2.4 -r1.1.2.5 fanotify.c
  --- rpm/rpmio/fanotify.c      23 May 2017 05:54:19 -0000      1.1.2.4
  +++ rpm/rpmio/fanotify.c      23 May 2017 19:26:48 -0000      1.1.2.5
  @@ -24,12 +24,17 @@
   #include <sys/signalfd.h>
   #include <sys/fanotify.h>
   
  +#include <rpmio.h>
  +#include <argv.h>
  +#include <poptIO.h>
  +
   #include "debug.h"
   
  +static int _debug;
  +
   /* Structure to keep track of monitored directories */
   typedef struct {
  -    /* Path of the directory */
  -    char *path;
  +    char *path;                      /* Path of the directory */
   } monitored_t;
   
   /* Enumerate list of FDs to poll */
  @@ -135,7 +140,7 @@
       close(fdno);
   }
   
  -static int initialize_fanotify(int argc, const char **argv)
  +static int initialize_fanotify(int argc, char *argv[])
   {
       int fdno;
       int rc;
  @@ -202,8 +207,45 @@
       return signal_fd;
   }
   
  -int main(int argc, const char **argv)
  +/*==============================================================*/
  +static const char *comm;
  +static int current_mount;
  +static const char *output;
  +static const char *filter;
  +static int timeout;
  +static const char **pids;
  +static int timestamp;
  +
  +static struct poptOption rpmfanOptionsTable[] = {
  + { "debug", 'd', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN,  &_debug, 1,
  +     NULL, NULL },
  +
  + { "current-mount", 'c', POPT_ARG_VAL,  &current_mount, 1,
  +     N_("Only record events on partition/mount of current directory."), NULL 
},
  + { "output", 'o', POPT_ARG_STRING,    &output, 1,
  +     N_("Write events to FILE instead of standard output."), N_("FILE") },
  + { "seconds", 's', POPT_ARG_INT,      &timeout, 1,
  +     N_("Stop after SECONDS."), N_("SECONDS") },
  + { "timestamp", 't', POPT_ARG_VAL,    &timestamp, 1,
  +     N_("Add timestamp to events. Give twice for seconds since the epoch."), 
NULL },
  + { "ignore-pid", 'p', POPT_ARG_ARGV,          &pids, 1,
  +     N_("Ignore events for process PID. Can be specified multiple times."), 
N_("PID") },
  + { "filter", 'f', POPT_ARG_STRING,    &filter, 1,
  +     N_("Show only the given event types; choose from C, R, O, or W, e. g. 
--filter=OC."), N_("TYPES") },
  + { "command", 'C', POPT_ARG_STRING,   &comm, 1,
  +     N_("Show only events for CMD."), N_("CMD") },
  +
  + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0,
  +     N_(" Common options for all rpmio executables:"), NULL },
  +
  +  POPT_AUTOALIAS
  +  POPT_AUTOHELP
  +  POPT_TABLEEND
  +};
  +
  +int main(int argc, char *argv[])
   {
  +    poptContext con = rpmioInit(argc, argv, rpmfanOptionsTable);
       int signal_fd = -1;
       int fanotify_fd = -1;
       struct pollfd fds[FD_POLL_MAX];
  @@ -287,5 +329,8 @@
        shutdown_fanotify(fanotify_fd);
       if (signal_fd >= 0)
        shutdown_signals(signal_fd);
  +
  +    con = rpmioFini(con);
  +
       return ec;
   }
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to