Re: [Xenomai-core] [patch 0/4] Support for select-like services.

2008-02-14 Thread Gilles Chanteperdrix
On Mon, Feb 11, 2008 at 8:28 AM, Johan Borkhuis
<[EMAIL PROTECTED]> wrote:
> Gilles,
>
>
>  Gilles Chanteperdrix wrote:
>  > Hi,
>  >
>  > here comes a third edition of the patchset adding support for select.
>  >
>  Could you tell me against which version this patch is tested? Would it
>  work with 2.4.1, or do I need the latest version from SVN?

Hi Johan,

I am getting back to this issue, how much would you need the select
service ? It is a posix only service for now, is it ok for you ?

Regards.

-- 
 Gilles Chanteperdrix

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [patch 0/4] Support for select-like services.

2008-02-11 Thread Gilles Chanteperdrix
On Mon, Feb 11, 2008 at 8:28 AM, Johan Borkhuis
<[EMAIL PROTECTED]> wrote:
> Gilles,
>
>
>  Gilles Chanteperdrix wrote:
>  > Hi,
>  >
>  > here comes a third edition of the patchset adding support for select.
>  >
>  Could you tell me against which version this patch is tested? Would it
>  work with 2.4.1, or do I need the latest version from SVN?

The patch is against trunk. We would need to rework it a bit to adapt
it to 2.4.1, but since it adds a new syscall, I do not know if it will
be backported, though adding a syscall does not really break the ABI.

-- 
   Gilles Chanteperdrix

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [patch 0/4] Support for select-like services.

2008-02-10 Thread Johan Borkhuis
Gilles,

Gilles Chanteperdrix wrote:
> Hi,
>
> here comes a third edition of the patchset adding support for select. 
>   
Could you tell me against which version this patch is tested? Would it 
work with 2.4.1, or do I need the latest version from SVN?

Kind regards,
Johan Borkhuis

-- 
Johan Borkhuis  Dutch Space BV
email:[EMAIL PROTECTED]  Newtonweg 1
phone:071-5245788   Leiden
fax:  071-5245499   The Netherlands


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [patch 0/4] Support for select-like services.

2008-02-10 Thread Jan Kiszka
Gilles Chanteperdrix wrote:
> Hi,
> 
> here comes a third edition of the patchset adding support for select. 
> 
> The core support now depends on a CONFIG_XENO_OPT_SELECT option, whereas the
> posix support depends on a CONFIG_XENO_OPT_POSIX_SELECT option.
> 
> The support for using rtdm_event_t and rtdm_sem_t objects is now built-in to
> these objects without creating new objects types (only if
> CONFIG_XENO_OPT_SELECT is enabled).
> 
> The rtdm_context_get modification, allowing to check that the caller of a 
> service
> belongs to the same process as the file descriptor it uses, is now made in
> __rtdm_context_get while rtdm_context_get passes a NULL first argument to this
> new service.
> 
> When implementing these modifications, a few questions arise:
> - RTDM support currently depends on the CONFIG_XENO_OPT_SELECT option, should 
> we
> add an RTDM specific option ?

IIRC, the policy is so far that the skin selects the nucleus features it
wants/needs, so we may better add the visible switch to RTDM as well.

> - in order to avoid numerous #ifdefs, and especially in drivers code, the new
> callback added to device operations for binding RTDM file descriptors to
> selector blocks is always there even if CONFIG_XENO_OPT_SELECT is disabled. Is
> it the right thing to do ?

That's ok, otherwise ifdef'ery would crawl into the drivers as well.
Given the conversion you posted for RTnet, we don't add noticeable bloat
this way.

Jan



signature.asc
Description: OpenPGP digital signature
___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [PATCH 0/4] Support for select-like services.

2008-01-25 Thread Gilles Chanteperdrix
Gilles Chanteperdrix wrote:
 > 
 > Hi,
 > 
 > the following patchset adds core support to Xenomai for select-like
 > services,

The attached patch is a quick and dirty patch of RTnet to allow using
rtnet sockets of all types with the new select service.

-- 


Gilles Chanteperdrix.
Index: stack/ipv4/af_inet.c
===
--- stack/ipv4/af_inet.c(révision 6193)
+++ stack/ipv4/af_inet.c(copie de travail)
@@ -259,8 +259,6 @@ static void rt_ip_ifdown(struct rtnet_de
 rt_ip_route_del_all(rtdev);
 }
 
-
-
 static struct rtdev_event_hook  rtdev_hook = {
 register_device:NULL,
 unregister_device:  NULL,
@@ -294,6 +292,7 @@ static struct rtdm_device ipv4_device = 
 ioctl_nrt:  rt_udp_ioctl,
 recvmsg_rt: rt_udp_recvmsg,
 sendmsg_rt: rt_udp_sendmsg,
+   select_bind:rt_socket_select_bind,
 #ifdef CONFIG_RTNET_RTDM_SELECT
 poll_rt:rt_udp_poll,
 /* there should be only the function poll() */
Index: stack/include/rtnet_socket.h
===
--- stack/include/rtnet_socket.h(révision 6193)
+++ stack/include/rtnet_socket.h(copie de travail)
@@ -51,7 +51,8 @@ struct rtsocket {
 unsigned intpriority;
 nanosecs_rel_t  timeout;/* receive timeout, 0 for infinite */
 
-rtdm_sem_t  pending_sem;
+rtdm_select_sem_t   pending_sem;
+struct xnselect write_select;
 #ifdef CONFIG_RTNET_RTDM_SELECT
 wait_queue_primitive_t  *wakeup_select; /* for selecting calls - this
SHOULD be the head of a wait
@@ -96,6 +97,10 @@ static inline struct rtdm_dev_context *r
 atomic_dec(&(rt_socket_context(sock)->close_lock_count))
 
 extern int rt_socket_init(struct rtdm_dev_context *context);
+extern int rt_socket_select_bind(struct rtdm_dev_context *context,
+struct xnselector *selector,
+unsigned type,
+unsigned index);
 extern int rt_socket_cleanup(struct rtdm_dev_context *context);
 extern int rt_socket_common_ioctl(struct rtdm_dev_context *context,
   rtdm_user_info_t *user_info,
Index: stack/packet/af_packet.c
===
--- stack/packet/af_packet.c(révision 6193)
+++ stack/packet/af_packet.c(copie de travail)
@@ -467,7 +467,8 @@ static struct rtdm_device   packet_proto
 ioctl_rt:   rt_packet_ioctl,
 ioctl_nrt:  rt_packet_ioctl,
 recvmsg_rt: rt_packet_recvmsg,
-sendmsg_rt: rt_packet_sendmsg
+sendmsg_rt: rt_packet_sendmsg,
+   select_bind:rt_socket_select_bind,  
 },
 
 device_class:   RTDM_CLASS_NETWORK,
Index: stack/socket.c
===
--- stack/socket.c  (révision 6193)
+++ stack/socket.c  (copie de travail)
@@ -68,6 +68,7 @@ int rt_socket_init(struct rtdm_dev_conte
 
 rtdm_lock_init(&sock->param_lock);
 rtdm_sem_init(&sock->pending_sem, 0);
+xnselect_init(&sock->write_select);
 
 if (test_bit(RTDM_CREATED_IN_NRT, &sockctx->context_flags))
 pool_size = rtskb_pool_init(&sock->skb_pool, socket_rtskbs);
@@ -87,7 +88,44 @@ int rt_socket_init(struct rtdm_dev_conte
 return 0;
 }
 
+int rt_socket_select_bind(struct rtdm_dev_context *context,
+ struct xnselector *selector,
+ unsigned type,
+ unsigned index)
+{
+struct rtsocket *sock = (struct rtsocket *)&context->dev_private;
+
+switch(type) {
+case XNSELECT_READ:
+   return rtdm_select_sem_bind(&sock->pending_sem, selector, type, index);
+
+case XNSELECT_WRITE: {
+   struct xnselect_binding *binding;
+   int err;
+   spl_t s;
+
+   binding = xnmalloc(sizeof(*binding));
+   if (!binding)
+   return -ENOMEM;
+
+   xnlock_get_irqsave(&nklock, s);
+   /* Writing to a socket is always possible, so the state is 1, forever. 
*/
+   err = xnselect_bind(&sock->write_select,
+   binding, selector, type, index, 1);
+   xnlock_put_irqrestore(&nklock, s);
+
+   if (err)
+   xnfree(binding);
+   return err;
+}
 
+case XNSELECT_EXCEPT:
+   return -EBADF;
+}
+
+return -EINVAL;
+}
+EXPORT_SYMBOL(rt_socket_select_bind);
 
 /***
  *  rt_socket_cleanup - releases resources allocated for the socket
@@ -100,6 +138,7 @@ int rt_socket_cleanup(struct rtdm_dev_co
 
 
 rtdm_sem_destroy(&sock->pending_sem);
+xnselect_destroy(&sock->write_select);
 
 rtdm_lock_get_irqsave(&sock->param_lock, context);
 
___
Xenomai-core mailing list
Xeno