aboutsummaryrefslogtreecommitdiff
path: root/src/modules/uORB/uORB.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2015-04-27 22:34:08 +0200
committerLorenz Meier <lm@inf.ethz.ch>2015-04-27 22:34:08 +0200
commit3dd45b9d3467ee62ac0d604a5607baaa10089ac3 (patch)
tree7bf56e57c71bcfedc47a7af9be4bab290beb21da /src/modules/uORB/uORB.cpp
parent7b06d781d8ade137a1837a3ecf002579bddfbb14 (diff)
parentbd1c3363df44170523c68fd87ee19f2582a5e8fc (diff)
downloadpx4-firmware-beta.tar.gz
px4-firmware-beta.tar.bz2
px4-firmware-beta.zip
Merge branch 'master' into betabeta
Diffstat (limited to 'src/modules/uORB/uORB.cpp')
-rw-r--r--src/modules/uORB/uORB.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/modules/uORB/uORB.cpp b/src/modules/uORB/uORB.cpp
index b4f81d429..d531c6b0b 100644
--- a/src/modules/uORB/uORB.cpp
+++ b/src/modules/uORB/uORB.cpp
@@ -41,6 +41,7 @@
#include <drivers/device/device.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
@@ -1196,6 +1197,25 @@ node_open(Flavor f, const struct orb_metadata *meta, const void *data, bool adve
} // namespace
+int
+orb_exists(const struct orb_metadata *meta, int instance)
+{
+ /*
+ * Generate the path to the node and try to open it.
+ */
+ char path[orb_maxpath];
+ int inst = instance;
+ int ret = node_mkpath(path, PUBSUB, meta, &inst);
+
+ if (ret != OK) {
+ errno = -ret;
+ return ERROR;
+ }
+
+ struct stat buffer;
+ return stat(path, &buffer);
+}
+
orb_advert_t
orb_advertise(const struct orb_metadata *meta, const void *data)
{