Module: xenomai-head
Branch: master
Commit: 20b99e4491cd9ad0650713e89e618dfe981ab9be
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=20b99e4491cd9ad0650713e89e618dfe981ab9be

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Sep  7 16:51:29 2009 +0200

rtipc/iddp: retrieve IDDP_GETSTALLCOUNT via the getsockopt() interface

---

 ksrc/drivers/ipc/iddp.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/ksrc/drivers/ipc/iddp.c b/ksrc/drivers/ipc/iddp.c
index e9b65d2..27cb481 100644
--- a/ksrc/drivers/ipc/iddp.c
+++ b/ksrc/drivers/ipc/iddp.c
@@ -579,6 +579,41 @@ static int __iddp_setsockopt(struct iddp_socket *sk,
        return ret;
 }
 
+static int __iddp_getsockopt(struct iddp_socket *sk,
+                            rtdm_user_info_t *user_info,
+                            void *arg)
+{
+       struct _rtdm_getsockopt_args sopt;
+       socklen_t len;
+       int ret = 0;
+
+       if (rtipc_get_arg(user_info, &sopt, arg, sizeof(sopt)))
+               return -EFAULT;
+
+       if (rtipc_get_arg(user_info, &len, sopt.optlen, sizeof(len)))
+               return -EFAULT;
+
+       if (sopt.level != SOL_RTIPC)
+               return -ENOPROTOOPT;
+
+       switch (sopt.optname) {
+
+       case IDDP_GETSTALLCOUNT:
+               if (len < sizeof(sk->stalls))
+                       return -EINVAL;
+               if (rtipc_put_arg(user_info, sopt.optval,
+                                 &sk->stalls, sizeof(sk->stalls)))
+                       return -EFAULT;
+               break;
+
+
+       default:
+               ret = -EINVAL;
+       }
+
+       return ret;
+}
+
 static int iddp_ioctl(struct rtipc_private *priv,
                      rtdm_user_info_t *user_info,
                      unsigned int request, void *arg)
@@ -617,6 +652,10 @@ static int iddp_ioctl(struct rtipc_private *priv,
                ret = __iddp_setsockopt(sk, user_info, arg);
                break;
 
+       case _RTIOC_GETSOCKOPT:
+               ret = __iddp_getsockopt(sk, user_info, arg);
+               break;
+
        case _RTIOC_LISTEN:
        case _RTIOC_ACCEPT:
                ret = -EOPNOTSUPP;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to