aboutsummaryrefslogtreecommitdiff
path: root/header.c
diff options
context:
space:
mode:
authorLuca Dariz <luca@orpolo.org>2025-01-06 14:46:49 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-01-28 22:52:16 +0100
commitd4ed2ed7fa36a2637f6f3b352ee2875abaf27092 (patch)
tree25b83ffe225888fc235b2bc5c0e015629dbba188 /header.c
parent85c1d9860d563d8c43d95d41c51d0cbd68f93c9a (diff)
downloadmig-master.tar.gz
mig-master.tar.bz2
mig-master.zip
header: add definitions for RPC presence and IDsHEADmaster
This allows to check at compilation time for some rpc (as done for example in glibc for thread_set/get_name() and host_page_size()). Also the IDs can be useful for testing purposes, or when assembling messages manually. Message-ID: <20250106134649.391487-1-luca@orpolo.org>
Diffstat (limited to 'header.c')
-rw-r--r--header.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/header.c b/header.c
index 8190376..4781e86 100644
--- a/header.c
+++ b/header.c
@@ -82,13 +82,20 @@ WriteEpilog(FILE *file, const char *protect)
static void
WriteUserRoutine(FILE *file, const routine_t *rt)
{
+ char *defName = strupper(rt->rtUserName);
fprintf(file, "\n");
fprintf(file, "/* %s %s */\n", rtRoutineKindToStr(rt->rtKind), rt->rtName);
+ fprintf(file, "#define MIG_RPC_HAVE_%s\n", defName);
+ fprintf(file, "#define MIG_RPC_REQUEST_ID_%s %d\n",
+ defName, rt->rtNumber + SubsystemBase);
+ fprintf(file, "#define MIG_RPC_REPLY_ID_%s %d\n",
+ defName, rt->rtNumber + SubsystemBase + 100);
WriteMigExternal(file);
fprintf(file, "%s %s\n", ReturnTypeStr(rt), rt->rtUserName);
fprintf(file, "(\n");
WriteList(file, rt->rtArgs, WriteUserVarDecl, akbUserArg, ",\n", "\n");
fprintf(file, ");\n");
+ strfree(defName);
}
void
@@ -137,14 +144,21 @@ WriteRoutineList(FILE *file, const statement_t *stats)
static void
WriteServerRoutine(FILE *file, const routine_t *rt)
{
+ char *defName = strupper(rt->rtServerName);
fprintf(file, "\n");
fprintf(file, "/* %s %s */\n", rtRoutineKindToStr(rt->rtKind), rt->rtName);
+ fprintf(file, "#define MIG_RPC_HAVE_%s\n", defName);
+ fprintf(file, "#define MIG_RPC_REQUEST_ID_%s %d\n",
+ defName, rt->rtNumber + SubsystemBase);
+ fprintf(file, "#define MIG_RPC_REPLY_ID_%s %d\n",
+ defName, rt->rtNumber + SubsystemBase + 100);
WriteMigExternal(file);
fprintf(file, "%s %s\n", ReturnTypeStr(rt), rt->rtServerName);
fprintf(file, "(\n");
WriteList(file, rt->rtArgs, WriteServerVarDecl,
akbServerArg, ",\n", "\n");
fprintf(file, ");\n");
+ strfree(defName);
}
void