commit-hurd
[Top][All Lists]
Advanced

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

[mig] 01/02: Cherry-pick upstream changes


From: Samuel Thibault
Subject: [mig] 01/02: Cherry-pick upstream changes
Date: Sun, 09 Nov 2014 15:15:58 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch master
in repository mig.

commit b418a8de17e87abe395fd7616883cdd765dbd670
Author: Samuel Thibault <address@hidden>
Date:   Sun Nov 9 15:13:11 2014 +0000

    Cherry-pick upstream changes
    
      * patches/git-c-strings.patch: Upstream patch to fix variable-sized c
        strings.
      * patches/git-protected-payload.patch: Upstream patch to add protected 
payload
        support.
---
 debian/changelog                                   |   9 +
 debian/patches/git-c-strings.patch                 |  48 +++++
 ...te-inlines.patch => git-generate-inlines.patch} |   0
 debian/patches/git-protected-payload.patch         | 231 +++++++++++++++++++++
 debian/patches/series                              |   4 +-
 5 files changed, 291 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 9468b6c..47c14d4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+mig (1.4-3) unstable; urgency=medium
+
+  * patches/git-c-strings.patch: Upstream patch to fix variable-sized c
+    strings.
+  * patches/git-protected-payload.patch: Upstream patch to add protected 
payload
+    support.
+
+ -- Samuel Thibault <address@hidden>  Sun, 09 Nov 2014 14:51:54 +0000
+
 mig (1.4-2) unstable; urgency=medium
 
   * patches/generate-inlines.patch: Upstream patch to inline demuxers.
diff --git a/debian/patches/git-c-strings.patch 
b/debian/patches/git-c-strings.patch
new file mode 100644
index 0000000..d9eab1e
--- /dev/null
+++ b/debian/patches/git-c-strings.patch
@@ -0,0 +1,48 @@
+commit bb06f65290c2526d214302ba43bb6bc363cd4868
+Author: Justus Winter <address@hidden>
+Date:   Fri Feb 21 21:44:15 2014 +0100
+
+    Fix variable-sized c strings
+    
+    Previously, the terminating zero of variable-sized c strings was only
+    included when copying the message if the length of the string was not
+    a multiple of four.  mig_strncpy returns the length of the string
+    excluding the terminating zero.  Fix this by properly accounting for
+    the byte for the terminating zero in the array length.
+    
+    * server.c (WritePackArgValue): Account for the terminating zero in
+    the array length.
+    * user.c (WritePackArgValue): Likewise.
+
+diff --git a/server.c b/server.c
+index 129cec3..a3368f6 100644
+--- a/server.c
++++ b/server.c
+@@ -912,6 +912,11 @@ WritePackArgValue(FILE *file, const argument_t *arg)
+               arg->argMsgField,
+               arg->argVarName,
+               it->itNumber);
++          fprintf(file,
++              "\tif (OutP->%s < %d) OutP->%s += 1;\n",
++              arg->argCount->argMsgField,
++              it->itNumber,
++              arg->argCount->argMsgField);
+       }
+       else {
+           argument_t *count = arg->argCount;
+diff --git a/user.c b/user.c
+index 37f53d2..f4a6cd5 100644
+--- a/user.c
++++ b/user.c
+@@ -411,6 +411,11 @@ WritePackArgValue(FILE *file, const argument_t *arg)
+               arg->argMsgField,
+               arg->argVarName,
+               it->itNumber);
++          fprintf(file,
++              "\tif (InP->%s < %d) InP->%s += 1;\n",
++              arg->argCount->argMsgField,
++              it->itNumber,
++              arg->argCount->argMsgField);
+       }
+       else {
+ 
diff --git a/debian/patches/generate-inlines.patch 
b/debian/patches/git-generate-inlines.patch
similarity index 100%
rename from debian/patches/generate-inlines.patch
rename to debian/patches/git-generate-inlines.patch
diff --git a/debian/patches/git-protected-payload.patch 
b/debian/patches/git-protected-payload.patch
new file mode 100644
index 0000000..1d20ca0
--- /dev/null
+++ b/debian/patches/git-protected-payload.patch
@@ -0,0 +1,231 @@
+commit 003b3a589a0db5eb1db9376d707f3ca68220dba0
+Author: Justus Winter <address@hidden>
+Date:   Mon Nov 25 13:46:41 2013 +0100
+
+    Add support for protected payloads
+    
+    Add support for protected payloads. The new `intranpayload' option can
+    be used to specify a translation function translating payloads to
+    values of the translated type.  This function will be used instead of
+    the `intran' function to to look up the receiving object of a message
+    in a server.
+    
+    This makes it easy to use the protected payloads introduced in GNU
+    Mach 1.5.
+    
+    An inTransPayload function translates payloads to objects, like an
+    inTrans function translates from port names to objects.  Generate code
+    in the server routine to optimize lookups to the receiver of the
+    message.
+    
+    Additionally, if no intran function is provided, but an intranpayload
+    function is, it is expected to translate from payloads to port names.
+    This is used to preserve the semantics in case the server routine
+    expects a port name.
+    
+    * lexxer.l: Emit syInTranPayload.
+    * parser.h: Define syInTranPayload.
+    * parser.y (TransTypeSpec): Handle syInTranPayload.
+    * type.h (struct ipc_type): Add itInTransPayload.
+    * server.c (WriteExtractArgValue): If a payload-aware intrans function
+    has been specified, use it to get a reference to the receiving object.
+    * routine.c (rtAugmentArgKind): Force the use of a local variable if a
+    payload-aware translate-in function is defined.
+
+diff --git a/lexxer.l b/lexxer.l
+index 5f2f61e..7ff5677 100644
+--- a/lexxer.l
++++ b/lexxer.l
+@@ -138,6 +138,7 @@ static void doSharp(const char *body); /* process body of 
# directives */
+ <Normal>[Ss][Kk][Ii][Pp]                      RETURN(sySkip);
+ <Normal>[Ss][Tt][Rr][Uu][Cc][Tt]              RETURN(syStruct);
+ <Normal>[Ii][Nn][Tt][Rr][Aa][Nn]              RETURN(syInTran);
++<Normal>[Ii][Nn][Tt][Rr][Aa][Nn][Pp][Aa][Yy][Ll][Oo][Aa][Dd] 
RETURN(syInTranPayload);
+ <Normal>[Oo][Uu][Tt][Tt][Rr][Aa][Nn]          RETURN(syOutTran);
+ <Normal>[Dd][Ee][Ss][Tt][Rr][Uu][Cc][Tt][Oo][Rr]      RETURN(syDestructor);
+ <Normal>[Cc][Tt][Yy][Pp][Ee]                          RETURN(syCType);
+diff --git a/parser.h b/parser.h
+index 651b66e..96e9b5d 100644
+--- a/parser.h
++++ b/parser.h
+@@ -82,6 +82,7 @@ typedef union
+ #define       syQString       319
+ #define       syFileName      320
+ #define       syIPCFlag       321
++#define       syInTranPayload 322
+ 
+ 
+ extern YYSTYPE yylval;
+diff --git a/parser.y b/parser.y
+index a916cb3..e88fd22 100644
+--- a/parser.y
++++ b/parser.y
+@@ -98,6 +98,8 @@
+ %token        <string>        syFileName
+ %token        <flag>          syIPCFlag
+ 
++%token        syInTranPayload
++
+ %left syPlus syMinus
+ %left syStar syDiv
+ 
+@@ -365,6 +367,21 @@ TransTypeSpec             :       TypeSpec
+            $$->itServerType, $7);
+     $$->itServerType = $7;
+ }
++                      |       TransTypeSpec syInTranPayload syColon
++                              syIdentifier syIdentifier
++{
++    $$ = $1;
++
++    if (($$->itTransType != strNULL) && !streql($$->itTransType, $4))
++      warn("conflicting translation types (%s, %s)",
++           $$->itTransType, $4);
++    $$->itTransType = $4;
++
++    if (($$->itInTransPayload != strNULL) && !streql($$->itInTransPayload, 
$5))
++      warn("conflicting in-translation functions (%s, %s)",
++           $$->itInTransPayload, $5);
++    $$->itInTransPayload = $5;
++}
+                       |       TransTypeSpec syOutTran syColon syIdentifier
+                               syIdentifier syLParen syIdentifier syRParen
+ {
+diff --git a/routine.c b/routine.c
+index 94e2b4c..ddf5770 100644
+--- a/routine.c
++++ b/routine.c
+@@ -540,6 +540,7 @@ rtAugmentArgKind(argument_t *arg)
+      *  6) This is a dealloc arg, being returned.  The name can't be
+      *           stored directly into the msg_type, because the msg-type
+      *           field is a bit-field.
++     *  7) There is a payload-aware translate-in function defined.
+      */
+ 
+     if (((it->itOutTrans != strNULL) &&
+@@ -555,7 +556,8 @@ rtAugmentArgKind(argument_t *arg)
+       ((akIdent(arg->argKind) == akePoly) &&
+        akCheck(arg->argKind, akbReturnSnd)) ||
+       ((akIdent(arg->argKind) == akeDealloc) &&
+-       akCheck(arg->argKind, akbReturnSnd)))
++       akCheck(arg->argKind, akbReturnSnd)) ||
++      (it->itInTransPayload != strNULL))
+     {
+       arg->argKind = akRemFeature(arg->argKind, akbReplyCopy);
+       arg->argKind = akAddFeature(arg->argKind, akbVarNeeded);
+diff --git a/server.c b/server.c
+index a3368f6..ae5977f 100644
+--- a/server.c
++++ b/server.c
+@@ -587,14 +587,45 @@ static void
+ WriteExtractArgValue(FILE *file, const argument_t *arg)
+ {
+     const ipc_type_t *it = arg->argType;
++    boolean_t have_payload;
+ 
+     if (arg->argMultiplier > 1)
+       WriteCopyType(file, it, "%s", "/* %s */ %s / %d",
+                     arg->argVarName, InArgMsgField(arg), arg->argMultiplier);
+-    else if (it->itInTrans != strNULL)
+-      WriteCopyType(file, it, "%s", "/* %s */ %s(%s)",
+-                    arg->argVarName, it->itInTrans, InArgMsgField(arg));
+-    else
++    else if ((have_payload = (it->itInTransPayload != strNULL &&
++             strcmp(arg->argMsgField, "Head.msgh_request_port") == 0)) ||
++           it->itInTrans != strNULL) {
++
++      if (have_payload) {
++          argument_t argPayload = *arg;
++          argPayload.argMsgField = "Head.msgh_bits";
++          fprintf(file,
++                  "\tif (MACH_MSGH_BITS_LOCAL (%s) == "
++                  "MACH_MSG_TYPE_PROTECTED_PAYLOAD)\n"
++                  "\t", InArgMsgField(&argPayload));
++
++          argPayload.argMsgField = "Head.msgh_protected_payload";
++          WriteCopyType(file, it, "%s", "/* %s */ %s(%s)",
++                        arg->argVarName, it->itInTransPayload,
++                        InArgMsgField(&argPayload));
++
++          fprintf(file,
++                  "\telse\n"
++                  "\t");
++
++          if (it->itInTrans == strNULL)
++              fprintf(file, "\t%s = %s;",
++                      arg->argVarName, InArgMsgField(arg));
++          else
++              WriteCopyType(file, it, "%s", "/* %s */ %s(%s)",
++                            arg->argVarName, it->itInTrans,
++                            InArgMsgField(arg));
++      } else {
++          WriteCopyType(file, it, "%s", "/* %s */ %s(%s)",
++                        arg->argVarName, it->itInTrans,
++                        InArgMsgField(arg));
++      }
++    } else
+       WriteCopyType(file, it, "%s", "/* %s */ %s",
+                     arg->argVarName, InArgMsgField(arg));
+     fprintf(file, "\n");
+diff --git a/type.c b/type.c
+index 3078dab..7565f34 100644
+--- a/type.c
++++ b/type.c
+@@ -118,6 +118,7 @@ itAlloc(void)
+       strNULL,                /* identifier_t itServerType */
+       strNULL,                /* identifier_t itTransType */
+       strNULL,                /* identifier_t itInTrans */
++      strNULL,                /* identifier_t itInTransPayload */
+       strNULL,                /* identifier_t itOutTrans */
+       strNULL,                /* identifier_t itDestructor */
+     };
+@@ -376,7 +377,9 @@ itCheckDecl(identifier_t name, ipc_type_t *it)
+        limitations in Mig */
+ 
+     if (it->itVarArray) {
+-      if ((it->itInTrans != strNULL) || (it->itOutTrans != strNULL))
++      if ((it->itInTrans != strNULL) ||
++          (it->itInTransPayload != strNULL) ||
++          (it->itOutTrans != strNULL))
+           error("%s: can't translate variable-sized arrays", name);
+ 
+       if (it->itDestructor != strNULL)
+@@ -419,6 +422,10 @@ itPrintTrans(const ipc_type_t *it)
+        printf("\tInTran:\t\t%s %s(%s)\n",
+             it->itTransType, it->itInTrans, it->itServerType);
+ 
++    if (it->itInTransPayload != strNULL)
++       printf("\tInTranPayload:\t\t%s %s\n",
++            it->itTransType, it->itInTransPayload);
++
+     if (it->itOutTrans != strNULL)
+        printf("\tOutTran:\t%s %s(%s)\n",
+             it->itServerType, it->itOutTrans, it->itTransType);
+@@ -556,6 +563,7 @@ itResetType(ipc_type_t *old)
+     /* reset all special translation/destruction/type info */
+ 
+     old->itInTrans = strNULL;
++    old->itInTransPayload = strNULL;
+     old->itOutTrans = strNULL;
+     old->itDestructor = strNULL;
+     old->itUserType = strNULL;
+diff --git a/type.h b/type.h
+index f199059..50de063 100644
+--- a/type.h
++++ b/type.h
+@@ -107,6 +107,7 @@ typedef enum dealloc {
+  *            cusertype: itUserType
+  *            cservertype: itServerType
+  *            intran: itTransType itInTrans(itServerType)
++ *            intranpayload: itTransType itInTransPayload
+  *            outtran: itServerType itOutTrans(itTransType)
+  *            destructor: itDestructor(itTransType);
+  *
+@@ -165,6 +166,7 @@ typedef struct ipc_type
+     identifier_t itTransType;
+ 
+     identifier_t itInTrans;   /* may be NULL */
++    identifier_t itInTransPayload;    /* may be NULL */
+     identifier_t itOutTrans;  /* may be NULL */
+     identifier_t itDestructor;        /* may be NULL */
+ } ipc_type_t;
diff --git a/debian/patches/series b/debian/patches/series
index 610714f..74ce9b1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
-generate-inlines.patch
+git-generate-inlines.patch
+git-c-strings.patch
+git-protected-payload.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/mig.git



reply via email to

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