Re: [PATCH] Include device/input.h in console-client

2023-01-10 Thread Samuel Thibault
I was expecting it :)

I'll wait a bit for the updated gnumach to get uploaded etc. before
commiting it.

Flavio Cruz, le lun. 09 janv. 2023 22:37:47 -0500, a ecrit:
> We avoid using repeated definitions and also update kd_event with the
> new 64bit compatible fields (rpc_time_value).
> ---
>  console-client/mach-inputdev.h | 56 +-
>  1 file changed, 1 insertion(+), 55 deletions(-)
> 
> diff --git a/console-client/mach-inputdev.h b/console-client/mach-inputdev.h
> index 985e1e1d..08119ad6 100644
> --- a/console-client/mach-inputdev.h
> +++ b/console-client/mach-inputdev.h
> @@ -51,61 +51,7 @@
>  #define _INPUTDEV_H_ 1
>  
>  #include 
> -
> -typedef u_short kev_type;   /* kd event type */
> -
> -/* (used for event records) */
> -struct mouse_motion {
> -  short mm_deltaX;/* units? */
> -  short mm_deltaY;
> -};
> -typedef u_char Scancode;
> -
> -typedef struct {
> -  kev_type type;  /* see below */
> -  struct timeval time;/* timestamp */
> -  union { /* value associated with event */
> -boolean_t up;   /* MOUSE_LEFT .. MOUSE_RIGHT */
> -Scancode sc;/* KEYBD_EVENT */
> -struct mouse_motion mmotion;/* MOUSE_MOTION */
> -  } value;
> -} kd_event;
> -#define m_deltaXmmotion.mm_deltaX
> -#define m_deltaYmmotion.mm_deltaY
> -
> -/*
> - * kd_event ID's.
> - */
> -#define MOUSE_LEFT  1   /* mouse left button up/down */
> -#define MOUSE_MIDDLE2
> -#define MOUSE_RIGHT 3
> -#define MOUSE_MOTION4   /* mouse motion */
> -#define KEYBD_EVENT 5   /* key up/down */
> -
> -
> -#define IOCPARM_MASK0x1fff  /* parameter length, at most 13 bits 
> */
> -#define IOC_OUT 0x4000  /* copy out parameters */
> -#define IOC_IN  0x8000U /* copy in parameters */
> -
> -#ifndef _IOC
> -#define _IOC(inout,group,num,len) \
> -(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
> -#endif
> -#ifndef _IOR
> -#define _IOR(g,n,t) _IOC(IOC_OUT,   (g), (n), sizeof(t))
> -#endif
> -#ifndef _IOW
> -#define _IOW(g,n,t) _IOC(IOC_IN,(g), (n), sizeof(t))
> -#endif
> -
> -#define KDSKBDMODE  _IOW('K', 1, int)   /* set keyboard mode */
> -#define KB_EVENT1
> -#define KB_ASCII2
> -
> -#define KDGKBDTYPE  _IOR('K', 2, int)   /* get keyboard type */
> -#define KB_VANILLAKB0
> -
> -#define KDSETLEDS  _IOW('K', 5, int)/* set keyboard leds */
> +#include 
>  
>  /*
>   * Low 3 bits of minor are the com port #.
> -- 
> 2.39.0
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



Re: [PATCH] Preemptively fix warnings that will be caused by -Wmissing-prototypes

2023-01-10 Thread Samuel Thibault
Applied, thanks!

Flavio Cruz, le mar. 10 janv. 2023 01:00:37 -0500, a ecrit:
> Declared RPCs in ipc/mach_port.c and ddb/db_ext_symtab.c in their 
> corresponding headers.
> Ideally these should be used by mig instead of mig declaring its own
> prototypes.
> ---
>  Makefrag.am |   1 +
>  ddb/db_ext_symtab.c |   1 +
>  ipc/mach_port.c |   1 -
>  ipc/mach_port.h | 103 ++--
>  kern/mach_debug.h   |  40 +
>  5 files changed, 142 insertions(+), 4 deletions(-)
>  create mode 100644 kern/mach_debug.h
> 
> diff --git a/Makefrag.am b/Makefrag.am
> index e2b4a3ba..8a82caee 100644
> --- a/Makefrag.am
> +++ b/Makefrag.am
> @@ -170,6 +170,7 @@ libkernel_a_SOURCES += \
>   kern/log2.h \
>   kern/mach_clock.c \
>   kern/mach_clock.h \
> + kern/mach_debug.h \
>   kern/mach_factor.c \
>   kern/mach_factor.h \
>   kern/machine.c \
> diff --git a/ddb/db_ext_symtab.c b/ddb/db_ext_symtab.c
> index e1bdfd8b..9c89fb95 100644
> --- a/ddb/db_ext_symtab.c
> +++ b/ddb/db_ext_symtab.c
> @@ -35,6 +35,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> diff --git a/ipc/mach_port.c b/ipc/mach_port.c
> index e5a5e978..1c9cdc97 100644
> --- a/ipc/mach_port.c
> +++ b/ipc/mach_port.c
> @@ -62,7 +62,6 @@
>  #include 
>  
>  
> -
>  /*
>   *   Routine:mach_port_names_helper
>   *   Purpose:
> diff --git a/ipc/mach_port.h b/ipc/mach_port.h
> index 83641ae6..c93c48df 100644
> --- a/ipc/mach_port.h
> +++ b/ipc/mach_port.h
> @@ -30,6 +30,12 @@
>  #include 
>  #include 
>  
> +#if  MACH_KDB
> +void db_debug_port_references (boolean_t enable);
> +#endif   /* MACH_KDB */
> +
> +/* RPCs */
> +
>  extern kern_return_t
>  mach_port_allocate_name (
>  ipc_space_t space,
> @@ -65,8 +71,99 @@ mach_port_get_receive_status(
>   mach_port_name_tname,
>   mach_port_status_t  *statusp);
>  
> -#if  MACH_KDB
> -void db_debug_port_references (boolean_t enable);
> -#endif   /* MACH_KDB */
> +kern_return_t
> +mach_port_names(
> + ipc_space_t space,
> + mach_port_name_t**namesp,
> + mach_msg_type_number_t  *namesCnt,
> + mach_port_type_t**typesp,
> + mach_msg_type_number_t  *typesCnt);
> +
> +kern_return_t
> +mach_port_type(
> + ipc_space_t space,
> + mach_port_name_tname,
> + mach_port_type_t*typep);
> +
> +kern_return_t
> +mach_port_rename(
> + ipc_space_t space,
> + mach_port_name_toname,
> + mach_port_name_tnname);
> +
> +kern_return_t
> +mach_port_get_refs(
> + ipc_space_t space,
> + mach_port_name_tname,
> + mach_port_right_t   right,
> + mach_port_urefs_t   *urefsp);
> +
> +kern_return_t
> +mach_port_mod_refs(
> + ipc_space_t space,
> + mach_port_name_tname,
> + mach_port_right_t   right,
> + mach_port_delta_t   delta);
> +
> +kern_return_t
> +mach_port_set_qlimit(
> + ipc_space_t space,
> + mach_port_name_tname,
> + mach_port_msgcount_tqlimit);
> +
> +kern_return_t
> +mach_port_set_mscount(
> + ipc_space_t space,
> + mach_port_name_tname,
> + mach_port_mscount_t mscount);
> +
> +kern_return_t
> +mach_port_set_seqno(
> + ipc_space_t space,
> + mach_port_name_tname,
> + mach_port_seqno_t   seqno);
> +
> +kern_return_t
> +mach_port_get_set_status(
> + ipc_space_t space,
> + mach_port_name_tname,
> + mach_port_name_t**members,
> + mach_msg_type_number_t  *membersCnt);
> +
> +kern_return_t
> +mach_port_move_member(
> + ipc_space_t space,
> + mach_port_name_tmember,
> + mach_port_name_tafter);
> +
> +kern_return_t
> +mach_port_request_notification(
> + ipc_space_t space,
> + mach_port_name_tname,
> + mach_msg_id_t   id,
> + mach_port_mscount_t sync,
> + ipc_port_t  notify,
> + ipc_port_t  *previousp);
> +
> +kern_return_t
> +mach_port_extract_right(
> + ipc_space_t space,
> + mach_port_name_tname,
> + mach_msg_type_name_tmsgt_name,
> + ipc_port_t  *poly,
> + mach_msg_type_name_t*polyPoly);
> +
> +kern_return_t
> +mach_port_set_protected_payload(
> + ipc_space_t space,
> + mach_port_name_tname,
> + unsigned long   payload);
> +
> +kern_return_t
> +mach_port_clear_protected_payload(
> + ipc_space_t space,
> + mach_port_name_tname);
> +
> +/* End of RPCs */
>  
>  #endif /* _IPC_MACH_PORT_H_ */
> diff --git a/kern/mach_debug.h b/kern/mach_debug.h
> new file mode 100644
> index ..63b8ae96
> --- /dev/null
> +++ b/kern/mach_debug.h
> @@ -0,0 +1,40 @@

Re: [PATCH] Update configure.ac so that we don't need glibc when running ./configure.

2023-01-10 Thread Samuel Thibault
Applied, thanks!

Flavio Cruz, le lun. 09 janv. 2023 22:16:43 -0500, a ecrit:
> For x86_64-pc-gnu we still do not have a working glibc so ./configure will 
> fail
> under a freestanding environment. We force ./configure to avoid running
> compiled C programs as a test which it is not needed when compiling a kernel.
> ---
> On Mon, Jan 09, 2023 at 07:52:21PM +0100, Samuel Thibault wrote:
> > Flavio Cruz, le dim. 08 janv. 2023 21:49:40 -0500, a ecrit:
> > > For x86_64-pc-gnu we still do not have a working glibc so ./configure 
> > > will fail
> > > under a freestanding environment. We force ./configure to avoid running
> > > compiled C programs as a test which it is not needed when compiling a 
> > > kernel.
> > > ---
> > >  configure.ac | 8 
> > >  1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/configure.ac b/configure.ac
> > > index 3aaa935c..06a243a2 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -21,6 +21,9 @@ AC_INIT([AC_PACKAGE_NAME], [AC_PACKAGE_VERSION], 
> > > [AC_PACKAGE_BUGREPORT],
> > >[AC_PACKAGE_TARNAME])
> > >  AC_CONFIG_SRCDIR([kern/ipc_kobject.c])
> > > 
> > > +# We don't need glibc to compile gnumach.
> > > +: ${CFLAGS="-ffreestanding -nostdlib"}
> > 
> > AIUI we can then drop these from Makefile.am?
> > (better not duplicate flags, that most often leads to cargo cult).
> 
> Yes, here's the revised patch.
> 
> > 
> > >  AC_CONFIG_AUX_DIR([build-aux])
> > > 
> > >  AM_INIT_AUTOMAKE(
> > > @@ -79,7 +82,12 @@ AC_SUBST([systype])
> > >  #
> > > 
> > >  AC_PROG_AWK
> > > +# Temporarily force cross compiling mode to make sure the configure 
> > > script
> > > +# does not try to run compiled binaries.
> > > +save_cross_compiling=$cross_compiling
> > > +cross_compiling=yes
> > >  AM_PROG_AS
> > > +cross_compiling=$save_cross_compiling
> > >  AC_PROG_CC
> > >  AC_PROG_CPP
> > >  AC_PROG_INSTALL
> > > --
> > > 2.39.0
> > > 
> > > 
> 
>  Makefile.am  | 2 +-
>  configure.ac | 8 
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 7b7247c5..1bcf7941 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -43,7 +43,7 @@ AM_LDFLAGS =
>  GCC_INSTALL = $(shell LANG=C gcc -print-search-dirs | sed -n -e 's/install: 
> \(.*\)/\1/p')
>  AM_CPPFLAGS += \
> - -ffreestanding -nostdinc -imacros config.h -I $(GCC_INSTALL)/include
> + -imacros config.h -I $(GCC_INSTALL)/include
>  AM_CPPFLAGS += \
>   -I$(systype) \
> diff --git a/configure.ac b/configure.ac
> index 3aaa935c..8f10b5d5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -21,6 +21,9 @@ AC_INIT([AC_PACKAGE_NAME], [AC_PACKAGE_VERSION], 
> [AC_PACKAGE_BUGREPORT],
>[AC_PACKAGE_TARNAME])
>  AC_CONFIG_SRCDIR([kern/ipc_kobject.c])
> +# We don't need glibc to compile gnumach.
> +CFLAGS="$CFLAGS -ffreestanding -nostdlib"
> +
>  AC_CONFIG_AUX_DIR([build-aux])
>  AM_INIT_AUTOMAKE(
> @@ -79,7 +82,12 @@ AC_SUBST([systype])
>  #
>  AC_PROG_AWK
> +# Temporarily force cross compiling mode to make sure the configure script
> +# does not try to run compiled binaries.
> +save_cross_compiling=$cross_compiling
> +cross_compiling=yes
>  AM_PROG_AS
> +cross_compiling=$save_cross_compiling
>  AC_PROG_CC
>  AC_PROG_CPP
>  AC_PROG_INSTALL
> -- 
> 2.39.0
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.