[Spice-devel] [PATCH spice-protocol] stats: Add SPICE_STAT_SHM_PATTERN definition

Christophe Fergeau cfergeau at redhat.com
Fri Sep 15 10:25:34 UTC 2017


On Fri, Sep 15, 2017 at 06:10:03AM -0400, Frediano Ziglio wrote:
> > 
> > On Fri, Sep 15, 2017 at 10:04:45AM +0100, Frediano Ziglio wrote:
> > > This was proposed by Christophe De Dinechin for coherence with
> > > a patch in reds_stat tool to find statistic files.
> > > Allows to search such files using a shell pattern (allows to
> > > be used by functions like glob or fnmatch).
> > 
> > Is this missing the corresponding tools/reds_stat.c change?
> > 
> > Christophe
> > 
> 
> Is another repository.
> As spice-protocol is also not bound directly this will require:
> - wait for a new spice-procotol version;
> - update spice-server configure.ac requiring the new version;
> - update reds_stat.c.
> 
> I think in the meantime a
> 
> #ifndef SPICE_STAT_SHM_PATTERN
> #define SPICE_STAT_SHM_PATTERN "/spice.*"
> #endif

I don't think it's worth adding to spice-protocol..
I don't see a lot of code needing to use this pattern, and if they do,
they can always hardcode it. I'd just add the constant to spice-server
if it's not there yet.

Christophe

> 
> can be used in reds_stat.c
> 
> On the other hand this code
> 
>         const char *p = strchr(globbuf.gl_pathv[0], '.');
>         if (p) {
>             pid = atoi(p+1);
>         }
> 
> is assuming the format of SPICE_STAT_SHM_PATTERN is /XXXX.<pid> with
> XXXX not containing a dot.
> 
> Frediano
> 
> > > 
> > > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > > ---
> > >  spice/stats.h | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/spice/stats.h b/spice/stats.h
> > > index 46bbfed..ebd1995 100644
> > > --- a/spice/stats.h
> > > +++ b/spice/stats.h
> > > @@ -35,6 +35,7 @@
> > >  #include <spice/types.h>
> > >  
> > >  #define SPICE_STAT_SHM_NAME "/spice.%u"
> > > +#define SPICE_STAT_SHM_PATTERN "/spice.*"
> > >  #define SPICE_STAT_NODE_NAME_MAX 20
> > >  #define SPICE_STAT_MAGIC SPICE_MAGIC_CONST("STAT")
> > >  #define SPICE_STAT_VERSION 1
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list