Re: Dangerous use of alloca

2016-03-18 Thread Roland McGrath
I don't know where the notion expressed in the Linux man page came from.
I'm pretty sure it's never been true of GNU compilers.  I don't think there
is any actual problem of the sort you have in mind with the existing code.
The generally issue of unbounded stack allocation is of course separate and
may very well be a reason to change.  But a trivial change to use a
temporary is not actually worthwhile because no real compiler that anybody
uses has this imagined problem.



[PATCH] Use uint32_t instead of unsigned32_t.

2016-03-18 Thread Flavio Cruz
* utils.c: Generate code using uint32_t.
---
 utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils.c b/utils.c
index 4c2a87b..ccde966 100644
--- a/utils.c
+++ b/utils.c
@@ -77,7 +77,7 @@ WriteBogusDefines(FILE *file)
 
 fprintf(file, "#define BAD_TYPECHECK(type, check) mig_unlikely (({\\\n");
 fprintf(file,
-   "  union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\\\n");
+   "  union { mach_msg_type_t t; uint32_t w; } _t, _c;\\\n");
 fprintf(file,
"  _t.t = *(type); _c.t = *(check);_t.w != _c.w; }))\n");
 }
-- 
2.6.4




Re: Testing requested for the next version of GNU Mach

2016-03-18 Thread Samuel Thibault
Richard Braun, on Tue 15 Mar 2016 00:40:40 +0100, wrote:
> On Tue, Mar 15, 2016 at 12:32:43AM +0100, Samuel Thibault wrote:
> > Richard Braun, on Mon 14 Mar 2016 23:37:33 +0100, wrote:
> > > On Mon, Mar 14, 2016 at 06:27:24PM -0400, David Michael wrote:
> > > > After poking around a bit more, it seems that the space is eaten by
> > > > debug info.  Appending -g0 to CFLAGS allowed gnumach to boot
> > > > successfully and resulted in this:
> > > > 
> > > > vm_page: DMA: pages: 4080 (15M), free: 2053 (8M)
> > > > 
> > > > The difference may be because GRUB apparently passes the multiboot ELF
> > > > info, while QEMU does not.  I'll just make sure to disable debug flags
> > > > when building gnumach for the time being.
> > > 
> > > Yes that makes sense.
> > 
> > Uh.  Should we perhaps move the kernel out of the 16MiB area?  I don't
> > think we have any such requirement here, AIUI we are just putting it
> > where it poses the least fragmentation issues, but the scarse DMA
> > resource is even more important.
> 
> That's what Linux does. It should be configurable though.

I ended up needing it, so I did it.

Samuel



[PATCH] Remove functions, procedures and simple procedures.

2016-03-18 Thread Flavio Cruz
This has been tested by cross-compiling a base Hurd system to make sure
these kinds of routines are no longer used.

* lexxer.l: Remove tokens.
* parser.y: Remove token types and production rules.
* routine.c: Remove rtMakeProcedure, rtMakeSimpleProcedure,
rtMakeFunction.
* routine.h: Remove enum values rkSimpleProcedure, rkProcedure,
rkFunction. Remove dead fields from struct routine.
* user.c: Simplify and remove dead code.
---
 lexxer.l  |  3 ---
 parser.y  | 19 --
 routine.c | 85 +--
 routine.h | 22 +++--
 user.c| 32 ++--
 5 files changed, 18 insertions(+), 143 deletions(-)

diff --git a/lexxer.l b/lexxer.l
index 06b04e2..bd7a718 100644
--- a/lexxer.l
+++ b/lexxer.l
@@ -108,9 +108,6 @@ static void doSharp(const char *body); /* process body of # 
directives */
 %%
 
 (?i:routine)   RETURN(syRoutine);
-(?i:function)  RETURN(syFunction);
-(?i:procedure) RETURN(syProcedure);
-(?i:simpleprocedure)   RETURN(sySimpleProcedure);
 (?i:simpleroutine) RETURN(sySimpleRoutine);
 (?i:subsystem) RETURN(sySubsystem);
 (?i:msgoption) RETURN(syMsgOption);
diff --git a/parser.y b/parser.y
index e88fd22..b05bcc9 100644
--- a/parser.y
+++ b/parser.y
@@ -27,9 +27,6 @@
 %token sySkip
 %token syRoutine
 %token sySimpleRoutine
-%token sySimpleProcedure
-%token syProcedure
-%token syFunction
 
 %token sySubsystem
 %token syKernelUser
@@ -111,7 +108,6 @@
 %type   BasicTypeSpec PrevTypeSpec ArgumentType
 %type   PrimIPCType IPCType
 %type   RoutineDecl Routine SimpleRoutine
-%type   Procedure SimpleProcedure Function
 %type   Direction
 %type   Argument Arguments ArgumentList
 %type   IPCFlags
@@ -582,9 +578,6 @@ IntExp  :   IntExp  syPlus  IntExp
  
 RoutineDecl:   Routine { $$ = $1; }
|   SimpleRoutine   { $$ = $1; }
-   |   Procedure   { $$ = $1; }
-   |   SimpleProcedure { $$ = $1; }
-   |   Function{ $$ = $1; }
;
 
 Routine:   syRoutine syIdentifier Arguments
@@ -595,18 +588,6 @@ SimpleRoutine  :   sySimpleRoutine 
syIdentifier Arguments
{ $$ = rtMakeSimpleRoutine($2, $3); }
;
 
-Procedure  :   syProcedure syIdentifier Arguments
-   { $$ = rtMakeProcedure($2, $3); }
-   ;
-
-SimpleProcedure:   sySimpleProcedure syIdentifier Arguments
-   { $$ = rtMakeSimpleProcedure($2, $3); }
-   ;
-
-Function   :   syFunction syIdentifier Arguments ArgumentType
-   { $$ = rtMakeFunction($2, $3, $4); }
-   ;
-
 Arguments  :   syLParen syRParen
{ $$ = argNULL; }
|   syLParen ArgumentList syRParen
diff --git a/routine.c b/routine.c
index ddf5770..d9154ef 100644
--- a/routine.c
+++ b/routine.c
@@ -59,7 +59,6 @@ rtAlloc(void)
fatal("rtAlloc(): %s", unix_error_string(errno));
 new->rtNumber = rtNumber++;
 new->rtName = strNULL;
-new->rtErrorName = strNULL;
 new->rtUserName = strNULL;
 new->rtServerName = strNULL;
 
@@ -136,54 +135,6 @@ rtMakeSimpleRoutine(identifier_t name, argument_t *args)
 return rt;
 }
 
-routine_t *
-rtMakeProcedure(identifier_t name, argument_t *args)
-{
-routine_t *rt = rtAlloc();
-
-rt->rtName = name;
-rt->rtKind = rkProcedure;
-rt->rtArgs = args;
-
-warn("Procedure %s: obsolete routine kind", name);
-
-return rt;
-}
-
-routine_t *
-rtMakeSimpleProcedure(identifier_t name, argument_t *args)
-{
-routine_t *rt = rtAlloc();
-
-rt->rtName = name;
-rt->rtKind = rkSimpleProcedure;
-rt->rtArgs = args;
-
-warn("SimpleProcedure %s: obsolete routine kind", name);
-
-return rt;
-}
-
-routine_t *
-rtMakeFunction(identifier_t name, argument_t *args, ipc_type_t *type)
-{
-routine_t *rt = rtAlloc();
-argument_t *ret = argAlloc();
-
-ret->argName = name;
-ret->argKind = akReturn;
-ret->argType = type;
-ret->argNext = args;
-
-rt->rtName = name;
-rt->rtKind = rkFunction;
-rt->rtArgs = ret;
-
-warn("Function %s: obsolete routine kind", name);
-
-return rt;
-}
-
 const char *
 rtRoutineKindToStr(routine_kind_t rk)
 {
@@ -193,12 +144,6 @@ rtRoutineKindToStr(routine_kind_t rk)
return "Routine";
   case rkSimpleRoutine:
return "SimpleRoutine";
-  case rkProcedure:
-   return "Procedure";
-  case rkSimpleProcedure:
-   return "SimpleProcedure";
-  case rkFunction:
-   return "Function";
   default:
fatal("rtRoutineKindToStr(%d): not