Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
01b3bb8f
Commit
01b3bb8f
authored
Oct 19, 2020
by
Alessio Netti
Browse files
SysFS: added support for wildcard resolution
parent
5c236dc1
Changes
3
Hide whitespace changes
Inline
Side-by-side
dcdbpusher/sensors/sysfs/SysfsSensorGroup.cpp
View file @
01b3bb8f
...
...
@@ -56,6 +56,23 @@ SysfsSensorGroup &SysfsSensorGroup::operator=(const SysfsSensorGroup &other) {
return
*
this
;
}
void
SysfsSensorGroup
::
execOnInit
()
{
if
(
std
::
strpbrk
(
_path
.
c_str
(),
"?*[]"
))
{
LOG
(
debug
)
<<
"Detected pattern "
<<
_path
<<
"."
;
glob_t
paths
;
if
(
glob
(
_path
.
c_str
(),
0
,
NULL
,
&
paths
)
==
0
)
{
if
(
paths
.
gl_pathc
>
1
)
{
LOG
(
warning
)
<<
"Multiple matches found for pattern "
<<
_path
<<
". Only the first one will be picked."
;
}
_path
=
paths
.
gl_pathv
[
0
];
LOG
(
debug
)
<<
"Using path "
<<
_path
<<
" from pattern."
;
globfree
(
&
paths
);
}
else
{
LOG
(
warning
)
<<
"No matches found for pattern "
<<
_path
<<
"!"
;
}
}
}
bool
SysfsSensorGroup
::
execOnStart
()
{
if
(
_retain
&&
_file
==
NULL
)
{
_file
=
fopen
(
_path
.
c_str
(),
"r"
);
...
...
dcdbpusher/sensors/sysfs/SysfsSensorGroup.h
View file @
01b3bb8f
...
...
@@ -30,6 +30,7 @@
#include "../../includes/SensorGroupTemplate.h"
#include "SysfsSensorBase.h"
#include "glob.h"
/**
* @brief SensorGroupTemplate specialization for this plugin.
...
...
@@ -44,6 +45,7 @@ class SysfsSensorGroup : public SensorGroupTemplate<SysfsSensorBase> {
virtual
~
SysfsSensorGroup
();
SysfsSensorGroup
&
operator
=
(
const
SysfsSensorGroup
&
other
);
void
execOnInit
()
final
override
;
bool
execOnStart
()
final
override
;
void
execOnStop
()
final
override
;
...
...
tools/dcdbconfig/jobaction.cpp
View file @
01b3bb8f
...
...
@@ -143,10 +143,10 @@ void JobAction::doShow(std::string jobId, std::string domainId) {
std
::
cout
<<
std
::
endl
;
break
;
case
DCDB
::
JD_JOBKEYNOTFOUND
:
std
::
cout
<<
"Job key "
<<
jobId
<<
" with domain ID "
<<
domainId
<<
"not found."
<<
std
::
endl
;
std
::
cout
<<
"Job key "
<<
jobId
<<
" with domain ID "
<<
domainId
<<
"
not found."
<<
std
::
endl
;
break
;
case
DCDB
::
JD_JOBIDNOTFOUND
:
std
::
cout
<<
"Job ID "
<<
jobId
<<
" with domain ID "
<<
domainId
<<
"not found."
<<
std
::
endl
;
std
::
cout
<<
"Job ID "
<<
jobId
<<
" with domain ID "
<<
domainId
<<
"
not found."
<<
std
::
endl
;
break
;
default:
std
::
cout
<<
"Internal error."
<<
std
::
endl
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment