+
+/* creates an rfd. Either allocates a new one, in which case the priv */
+/* pointer is null, and will have to be filled in, or picks up one */
+/* from the freelist, in which case the priv is already allocated, */
+/* and presumably everything that hangs from it as well */
+
+RSFD rfd_create_base(RSET rs)
+{
+ RSFD rnew=rs->free_list;
+ if (rnew) {
+ rs->free_list=rnew->next;
+ assert(rnew->rset==rs);
+ /* logf(LOG_DEBUG,"rfd-create_base (fl): rfd=%p rs=%p fl=%p priv=%p",
+ rnew, rs, rs->free_list, rnew->priv); */
+ } else {
+ rnew=nmem_malloc(rs->nmem, sizeof(*rnew));
+ rnew->priv=NULL;
+ rnew->rset=rs;
+ /* logf(LOG_DEBUG,"rfd_create_base (new): rfd=%p rs=%p fl=%p priv=%p",
+ rnew, rs, rs->free_list, rnew->priv); */
+ }
+ rnew->next=NULL; /* not part of any (free?) list */
+ return rnew;
+}
+
+/* puts an rfd into the freelist of the rset. Only when the rset gets */
+/* deleted, will all the nmem disappear */
+void rfd_delete_base(RSFD rfd)