[FIX] incorrect syscalls feature order
authorNikita Kalyazin <n.kalyazin@samsung.com>
Sat, 13 Jul 2013 11:19:35 +0000 (15:19 +0400)
committerNikita Kalyazin <n.kalyazin@samsung.com>
Sat, 13 Jul 2013 11:50:13 +0000 (15:50 +0400)
FIXME: actually there are 2 different entities:
 - internal feature number (when switching on/off a feature);
 - the value to be packed to the buffer.
It is better to split them.

ks_features/features_data.c
ks_features/ks_features.c
ks_features/ks_features.h

index 3b072fe..7f8f4c7 100644 (file)
@@ -11,6 +11,8 @@ enum syscall_id {
 };
 #undef X
 
+static enum syscall_id id_none[] = {};
+
 static enum syscall_id id_file[] = {
        id_sys_acct,
        id_sys_mount,
@@ -232,11 +234,12 @@ static enum syscall_id id_desc[] = {
 }
 
 static struct feature features[] = {
+       CREATE_FEATURE(id_none),
        CREATE_FEATURE(id_file),
        CREATE_FEATURE(id_ipc),
-       CREATE_FEATURE(id_net),
        CREATE_FEATURE(id_process),
        CREATE_FEATURE(id_signal),
+       CREATE_FEATURE(id_net),
        CREATE_FEATURE(id_desc)
 };
 
index 734377c..50ab3e9 100644 (file)
@@ -127,8 +127,7 @@ static int unregister_syscall(size_t id)
 
 static void set_spt(struct feature *f, size_t id)
 {
-       int num = f - features;
-       ksp[id].pst = num + 1;
+       ksp[id].pst = f - features;
 }
 
 static int install_features(struct feature *f)
index 0de2acd..dd536e8 100644 (file)
@@ -2,12 +2,12 @@
 #define _KS_FEATURES_H
 
 enum feature_id {
-       FID_FILE,
-       FID_IPC,
-       FID_NET,
-       FID_PROCESS,
-       FID_SIGNAL,
-       FID_DESC
+       FID_FILE = 1,
+       FID_IPC = 2,
+       FID_PROCESS = 3,
+       FID_SIGNAL = 4,
+       FID_NET = 5,
+       FID_DESC = 6
 };
 
 int set_feature(enum feature_id id);