[PATCH] netfs: Remove global reference count lock.

2016-03-19 Thread Flavio Cruz
* libnetfs/drop-node.c: Remove use of netfs_node_refcnt_lock.
* libnetfs/init-init.c: Remove netfs_node_refcnt_lock.
* libnetfs/make-node.c: Initialize refcounts in refcounts_init.
* libnetfs/netfs.h: Use refcounts_t for tracking node references. Remove
netfs_node_refcnt_lock. Add netfs_nref_light, netfs_nrele_light and
handler netfs_try_dropping_softrefs. Adjust comments.
* libnetfs/nput.c: Use refcounts_t. Call netfs_try_dropping_softrefs to
remove any soft reference that the translator might have acquired
during the lifetime of the node. Implement empty
netfs_try_dropping_softrefs.
* libnetfs/nref.c: Implement netfs_nref_light.
* libnetfs/nrele.c: Use refcounts_t and netfs_try_dropping_softrefs.
Implement netfs_nrele_light.
* ftpfs/dir.c: Use netfs_nref without locking the old
netfs_node_refcnt_lock.
* ftpfs/node.c: Likewise.
* usermux/mux.c: Use netfs_nref to increase hard references of the node.
* hostmux/mux.c: Use netfs_nref to increase hard references of the node.
* trans/fakeroot.c (new_node): Use a light reference when storing a node in the
hash table.
* trans/fakeroot.c (netfs_try_dropping_softrefs): Implement
netfs_try_dropping_softrefs to remove the node from the hash table.
* trans/fakeroot.c (netfs_node_norefs): Remove code to remove the node
from the hash table.
* trans/fakeroot.c (netfs_S_dir_lookup): Simplify lookup code since we
don't need to lock netfs_node_refcnt_lock anymore.
* procfs/netfs.c: Remove use of netfs_node_refcnt_lock.
* nfs/cache.c: Add mutex to handle exclusive access to nodehash. This
replaces the use of netfs_node_refcnt_lock.
* nfs/cache.c (lookup_handle): Use nodehash_ihash_lock when accessing
nodehash. Use netfs_nref_light to add one soft reference to the node
just added to nodehash.
* nfs/cache.c (netfs_node_norefs): Use netfs_nref. Don't use
netfs_node_refcnt_lock and don't remove the node from nodehash here.
* nfs/cache.c (netfs_try_dropping_softrefs): Drop the light reference
when the node has no more hard references.
* nfs/cache.c (recache_handle): Use nodehash_ihash_lock instead.
* nfs/ops.c (netds_attempt_unlink): Use refcounts_references.
* console/console.c (netfs_node_norefs): Use a soft reference to store
a node in dir_node, cons_node, disp_node, inp_node.
* console/console.c (netfs_try_dropping_softrefs): When dropping all
soft references remove node pointer from the fields above.
---
 console/console.c| 64 ++--
 ftpfs/dir.c  | 27 +-
 ftpfs/node.c |  8 +--
 hostmux/mux.c|  6 ++---
 libnetfs/drop-node.c |  1 -
 libnetfs/init-init.c |  2 --
 libnetfs/make-node.c |  2 +-
 libnetfs/netfs.h | 42 ++
 libnetfs/nput.c  | 27 ++
 libnetfs/nref.c  | 10 +---
 libnetfs/nrele.c | 37 --
 nfs/cache.c  | 40 ++--
 nfs/ops.c|  5 +++-
 procfs/netfs.c   |  4 
 trans/fakeroot.c | 45 +---
 usermux/mux.c|  6 ++---
 16 files changed, 185 insertions(+), 141 deletions(-)

diff --git a/console/console.c b/console/console.c
index 57ae813..9c5869d 100644
--- a/console/console.c
+++ b/console/console.c
@@ -415,47 +415,51 @@ new_node (struct node **np, vcons_t vcons, 
vcons_node_type type)
 
 /* Node management.  */
 
-/* Node NP has no more references; free all its associated
-   storage.  */
+/* We need to drop the soft references on NP.  */
 void
-netfs_node_norefs (struct node *np)
+netfs_try_dropping_softrefs (struct node *np)
 {
   vcons_t vcons = np->nn->vcons;
+  int release = FALSE;
 
-  /* The root node does never go away.  */
-  assert (!np->nn->cons && np->nn->vcons);
-
-  /* Avoid deadlock.  */
-  pthread_spin_unlock (&netfs_node_refcnt_lock);
-
-  /* Find the back reference to ourself in the virtual console
- structure, and delete it.  */
   pthread_mutex_lock (&vcons->lock);
-  pthread_spin_lock (&netfs_node_refcnt_lock);
-  if (np->references)
+  if (np == vcons->dir_node)
 {
-  /* Someone else got a reference while we were attempting to go
-away.  This can happen in netfs_attempt_lookup.  In this
-case, just unlock the node and do nothing else.  */
-  pthread_mutex_unlock (&vcons->lock);
-  pthread_mutex_unlock (&np->lock);
-  return;
+  release = TRUE;
+  vcons->dir_node = 0;
 }
-  if (np == vcons->dir_node)
-vcons->dir_node = 0;
   else if (np == vcons->cons_node)
-vcons->cons_node = 0;
+{
+  release = TRUE;
+  vcons->cons_node = 0;
+}
   else if (np == vcons->disp_node)
-vcons->disp_node = 0;
-  else
 {
-  assert (np == vcons->inpt_node);
+  release = TRUE;
+  vcons->disp_node = 0;
+}
+  else if (np == vcons->inpt_node)
+{
+  release = TRUE;
   vcons->inpt_node = 0;
 }
+  if (release)
+netfs_nrele_light (np);
   pthread_mutex_unlock (&vcons->lock);
 
  

[PATCH] Simpler lexer regexps of case insensitive keywords.

2016-03-19 Thread Flavio Cruz
* lexxer.l: Use (?i) for matching case insensitive keywords.
* README: Fix typo.
---
 README   |   2 +-
 lexxer.l | 100 +++
 2 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/README b/README
index e4c0639..2c693d8 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ This is GNU MIG, the GNU distribution of the Mach 3.0 Interface 
Generator
 (MIG), .
 Welcome.
 
-This tool translates Remore Procedure Call (RPC) definition files to C
+This tool translates Remote Procedure Call (RPC) definition files to C
 code, and is required to compile any packages that are receiving or
 invoking RPCs, such as GNU Mach, GNU Hurd, and the GNU C Library (glibc)
 when compiled for the Hurd.
diff --git a/lexxer.l b/lexxer.l
index c71f85a..06b04e2 100644
--- a/lexxer.l
+++ b/lexxer.l
@@ -107,56 +107,56 @@ static void doSharp(const char *body); /* process body of 
# directives */
 
 %%
 
-[Rr][Oo][Uu][Tt][Ii][Nn][Ee]   RETURN(syRoutine);
-[Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]   RETURN(syFunction);
-[Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee]   RETURN(syProcedure);
-[Ss][Ii][Mm][Pp][Ll][Ee][Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee] 
RETURN(sySimpleProcedure);
-[Ss][Ii][Mm][Pp][Ll][Ee][Rr][Oo][Uu][Tt][Ii][Nn][Ee] 
RETURN(sySimpleRoutine);
-[Ss][Uu][Bb][Ss][Yy][Ss][Tt][Ee][Mm]   RETURN(sySubsystem);
-[Mm][Ss][Gg][Oo][Pp][Tt][Ii][Oo][Nn]   RETURN(syMsgOption);
-[Mm][Ss][Gg][Ss][Ee][Qq][Nn][Oo]   RETURN(syMsgSeqno);
-[Ww][Aa][Ii][Tt][Tt][Ii][Mm][Ee]   RETURN(syWaitTime);
-[Nn][Oo][Ww][Aa][Ii][Tt][Tt][Ii][Mm][Ee]   RETURN(syNoWaitTime);
-[Ii][Nn]   RETURN(syIn);
-[Oo][Uu][Tt]   RETURN(syOut);
-[Ii][Nn][Oo][Uu][Tt]   RETURN(syInOut);
-[Rr][Ee][Qq][Uu][Ee][Ss][Tt][Pp][Oo][Rr][Tt]   RETURN(syRequestPort);
-[Rr][Ee][Pp][Ll][Yy][Pp][Oo][Rr][Tt]   RETURN(syReplyPort);
-[Uu][Rr][Ee][Pp][Ll][Yy][Pp][Oo][Rr][Tt]   RETURN(syUReplyPort);
-[Ss][Rr][Ee][Pp][Ll][Yy][Pp][Oo][Rr][Tt]   RETURN(sySReplyPort);
-[Aa][Rr][Rr][Aa][Yy]   RETURN(syArray);
-[Oo][Ff]   RETURN(syOf);
-[Ee][Rr][Rr][Oo][Rr]   RETURN(syErrorProc);
-[Ss][Ee][Rr][Vv][Ee][Rr][Pp][Rr][Ee][Ff][Ii][Xx] 
RETURN(syServerPrefix);
-[Uu][Ss][Ee][Rr][Pp][Rr][Ee][Ff][Ii][Xx]   RETURN(syUserPrefix);
-[Ss][Ee][Rr][Vv][Ee][Rr][Dd][Ee][Mm][Uu][Xx]   RETURN(syServerDemux);
-[Rr][Cc][Ss][Ii][Dd]   RETURN(syRCSId);
-[Ii][Mm][Pp][Oo][Rr][Tt]   RETURN(syImport);
-[Uu][Ii][Mm][Pp][Oo][Rr][Tt]   RETURN(syUImport);
-[Ss][Ii][Mm][Pp][Oo][Rr][Tt]   RETURN(sySImport);
-[Tt][Yy][Pp][Ee]   RETURN(syType);
-[Kk][Ee][Rr][Nn][Ee][Ll][Ss][Ee][Rr][Vv][Ee][Rr] 
RETURN(syKernelServer);
-[Kk][Ee][Rr][Nn][Ee][Ll][Uu][Ss][Ee][Rr]   RETURN(syKernelUser);
-[Ss][Kk][Ii][Pp]   RETURN(sySkip);
-[Ss][Tt][Rr][Uu][Cc][Tt]   RETURN(syStruct);
-[Ii][Nn][Tt][Rr][Aa][Nn]   RETURN(syInTran);
-[Ii][Nn][Tt][Rr][Aa][Nn][Pp][Aa][Yy][Ll][Oo][Aa][Dd] 
RETURN(syInTranPayload);
-[Oo][Uu][Tt][Tt][Rr][Aa][Nn]   RETURN(syOutTran);
-[Dd][Ee][Ss][Tt][Rr][Uu][Cc][Tt][Oo][Rr]   RETURN(syDestructor);
-[Cc][Tt][Yy][Pp][Ee]   RETURN(syCType);
-[Cc][Uu][Ss][Ee][Rr][Tt][Yy][Pp][Ee]   RETURN(syCUserType);
-[Cc][Ss][Ee][Rr][Vv][Ee][Rr][Tt][Yy][Pp][Ee]   RETURN(syCServerType);
-[Cc]_[Ss][Tt][Rr][Ii][Nn][Gg]  RETURN(syCString);
-
-[Ii][Ss][Ll][Oo][Nn][Gg]   FRETURN(flLong);
-[Ii][Ss][Nn][Oo][Tt][Ll][Oo][Nn][Gg]   FRETURN(flNotLong);
-[Dd][Ee][Aa][Ll][Ll][Oo][Cc]   FRETURN(flDealloc);
-[Nn][Oo][Tt][Dd][Ee][Aa][Ll][Ll][Oo][Cc] FRETURN(flNotDealloc);
-[Ss][Ee][Rr][Vv][Ee][Rr][Cc][Oo][Pp][Yy] FRETURN(flServerCopy);
-[Cc][Oo][Uu][Nn][Tt][Ii][Nn][Oo][Uu][Tt] FRETURN(flCountInOut);
-[Rr][Ee][Tt][Cc][Oo][Dd][Ee]   FRETURN(flNone);
-
-[Pp][Oo][Ll][Yy][Mm][Oo][Rr][Pp][Hh][Ii][Cc]   
TRETURN(MACH_MSG_TYPE_POLYMORPHIC,word_size_in_bits);
+(?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);
+(?i:msgseqno)  RETURN(syMsgSeqno);
+(?i:waittime)  RETURN(syWaitTime);
+(?i:nowaittime)RETURN(syNoWaitTime);
+(?i:in)RETURN(syIn);
+(?i:out)   RETURN(syOut);
+(?i:inout) RETURN(syInOut);
+(?i:requestport)   RETURN(syRequestPort);
+(?i:replyport) RETURN(syReplyPort);
+(?i:ureplyport)RETURN(syUReplyPort);
+(?i:sreplyport)RETURN(sySReplyPort);
+(?i:array) RETURN(syArray);
+(?i:of)

[PATCH] Replace Mach types with just POSIX types.

2016-03-19 Thread Flavio Cruz
* i386/i386/xen.h: Use uint64_t.
* i386/include/mach/i386/machine_types.defs: Use uint32_t and int32_t.
* i386/include/mach/i386/vm_types.h: Remove definitions of int*, uint*,
unsigned* and signed* types. Define POSIX types such as int*_t and
uint*_t.
* i386/xen/xen.c: Use uint64_t.
* include/device/device_types.defs: Use uint32_t.
* include/mach/std_types.defs: Use POSIX types.
* include/sys/types.h: Use new type definitions from machine/vm_types.h
to define u_int*_t types.
* ipc/ipc_kmsg.c: Use uint64_t.
* kern/exception.c: Use uint32_t.
* xen/block.c: Use uint64_t.
* xen/net.c: Do not use removed unsigned*_t types.
* xen/ring.h: Use uint32_t instead.
* xen/store.c: Use uint32_t.
* xen/store.h: Use uint32_t.
* xen/time.c: Use POSIX types only.
* xen/time.h: Use uint64_t.
---
 i386/i386/xen.h   |  4 ++--
 i386/include/mach/i386/machine_types.defs |  4 ++--
 i386/include/mach/i386/vm_types.h | 26 --
 i386/xen/xen.c|  2 +-
 include/device/device_types.defs  |  6 +++---
 include/mach/std_types.defs   |  8 
 include/sys/types.h   | 16 
 ipc/ipc_kmsg.c|  8 
 kern/exception.c  |  2 +-
 xen/block.c   |  4 ++--
 xen/net.c |  6 +++---
 xen/ring.h|  2 +-
 xen/store.c   |  4 ++--
 xen/store.h   |  2 +-
 xen/time.c| 28 ++--
 xen/time.h|  2 +-
 16 files changed, 53 insertions(+), 71 deletions(-)

diff --git a/i386/i386/xen.h b/i386/i386/xen.h
index c681187..a2bb207 100644
--- a/i386/i386/xen.h
+++ b/i386/i386/xen.h
@@ -356,8 +356,8 @@ _hypcall2(int, set_debugreg, int, reg, unsigned long, 
value);
 _hypcall1(unsigned long, get_debugreg, int, reg);
 
 /* x86-specific */
-MACH_INLINE unsigned64_t hyp_cpu_clock(void) {
-   unsigned64_t tsc;
+MACH_INLINE uint64_t hyp_cpu_clock(void) {
+  uint64_t tsc;
asm volatile("rdtsc":"=A"(tsc));
return tsc;
 }
diff --git a/i386/include/mach/i386/machine_types.defs 
b/i386/include/mach/i386/machine_types.defs
index 6ac17cf..6ff93db 100755
--- a/i386/include/mach/i386/machine_types.defs
+++ b/i386/include/mach/i386/machine_types.defs
@@ -47,7 +47,7 @@
  * a port in user space as an integer and
  * in kernel space as a pointer.
  */
-type natural_t = unsigned32;
+type natural_t = uint32_t;
 
 /*
  * An integer_t is the signed counterpart
@@ -56,6 +56,6 @@ type natural_t = unsigned32;
  * other types in a machine-independent
  * way.
  */
-type integer_t = int32;
+type integer_t = int32_t;
 
 #endif /* _MACHINE_MACHINE_TYPES_DEFS_ */
diff --git a/i386/include/mach/i386/vm_types.h 
b/i386/include/mach/i386/vm_types.h
index 4a58b1c..b04c322 100644
--- a/i386/include/mach/i386/vm_types.h
+++ b/i386/include/mach/i386/vm_types.h
@@ -59,16 +59,6 @@ typedef unsigned int natural_t;
  */
 typedef intinteger_t;
 
-#ifndef _POSIX_SOURCE
-
-/*
- * An int32 is an integer that is at least 32 bits wide
- */
-typedef intint32;
-typedef unsigned int   uint32;
-
-#endif /* _POSIX_SOURCE */
-
 /*
  * A vm_offset_t is a type-neutral pointer,
  * e.g. an offset into a virtual memory space.
@@ -95,14 +85,14 @@ typedef natural_t   vm_size_t;
 /*
  * These types are _exactly_ as wide as indicated in their names.
  */
-typedef signed charsigned8_t;
-typedef signed short   signed16_t;
-typedef signed int signed32_t;
-typedef signed long long   signed64_t;
-typedef unsigned char  unsigned8_t;
-typedef unsigned short unsigned16_t;
-typedef unsigned int   unsigned32_t;
-typedef unsigned long long unsigned64_t;
+typedef signed charint8_t;
+typedef signed short   int16_t;
+typedef intint32_t;
+typedef signed long long   int64_t;
+typedef unsigned char  uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int   uint32_t;
+typedef unsigned long long uint64_t;
 typedef float  float32_t;
 typedef double float64_t;
 
diff --git a/i386/xen/xen.c b/i386/xen/xen.c
index a46ee2c..44d37e6 100644
--- a/i386/xen/xen.c
+++ b/i386/xen/xen.c
@@ -46,7 +46,7 @@ void hyp_failsafe_c_callback(struct failsafe_callback_regs 
*regs) {
 
 extern void return_to_iret;
 
-void hypclock_machine_intr(int old_ipl, void *ret_addr, struct 
i386_interrupt_state *regs, unsigned64_t delta) {
+void hypclock_machine_intr(int old_ipl, void *ret_addr, struct 
i386_interrupt_state *regs, uint64_t delta) {
if (ret_addr == &return_to_iret) {
clock_interrupt(delta/1000, /* usec per tick */
(regs->efl & EFL_VM) || /* user mode */ 
diff 

Re: [PATCH] Simpler lexer regexps of case insensitive keywords.

2016-03-19 Thread Samuel Thibault
Flavio Cruz, on Tue 15 Mar 2016 05:06:12 -0400, wrote:
> * lexxer.l: Use (?i) for matching case insensitive keywords.
> * README: Fix typo.

Applied, thanks!

> ---
>  README   |   2 +-
>  lexxer.l | 100 
> +++
>  2 files changed, 51 insertions(+), 51 deletions(-)
> 
> diff --git a/README b/README
> index e4c0639..2c693d8 100644
> --- a/README
> +++ b/README
> @@ -2,7 +2,7 @@ This is GNU MIG, the GNU distribution of the Mach 3.0 
> Interface Generator
>  (MIG), .
>  Welcome.
>  
> -This tool translates Remore Procedure Call (RPC) definition files to C
> +This tool translates Remote Procedure Call (RPC) definition files to C
>  code, and is required to compile any packages that are receiving or
>  invoking RPCs, such as GNU Mach, GNU Hurd, and the GNU C Library (glibc)
>  when compiled for the Hurd.
> diff --git a/lexxer.l b/lexxer.l
> index c71f85a..06b04e2 100644
> --- a/lexxer.l
> +++ b/lexxer.l
> @@ -107,56 +107,56 @@ static void doSharp(const char *body); /* process body 
> of # directives */
>  
>  %%
>  
> -[Rr][Oo][Uu][Tt][Ii][Nn][Ee] RETURN(syRoutine);
> -[Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn] RETURN(syFunction);
> -[Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee] RETURN(syProcedure);
> -[Ss][Ii][Mm][Pp][Ll][Ee][Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee] 
> RETURN(sySimpleProcedure);
> -[Ss][Ii][Mm][Pp][Ll][Ee][Rr][Oo][Uu][Tt][Ii][Nn][Ee] 
> RETURN(sySimpleRoutine);
> -[Ss][Uu][Bb][Ss][Yy][Ss][Tt][Ee][Mm] RETURN(sySubsystem);
> -[Mm][Ss][Gg][Oo][Pp][Tt][Ii][Oo][Nn] RETURN(syMsgOption);
> -[Mm][Ss][Gg][Ss][Ee][Qq][Nn][Oo] RETURN(syMsgSeqno);
> -[Ww][Aa][Ii][Tt][Tt][Ii][Mm][Ee] RETURN(syWaitTime);
> -[Nn][Oo][Ww][Aa][Ii][Tt][Tt][Ii][Mm][Ee] RETURN(syNoWaitTime);
> -[Ii][Nn] RETURN(syIn);
> -[Oo][Uu][Tt] RETURN(syOut);
> -[Ii][Nn][Oo][Uu][Tt] RETURN(syInOut);
> -[Rr][Ee][Qq][Uu][Ee][Ss][Tt][Pp][Oo][Rr][Tt] RETURN(syRequestPort);
> -[Rr][Ee][Pp][Ll][Yy][Pp][Oo][Rr][Tt] RETURN(syReplyPort);
> -[Uu][Rr][Ee][Pp][Ll][Yy][Pp][Oo][Rr][Tt] RETURN(syUReplyPort);
> -[Ss][Rr][Ee][Pp][Ll][Yy][Pp][Oo][Rr][Tt] RETURN(sySReplyPort);
> -[Aa][Rr][Rr][Aa][Yy] RETURN(syArray);
> -[Oo][Ff] RETURN(syOf);
> -[Ee][Rr][Rr][Oo][Rr] RETURN(syErrorProc);
> -[Ss][Ee][Rr][Vv][Ee][Rr][Pp][Rr][Ee][Ff][Ii][Xx] 
> RETURN(syServerPrefix);
> -[Uu][Ss][Ee][Rr][Pp][Rr][Ee][Ff][Ii][Xx] RETURN(syUserPrefix);
> -[Ss][Ee][Rr][Vv][Ee][Rr][Dd][Ee][Mm][Uu][Xx] RETURN(syServerDemux);
> -[Rr][Cc][Ss][Ii][Dd] RETURN(syRCSId);
> -[Ii][Mm][Pp][Oo][Rr][Tt] RETURN(syImport);
> -[Uu][Ii][Mm][Pp][Oo][Rr][Tt] RETURN(syUImport);
> -[Ss][Ii][Mm][Pp][Oo][Rr][Tt] RETURN(sySImport);
> -[Tt][Yy][Pp][Ee] RETURN(syType);
> -[Kk][Ee][Rr][Nn][Ee][Ll][Ss][Ee][Rr][Vv][Ee][Rr] 
> RETURN(syKernelServer);
> -[Kk][Ee][Rr][Nn][Ee][Ll][Uu][Ss][Ee][Rr] RETURN(syKernelUser);
> -[Ss][Kk][Ii][Pp] RETURN(sySkip);
> -[Ss][Tt][Rr][Uu][Cc][Tt] RETURN(syStruct);
> -[Ii][Nn][Tt][Rr][Aa][Nn] RETURN(syInTran);
> -[Ii][Nn][Tt][Rr][Aa][Nn][Pp][Aa][Yy][Ll][Oo][Aa][Dd] 
> RETURN(syInTranPayload);
> -[Oo][Uu][Tt][Tt][Rr][Aa][Nn] RETURN(syOutTran);
> -[Dd][Ee][Ss][Tt][Rr][Uu][Cc][Tt][Oo][Rr] RETURN(syDestructor);
> -[Cc][Tt][Yy][Pp][Ee] RETURN(syCType);
> -[Cc][Uu][Ss][Ee][Rr][Tt][Yy][Pp][Ee] RETURN(syCUserType);
> -[Cc][Ss][Ee][Rr][Vv][Ee][Rr][Tt][Yy][Pp][Ee] RETURN(syCServerType);
> -[Cc]_[Ss][Tt][Rr][Ii][Nn][Gg]
> RETURN(syCString);
> -
> -[Ii][Ss][Ll][Oo][Nn][Gg] FRETURN(flLong);
> -[Ii][Ss][Nn][Oo][Tt][Ll][Oo][Nn][Gg] FRETURN(flNotLong);
> -[Dd][Ee][Aa][Ll][Ll][Oo][Cc] FRETURN(flDealloc);
> -[Nn][Oo][Tt][Dd][Ee][Aa][Ll][Ll][Oo][Cc] FRETURN(flNotDealloc);
> -[Ss][Ee][Rr][Vv][Ee][Rr][Cc][Oo][Pp][Yy] FRETURN(flServerCopy);
> -[Cc][Oo][Uu][Nn][Tt][Ii][Nn][Oo][Uu][Tt] FRETURN(flCountInOut);
> -[Rr][Ee][Tt][Cc][Oo][Dd][Ee] FRETURN(flNone);
> -
> -[Pp][Oo][Ll][Yy][Mm][Oo][Rr][Pp][Hh][Ii][Cc] 
> TRETURN(MACH_MSG_TYPE_POLYMORPHIC,word_size_in_bits);
> +(?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);
> +(?i:msgseqno)RETURN(syMsgSeqno);
> +(?i:waittime)RETURN(syWaitTime);
> +(?i:nowaittime)  RETURN(syNoWaitTime);
> +(?i:in)  RETURN(syIn);
> +(?i:out) RETURN(syOut);
> +(?i:inout)   RETURN(syInOut);
> +(?i:requestport) RETURN(syRequestPort)

Re: [PATCH] Remove functions, procedures and simple procedures.

2016-03-19 Thread Samuel Thibault
Hello,

Flavio Cruz, on Tue 15 Mar 2016 05:31:41 -0400, wrote:
> This has been tested by cross-compiling a base Hurd system to make sure
> these kinds of routines are no longer used.

What is the rationale for removing them?  Will we never need them again?

> * 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 

Re: [PATCH] Use uint32_t instead of unsigned32_t.

2016-03-19 Thread Samuel Thibault
Hello,

Flavio Cruz, on Tue 15 Mar 2016 05:48:48 -0400, wrote:
> * utils.c: Generate code using uint32_t.

How are we sure that stdint.h gets included?

Samuel
> ---
>  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
> 
> 

-- 
Samuel
 bon comment on fait de l'investigation pour savoir qui est le vilain ?
 on débranche le routeur et on regarde qui s'affole
 -+- #ens-mim administre -+-



Re: [PATCH] Use posix types for mig definitions.

2016-03-19 Thread Samuel Thibault
Flavio Cruz, on Tue 15 Mar 2016 05:49:51 -0400, wrote:
> * hurd/hurd_types.defs: Use posix types.

Here also, how do we make sure stdint.h gets included?

> - unsigned32_t word;
> +uint32_t word;

Here also, breaking indentation.

Samuel



Re: [PATCH] Replace Mach types with just POSIX types.

2016-03-19 Thread Samuel Thibault
Flavio Cruz, on Tue 15 Mar 2016 05:49:20 -0400, wrote:
> -MACH_INLINE unsigned64_t hyp_cpu_clock(void) {
> - unsigned64_t tsc;
> +MACH_INLINE uint64_t hyp_cpu_clock(void) {
> +  uint64_t tsc;

Take care of these which break the indentation.

Samuel



[PATCH] Use posix types for mig definitions.

2016-03-19 Thread Flavio Cruz
* hurd/hurd_types.defs: Use posix types.
* libfshelp/start-translator-long.c: Use uint32_t instead of
unsigned32_t.
---
 hurd/hurd_types.defs  | 20 ++--
 libfshelp/start-translator-long.c |  3 ++-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/hurd/hurd_types.defs b/hurd/hurd_types.defs
index 1837500..4d7013c 100644
--- a/hurd/hurd_types.defs
+++ b/hurd/hurd_types.defs
@@ -349,16 +349,16 @@ serverprefix SERVERPREFIX;
 type data_t = array[] of char;
 type string_t = c_string[1024]; /* XXX */
 type io_statbuf_t = struct[32] of int;
-type uid_t = unsigned32;
-type gid_t = unsigned32;
-type mode_t = unsigned32;
-type retry_type = unsigned32;
-type pid_t = int32;
-type wait_status_t = int32;
-type loff_t = int64;
-type ino64_t = int64;
-type file_changed_type_t = unsigned32;
-type dir_changed_type_t = unsigned32;
+type uid_t = uint32_t;
+type gid_t = uint32_t;
+type mode_t = uint32_t;
+type retry_type = uint32_t;
+type pid_t = int32_t;
+type wait_status_t = int32_t;
+type loff_t = int64_t;
+type ino64_t = int64_t;
+type file_changed_type_t = uint32_t;
+type dir_changed_type_t = uint32_t;
 
 type portarray_t = array[] of mach_port_send_t;
 type intarray_t = array[] of int;
diff --git a/libfshelp/start-translator-long.c 
b/libfshelp/start-translator-long.c
index 8b00e08..da6f52e 100644
--- a/libfshelp/start-translator-long.c
+++ b/libfshelp/start-translator-long.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "fshelp.h"
@@ -107,7 +108,7 @@ service_fsys_startup (fshelp_open_fn_t underlying_open_fn, 
void *cookie,
 {
   union
   {
-   unsigned32_t word;
+uint32_t word;
mach_msg_type_t type;
   } t, c;
   t.type = *type;
-- 
2.6.4




Re: [PATCH] Remove functions, procedures and simple procedures.

2016-03-19 Thread Flávio Cruz
On 19 March 2016 at 12:35, Samuel Thibault  wrote:

> Hello,
>
> Flavio Cruz, on Tue 15 Mar 2016 05:31:41 -0400, wrote:
> > This has been tested by cross-compiling a base Hurd system to make sure
> > these kinds of routines are no longer used.
>
> What is the rationale for removing them?  Will we never need them again?
>

They are already marked as obsolete in the current code (note the
warn("Function
%s: obsolete routine kind", name); in the functions that create routine
structures). git blame indicates that these were made obsolete in 1998 but
I couldn't find any entry in the old ChangeLog, so I'm guessing this
happened even before the code was forked as a GNU project.

I also don't think they are going to be used since procedures and functions
don't provide error codes during return and we can do everything with
simpleroutine and routine, which are superior alternatives.

Note that I've also cross-compiled the Hurd from the sources and these
routine kinds are not used anywhere in the defs files.

Flavio


>
> > * 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 

Re: [PATCH] Use uint32_t instead of unsigned32_t.

2016-03-19 Thread Flávio Cruz
On 19 March 2016 at 12:39, Samuel Thibault  wrote:

> Hello,
>
> Flavio Cruz, on Tue 15 Mar 2016 05:48:48 -0400, wrote:
> > * utils.c: Generate code using uint32_t.
>
> How are we sure that stdint.h gets included?
>

We already include mach/std_types.h in the stubs which provides uint32_t.


>
> Samuel
> > ---
> >  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
> >
> >
>
> --
> Samuel
>  bon comment on fait de l'investigation pour savoir qui est le vilain ?
>  on débranche le routeur et on regarde qui s'affole
>  -+- #ens-mim administre -+-
>



-- 
Flávio Cruz / flavioc...@gmail.com


[PATCH] Replace Mach types with POSIX types.

2016-03-19 Thread Flavio Cruz
* i386/i386/xen.h: Use uint64_t.
* i386/include/mach/i386/machine_types.defs: Use uint32_t and int32_t.
* i386/include/mach/i386/vm_types.h: Remove definitions of int*, uint*,
unsigned* and signed* types. Define POSIX types such as int*_t and
uint*_t.
* i386/xen/xen.c: Use uint64_t.
* include/device/device_types.defs: Use uint32_t.
* include/mach/std_types.defs: Use POSIX types.
* include/sys/types.h: Use new type definitions from machine/vm_types.h
to define u_int*_t types.
* ipc/ipc_kmsg.c: Use uint64_t.
* kern/exception.c: Use uint32_t.
* xen/block.c: Use uint64_t.
* xen/net.c: Do not use removed unsigned*_t types.
* xen/ring.h: Use uint32_t instead.
* xen/store.c: Use uint32_t.
* xen/store.h: Use uint32_t.
* xen/time.c: Use POSIX types only.
* xen/time.h: Use uint64_t.
---
 i386/i386/xen.h   |  4 ++--
 i386/include/mach/i386/vm_types.h | 26 --
 i386/xen/xen.c|  2 +-
 include/device/device_types.defs  |  6 +++---
 include/mach/std_types.defs   |  8 
 include/sys/types.h   | 16 
 ipc/ipc_kmsg.c|  8 
 kern/exception.c  |  2 +-
 xen/block.c   |  4 ++--
 xen/net.c |  6 +++---
 xen/ring.h|  2 +-
 xen/store.c   |  4 ++--
 xen/store.h   |  2 +-
 xen/time.c| 28 ++--
 xen/time.h|  2 +-
 15 files changed, 51 insertions(+), 69 deletions(-)

diff --git a/i386/i386/xen.h b/i386/i386/xen.h
index c681187..49b0d52 100644
--- a/i386/i386/xen.h
+++ b/i386/i386/xen.h
@@ -356,8 +356,8 @@ _hypcall2(int, set_debugreg, int, reg, unsigned long, 
value);
 _hypcall1(unsigned long, get_debugreg, int, reg);
 
 /* x86-specific */
-MACH_INLINE unsigned64_t hyp_cpu_clock(void) {
-   unsigned64_t tsc;
+MACH_INLINE uint64_t hyp_cpu_clock(void) {
+   uint64_t tsc;
asm volatile("rdtsc":"=A"(tsc));
return tsc;
 }
diff --git a/i386/include/mach/i386/vm_types.h 
b/i386/include/mach/i386/vm_types.h
index 4a58b1c..b04c322 100644
--- a/i386/include/mach/i386/vm_types.h
+++ b/i386/include/mach/i386/vm_types.h
@@ -59,16 +59,6 @@ typedef unsigned int natural_t;
  */
 typedef intinteger_t;
 
-#ifndef _POSIX_SOURCE
-
-/*
- * An int32 is an integer that is at least 32 bits wide
- */
-typedef intint32;
-typedef unsigned int   uint32;
-
-#endif /* _POSIX_SOURCE */
-
 /*
  * A vm_offset_t is a type-neutral pointer,
  * e.g. an offset into a virtual memory space.
@@ -95,14 +85,14 @@ typedef natural_t   vm_size_t;
 /*
  * These types are _exactly_ as wide as indicated in their names.
  */
-typedef signed charsigned8_t;
-typedef signed short   signed16_t;
-typedef signed int signed32_t;
-typedef signed long long   signed64_t;
-typedef unsigned char  unsigned8_t;
-typedef unsigned short unsigned16_t;
-typedef unsigned int   unsigned32_t;
-typedef unsigned long long unsigned64_t;
+typedef signed charint8_t;
+typedef signed short   int16_t;
+typedef intint32_t;
+typedef signed long long   int64_t;
+typedef unsigned char  uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int   uint32_t;
+typedef unsigned long long uint64_t;
 typedef float  float32_t;
 typedef double float64_t;
 
diff --git a/i386/xen/xen.c b/i386/xen/xen.c
index a46ee2c..44d37e6 100644
--- a/i386/xen/xen.c
+++ b/i386/xen/xen.c
@@ -46,7 +46,7 @@ void hyp_failsafe_c_callback(struct failsafe_callback_regs 
*regs) {
 
 extern void return_to_iret;
 
-void hypclock_machine_intr(int old_ipl, void *ret_addr, struct 
i386_interrupt_state *regs, unsigned64_t delta) {
+void hypclock_machine_intr(int old_ipl, void *ret_addr, struct 
i386_interrupt_state *regs, uint64_t delta) {
if (ret_addr == &return_to_iret) {
clock_interrupt(delta/1000, /* usec per tick */
(regs->efl & EFL_VM) || /* user mode */ 
diff --git a/include/device/device_types.defs b/include/device/device_types.defs
index 49cc271..e97d89c 100644
--- a/include/device/device_types.defs
+++ b/include/device/device_types.defs
@@ -43,9 +43,9 @@
 DEVICE_IMPORTS
 #endif
 
-type recnum_t  = unsigned32;
-type dev_mode_t= unsigned32;
-type dev_flavor_t  = unsigned32;
+type recnum_t  = uint32_t;
+type dev_mode_t= uint32_t;
+type dev_flavor_t  = uint32_t;
 type dev_name_t= (MACH_MSG_TYPE_STRING_C, 8*128);
 type dev_status_t  = array[*:1024] of int;
 type io_buf_ptr_t  = ^array[] of MACH_MSG_TYPE_INTEGER_8;
diff --git a/include/mach/std_types.defs b/include/mach/std_types.defs
index a1f156d..5d95ab4 100644
--- a/include/mach/std_types.defs
+++ b/include/mach/st

Re: [PATCH] Remove functions, procedures and simple procedures.

2016-03-19 Thread Samuel Thibault
Flávio Cruz, on Sat 19 Mar 2016 14:09:01 +0100, wrote:
> I also don't think they are going to be used since procedures and functions
> don't provide error codes during return and we can do everything with
> simpleroutine and routine, which are superior alternatives.

Ok.

> Note that I've also cross-compiled the Hurd from the sources and these routine
> kinds are not used anywhere in the defs files.

Sure, but that's no proof that they aren't useful.  What you said above
is, however :)

Samuel



Re: [PATCH] Remove functions, procedures and simple procedures.

2016-03-19 Thread Samuel Thibault
Flavio Cruz, on Tue 15 Mar 2016 05:31:41 -0400, wrote:
> This has been tested by cross-compiling a base Hurd system to make sure
> these kinds of routines are no longer used.

Applied, thanks!

> * 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;
> -}
> 

Re: [PATCH] Use uint32_t instead of unsigned32_t.

2016-03-19 Thread Samuel Thibault
Hello,

Flávio Cruz, on Sat 19 Mar 2016 14:20:34 +0100, wrote:
> We already include mach/std_types.h in the stubs which provides uint32_t.

I guess you mean it includes vm_types.h which defines them.

> diff --git a/i386/include/mach/i386/vm_types.h 
> b/i386/include/mach/i386/vm_types.h
> index 4a58b1c..b04c322 100644
> --- a/i386/include/mach/i386/vm_types.h
> +++ b/i386/include/mach/i386/vm_types.h
> +typedef signed char  int8_t;
> +typedef signed short int16_t;
> +typedef int  int32_t;
> +typedef signed long long int64_t;
> +typedef unsigned charuint8_t;
> +typedef unsigned short   uint16_t;
> +typedef unsigned int uint32_t;
> +typedef unsigned long long   uint64_t;

Won't that risk conflicting with stdint.h?  If some application happens
to want to include both stdint.h and some mach headers (thus ending up
including vm_types.h).

Should gnumach perhaps just rely on stdint.h?

Samuel



Re: dlerror sets errno to ENOSYS

2016-03-19 Thread Samuel Thibault
Diego Nieto Cid, on Tue 08 Mar 2016 17:18:56 -0300, wrote:
> From the main function, the pthread implementation is called but
> from libdl the implementation provided by libc is used.

IIRC libdl uses its own separate mini-libc for its own use indeed.

Samuel