[Xenomai-git] Kim De Mey : copperplate/notifier: warn on failed pipe

2013-11-05 Thread git repository hosting
Module: xenomai-forge
Branch: master
Commit: 32100cf9f95c674addd1f667c9772b447a3a4d13
URL:
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=32100cf9f95c674addd1f667c9772b447a3a4d13

Author: Kim De Mey kim.de...@gmail.com
Date:   Mon Oct 21 16:09:00 2013 +0200

copperplate/notifier: warn on failed pipe

Give a warning if one of the pipe() system calls fails. To indicate
that there is an underlying problem. Also add an assert on the
notifier_init return value in threadobj_setup_corespec.

Signed-off-by: Kim De Mey kim.de...@gmail.com

---

 lib/copperplate/notifier.c  |5 -
 lib/copperplate/threadobj.c |3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/copperplate/notifier.c b/lib/copperplate/notifier.c
index 37955c1..0ba4737 100644
--- a/lib/copperplate/notifier.c
+++ b/lib/copperplate/notifier.c
@@ -143,10 +143,13 @@ int notifier_init(struct notifier *nf,
sigset_t oset;
int fd;
 
-   if (pipe(nf-psfd)  0)
+   if (pipe(nf-psfd)  0) {
+   warning(failed to create file descriptors);
return __bt(-errno);
+   }
 
if (pipe(nf-pwfd)  0) {
+   warning(failed to create file descriptors);
__STD(close(nf-psfd[0]));
__STD(close(nf-psfd[1]));
return __bt(-errno);
diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index a283b22..2cdfa03 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -449,7 +449,8 @@ static inline int threadobj_setup_corespec(struct threadobj 
*thobj)
int ret;
 
prctl(PR_SET_NAME, (unsigned long)thobj-name, 0, 0, 0);
-   notifier_init(thobj-core.notifier, notifier_callback, 1);
+   ret = notifier_init(thobj-core.notifier, notifier_callback, 1);
+   assert(ret == 0);
thobj-core.period = 0;
 
/*


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Kim De Mey : copperplate/notifier: warn on failed pipe

2013-10-23 Thread git repository hosting
Module: xenomai-forge
Branch: next
Commit: 32100cf9f95c674addd1f667c9772b447a3a4d13
URL:
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=32100cf9f95c674addd1f667c9772b447a3a4d13

Author: Kim De Mey kim.de...@gmail.com
Date:   Mon Oct 21 16:09:00 2013 +0200

copperplate/notifier: warn on failed pipe

Give a warning if one of the pipe() system calls fails. To indicate
that there is an underlying problem. Also add an assert on the
notifier_init return value in threadobj_setup_corespec.

Signed-off-by: Kim De Mey kim.de...@gmail.com

---

 lib/copperplate/notifier.c  |5 -
 lib/copperplate/threadobj.c |3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/copperplate/notifier.c b/lib/copperplate/notifier.c
index 37955c1..0ba4737 100644
--- a/lib/copperplate/notifier.c
+++ b/lib/copperplate/notifier.c
@@ -143,10 +143,13 @@ int notifier_init(struct notifier *nf,
sigset_t oset;
int fd;
 
-   if (pipe(nf-psfd)  0)
+   if (pipe(nf-psfd)  0) {
+   warning(failed to create file descriptors);
return __bt(-errno);
+   }
 
if (pipe(nf-pwfd)  0) {
+   warning(failed to create file descriptors);
__STD(close(nf-psfd[0]));
__STD(close(nf-psfd[1]));
return __bt(-errno);
diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index a283b22..2cdfa03 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -449,7 +449,8 @@ static inline int threadobj_setup_corespec(struct threadobj 
*thobj)
int ret;
 
prctl(PR_SET_NAME, (unsigned long)thobj-name, 0, 0, 0);
-   notifier_init(thobj-core.notifier, notifier_callback, 1);
+   ret = notifier_init(thobj-core.notifier, notifier_callback, 1);
+   assert(ret == 0);
thobj-core.period = 0;
 
/*


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git