[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH gnumach] Use c_string to define host_get_kernel_version and h
From: |
Samuel Thibault |
Subject: |
Re: [PATCH gnumach] Use c_string to define host_get_kernel_version and host_get_kernel_boot_info. |
Date: |
Mon, 13 Mar 2023 20:32:00 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Hello,
Flavio Cruz, le lun. 13 mars 2023 01:41:57 -0400, a ecrit:
> The existing definitions for kernel_version_t and kernel_boot_info_t use
> (MACH_MSG_TYPE_STRING, length*8) which result in message types that have
> a single element of 512 or 4096 bytes (set as msgt_size). This results
> in MiG generating mach_msg_type_long_t. Using c_string has the benefit
> of moving this size to be defined as msgt_number which doesn't overflow.
> This will allow us to simplify the 64 bit RPC ABI since all msgt_size can
> be defined with just 8 bits (as it should be expected).
>
> The resulting implementation is the same but we still need to define new
> RPCs since server and user expect different mach_msg_type_t.
Applied, thanks!
The hurd repository will want an update to host_get_kernel_version :)
It seems that default_pager_filename_t (in default_pager_paging_file),
symtab_name_t (in host_load_symbol_table), and dev_name_t (in
device_open) are also using MACH_MSG_TYPE_STRING_C?
Samuel
> ---
> doc/mach.texi | 8 ++++----
> include/mach/mach_host.defs | 16 ++++++++++++++++
> include/mach/mach_types.defs | 4 ++++
> kern/host.c | 8 ++++++++
> kern/machine.c | 8 ++++++++
> 5 files changed, 40 insertions(+), 4 deletions(-)
>
> diff --git a/doc/mach.texi b/doc/mach.texi
> index 3fdba3fc..2c22fa38 100644
> --- a/doc/mach.texi
> +++ b/doc/mach.texi
> @@ -5577,8 +5577,8 @@ The minimum quantum and unit of quantum in milliseconds.
> This is a pointer to a @code{struct host_sched_info}.
> @end deftp
>
> -@deftypefun kern_return_t host_kernel_version (@w{host_t @var{host}},
> @w{kernel_version_t *@var{version}})
> -The @code{host_kernel_version} function returns the version string
> +@deftypefun kern_return_t host_get_kernel_version (@w{host_t @var{host}},
> @w{kernel_version_t *@var{version}})
> +The @code{host_get_kernel_version} function returns the version string
> compiled into the kernel executing on @var{host} at the time it was
> built in the character string @var{version}. This string describes the
> version of the kernel. The constant @code{KERNEL_VERSION_MAX} should be
> @@ -5595,8 +5595,8 @@ inaccessible memory, it returns
> @code{KERN_INVALID_ADDRESS}, and
> @code{KERN_SUCCESS} otherwise.
> @end deftypefun
>
> -@deftypefun kern_return_t host_get_boot_info (@w{host_priv_t
> @var{host_priv}}, @w{kernel_boot_info_t @var{boot_info}})
> -The @code{host_get_boot_info} function returns the boot-time information
> +@deftypefun kern_return_t host_get_kernel_boot_info (@w{host_priv_t
> @var{host_priv}}, @w{kernel_boot_info_t @var{boot_info}})
> +The @code{host_get_kernel_boot_info} function returns the boot-time
> information
> string supplied by the operator to the kernel executing on
> @var{host_priv} in the character string @var{boot_info}. The constant
> @code{KERNEL_BOOT_INFO_MAX} should be used to dimension storage for the
> diff --git a/include/mach/mach_host.defs b/include/mach/mach_host.defs
> index 223f4576..99b48b4b 100644
> --- a/include/mach/mach_host.defs
> +++ b/include/mach/mach_host.defs
> @@ -163,6 +163,7 @@ routine task_get_assignment(
>
> /*
> * Get string describing current kernel version.
> + * Deprecated, use host_get_kernel_version.
> */
> routine host_kernel_version(
> host : host_t;
> @@ -348,6 +349,7 @@ routine processor_control(
>
> /*
> * Get boot configuration information from kernel.
> + * Deprecated, use host_get_kernel_boot_info.
> */
> routine host_get_boot_info(
> host_priv : host_priv_t;
> @@ -378,3 +380,17 @@ routine host_adjust_time64(
> host_priv : host_priv_t;
> in new_adjustment : time_value64_t;
> out old_adjustment : time_value64_t);
> +
> +/*
> + * Get string describing current kernel version.
> + */
> +routine host_get_kernel_version(
> + host : host_t;
> + out kernel_version : new_kernel_version_t);
> +
> +/*
> + * Get boot configuration information from kernel.
> + */
> +routine host_get_kernel_boot_info(
> + host_priv : host_priv_t;
> + out boot_info : new_kernel_boot_info_t);
> diff --git a/include/mach/mach_types.defs b/include/mach/mach_types.defs
> index 8f22137a..e02e3e8a 100644
> --- a/include/mach/mach_types.defs
> +++ b/include/mach/mach_types.defs
> @@ -256,8 +256,12 @@ type processor_set_name_array_t = ^array[] of
> processor_set_name_t;
> type processor_set_info_t = array[*:1024] of integer_t;
>
> type kernel_version_t = (MACH_MSG_TYPE_STRING, 512*8);
> +type new_kernel_version_t = c_string[512]
> + ctype: kernel_version_t;
>
> type kernel_boot_info_t = (MACH_MSG_TYPE_STRING, 4096*8);
> +type new_kernel_boot_info_t = c_string[4096]
> + ctype: kernel_boot_info_t;
>
> type rpc_time_value_t = struct {
> rpc_long_integer_t seconds;
> diff --git a/kern/host.c b/kern/host.c
> index 7ce8edff..50f58e9c 100644
> --- a/kern/host.c
> +++ b/kern/host.c
> @@ -219,6 +219,14 @@ kern_return_t host_kernel_version(
> return KERN_SUCCESS;
> }
>
> +/* Same as above */
> +kern_return_t host_get_kernel_version(
> + const host_t host,
> + kernel_version_t out_version)
> +{
> + return host_kernel_version(host, out_version);
> +}
> +
> /*
> * host_processor_sets:
> *
> diff --git a/kern/machine.c b/kern/machine.c
> index bf9677c9..c9e368a0 100644
> --- a/kern/machine.c
> +++ b/kern/machine.c
> @@ -674,3 +674,11 @@ host_get_boot_info(
> (void) strncpy(boot_info, src, KERNEL_BOOT_INFO_MAX);
> return KERN_SUCCESS;
> }
> +
> +kern_return_t
> +host_get_kernel_boot_info(
> + host_t priv_host,
> + kernel_boot_info_t boot_info)
> +{
> + return host_get_boot_info(priv_host, boot_info);
> +}
> --
> 2.39.2
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.