diff options
author | Alexis211 <alexis211@gmail.com> | 2010-04-07 11:37:21 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2010-04-07 11:37:21 +0200 |
commit | ee348973b0cb0f6481e4fd6e7494c63167c9759c (patch) | |
tree | a9f1cd82703aaeeefbf4cf449203881cfcafc0a5 /src/include/gc | |
parent | ca4f5906f284e60a7a59ca7450e3e09c4f9356e5 (diff) | |
download | TCE-ee348973b0cb0f6481e4fd6e7494c63167c9759c.tar.gz TCE-ee348973b0cb0f6481e4fd6e7494c63167c9759c.zip |
More work on manager
Diffstat (limited to 'src/include/gc')
-rw-r--r-- | src/include/gc/obj.h | 6 | ||||
-rw-r--r-- | src/include/gc/server.h | 14 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/include/gc/obj.h b/src/include/gc/obj.h index 10651f5..fcb60cd 100644 --- a/src/include/gc/obj.h +++ b/src/include/gc/obj.h @@ -5,10 +5,6 @@ #define ME_UNHANDLED -32767 #define ME_INTERRUPTED -32766 -struct object_cli { - int id; -}; - -typedef struct object_cli Object; +typedef int Object; #endif diff --git a/src/include/gc/server.h b/src/include/gc/server.h index 36597c7..3612a1d 100644 --- a/src/include/gc/server.h +++ b/src/include/gc/server.h @@ -16,11 +16,13 @@ struct method_data { union { int i; void* p; - } val; + }; int type; int keepShm; //for messages : keep shared memory segment after return or unmap ? (default : 0 = unmap) + size_t shmsize; } parameters[3]; uint32_t func; + int pid; int blocking; //1 : blocking request, 0 : message struct object_srv *obj; }; @@ -37,11 +39,19 @@ struct method_ret { //helper function for creating return values struct method_ret mr_long(int val); struct method_ret mr_llong(int64_t val); -struct method_ret mr_obj(Object* obj); +struct method_ret mr_obj(Object obj); struct method_ret mr_srv(struct object_srv* obj); struct method_ret mr_void(); struct method_ret mr_err(int error); +// for checking if a string passed in shared memory is valid +#define CHKSSTR(md, n) { size_t _i, _ok = 0; if (md->parameters[n].p == 0) return mr_err(-1); \ + for (_i = 0; _i < md->parameters[n].shmsize; _i++) { \ + if (*((char*)md->parameters[n].p + _i) == 0) { \ + _ok = 1; break; \ + } } \ + if (!_ok && md->parameters[n].shmsize != 0) return mr_err(-1); } + typedef struct method_ret (*method_handler)(struct method_data*); struct method_srv { |