[inferno-npe] push by extrudedaluminiu - Add destructor support to KSD keys. on 2010-02-12 04:07 GMT

0 views
Skip to first unread message

infer...@googlecode.com

unread,
Feb 11, 2010, 11:08:42 PM2/11/10
to inferno-n...@googlegroups.com
Revision: e7ee15274a
Author: me@challenger
Date: Tue Feb 9 23:24:33 2010
Log: Add destructor support to KSD keys.
http://code.google.com/p/inferno-npe/source/detail?r=e7ee15274a

Modified:
/emu/Linux/emu-g
/emu/Linux/mkfile
/emu/Linux/os.c
/emu/port/fns.h
/emu/port/ksd.c

=======================================
--- /emu/Linux/emu-g Fri Jan 29 02:36:15 2010
+++ /emu/Linux/emu-g Tue Feb 9 23:24:33 2010
@@ -23,6 +23,7 @@
mem

lib
+ avl
interp
math
keyring
@@ -56,8 +57,10 @@
exception
exportfs
inferno
+ ksd
latin1
main
+ objcache
parse
pgrp
print
=======================================
--- /emu/Linux/mkfile Thu Jan 14 14:19:51 2010
+++ /emu/Linux/mkfile Tue Feb 9 23:24:33 2010
@@ -4,8 +4,8 @@

#Configurable parameters

-CONF=emu #default configuration
-CONFLIST=emu
+CONF=emu-g #default configuration
+CONFLIST=emu emu-g
CLEANCONFLIST=

INSTALLDIR=$ROOT/$SYSTARG/$OBJTYPE/bin #path of directory where kernel is
installed
=======================================
--- /emu/Linux/os.c Tue Feb 9 09:34:34 2010
+++ /emu/Linux/os.c Tue Feb 9 23:24:33 2010
@@ -68,6 +68,9 @@
closesigs(e->sigs);
}
kstack = up->kstack;
+
+ ksd_rundtors();
+
free(up->ksd);
free(up->prog);
free(up);
=======================================
--- /emu/port/fns.h Tue Feb 9 09:34:34 2010
+++ /emu/port/fns.h Tue Feb 9 23:24:33 2010
@@ -254,7 +254,7 @@
void cnameclose(Cname*);

/* ksd.c */
-int ksd_key_create(void);
+int ksd_key_create(void (*)(void *));
void *ksd_getspecific(int key);
void *ksd_setspecific(int key, void *val);

=======================================
--- /emu/port/ksd.c Tue Feb 9 09:34:34 2010
+++ /emu/port/ksd.c Tue Feb 9 23:24:33 2010
@@ -9,9 +9,10 @@
#include "error.h"

static Ref high_ksd;
+static void (*ksd_dtor[NKEYS])(void*);

int
-ksd_key_create(void)
+ksd_key_create(void (*destructor)(void *))
{
int i;
i = incref(&high_ksd) - 1;
@@ -20,6 +21,8 @@
decref(&high_ksd);
return -1;
}
+
+ ksd_dtor[i] = destructor;

return i;
}
@@ -43,3 +46,12 @@
return tmp;
}

+void
+ksd_rundtors(void)
+{
+ int i;
+
+ for (i = 0; i < high_ksd.ref; i++)
+ if (ksd_dtor[i] != NULL)
+ ksd_dtor[i](up->ksd[i]);
+}

Reply all
Reply to author
Forward
0 new messages