bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [X15Mach-devel] Prototypes for xxx_server and xxx_server_routine fun


From: Thomas Schwinge
Subject: Re: [X15Mach-devel] Prototypes for xxx_server and xxx_server_routine functions
Date: Wed, 6 Jun 2007 15:49:16 +0200
User-agent: Mutt/1.5.11

Hello!

This is about MIG not providing prototype declarations for the
`xxx_server' and `xxx_server_routine' functions.

On Wed, Jun 06, 2007 at 01:43:35PM +0200, Richard Braun wrote:
> On Wed, Jun 06, 2007 at 11:52:01AM +0200, Thomas Schwinge wrote:
> > Instead, what about having MIG put such prototypes into the generated
> > `*.server.h' files and have that file be automatically `#include'd by the
> > `*.server.c' file?
> 
> If you know how to generate those prototypes, sure. But if it requires
> patching MIG, then I don't intend to do it for now, since there are
> currently other priorities for me (I must complete my thesis).

Here is such a patch.  I hope that it won't break other stuff.  I'll try
to test it a bit and then install it into cvs.


#v+
Index: header.c
===================================================================
RCS file: /cvsroot/hurd/mig/header.c,v
retrieving revision 1.3
diff -u -p -r1.3 header.c
--- header.c    2 Jun 2007 10:55:27 -0000       1.3
+++ header.c    6 Jun 2007 13:41:57 -0000
@@ -32,6 +32,8 @@
 static void
 WriteIncludes(FILE *file)
 {
+    fprintf(file, "#include <mach/boolean.h>\n");
+    fprintf(file, "#include <mach/mig_errors.h>\n");
     fprintf(file, "#include <mach/kern_return.h>\n");
     fprintf(file, "#include <mach/port.h>\n");
     fprintf(file, "#include <mach/message.h>\n");
@@ -169,6 +174,18 @@ WriteServerHeader(FILE *file, const stat
            fatal("WriteServerHeader(): bad statement_kind_t (%d)",
                  (int) stat->stKind);
        }
+    fprintf(file, "\n");
+
+     /* The server routine.  */
+    WriteMigExternal(file);
+    fprintf(file, "boolean_t %s\n", ServerDemux);
+    fprintf(file, "\t(mach_msg_header_t *InHeadP, mach_msg_header_t 
*OutHeadP);\n");
+
+    /* The <subsystem>_server_routine routine.  */
+    WriteMigExternal(file);
+    fprintf(file, "mig_routine_t %s_routine\n", ServerDemux);
+    fprintf(file, "\t(const mach_msg_header_t *InHeadP);\n");
+
     WriteEpilog(file, protect);
 }
 
Index: server.c
===================================================================
RCS file: /cvsroot/hurd/mig/server.c,v
retrieving revision 1.5
diff -u -p -r1.5 server.c
--- server.c    30 Nov 2006 00:01:21 -0000      1.5
+++ server.c    6 Jun 2007 13:41:57 -0000
@@ -39,6 +39,19 @@ WriteIncludes(FILE *file)
     fprintf(file, "#define _GNU_SOURCE 1\n");
     fprintf(file, "#endif\n\n");
 
+    if (ServerHeaderFileName != strNULL)
+    {
+       register char *cp;
+
+       /* Strip any leading path from ServerHeaderFileName. */
+       cp = strrchr(ServerHeaderFileName, '/');
+       if (cp == 0)
+           cp = ServerHeaderFileName;
+       else
+           cp++;       /* skip '/' */
+       fprintf(file, "#include \"%s\"\n", cp);
+    }
+
     fprintf(file, "#define EXPORT_BOOLEAN\n");
     fprintf(file, "#include <mach/boolean.h>\n");
     fprintf(file, "#include <mach/kern_return.h>\n");
@@ -288,12 +302,15 @@ WriteVarDecls(FILE *file, const routine_
        fprintf(file, "\tregister Request *In%dP;\n", i);
     fprintf(file, "\tregister Reply *OutP = (Reply *) OutHeadP;\n");
 
+#if 0
+    /* No longer needed.  This information is included from the header file.  
*/
     fprintf(file, "\tmig_external %s %s\n",
            ServerSideType(rt), rt->rtServerName);
     fprintf(file, "\t\t(");
     WriteList(file, rt->rtArgs, WriteServerArgDecl, akbServerArg, ", ", "");
     fprintf(file, ");\n");
     fprintf(file, "\n");
+#endif
 
     if (!rt->rtSimpleFixedReply)
        fprintf(file, "\tboolean_t msgh_simple;\n");
#v-


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]