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/server.h | |
parent | ca4f5906f284e60a7a59ca7450e3e09c4f9356e5 (diff) | |
download | TCE-ee348973b0cb0f6481e4fd6e7494c63167c9759c.tar.gz TCE-ee348973b0cb0f6481e4fd6e7494c63167c9759c.zip |
More work on manager
Diffstat (limited to 'src/include/gc/server.h')
-rw-r--r-- | src/include/gc/server.h | 14 |
1 files changed, 12 insertions, 2 deletions
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 { |