Re: [PATCH] Include mig generated headers to avoid warnings with -Wmissing-prototypes.

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

Flavio Cruz, le mar. 17 janv. 2023 23:56:04 -0500, a ecrit:
> diff --git a/ddb/db_aout.c b/ddb/db_aout.c
> index 8f344d6d..7b769c1c 100644
> --- a/ddb/db_aout.c
> +++ b/ddb/db_aout.c
> @@ -75,7 +75,7 @@ aout_db_sym_init(
>   char *  esymtab,/* pointer to end of string table,
>  for checking - may be rounded up to
>  integer boundary */
> - char *  name,
> + const char *name,
>   char *  task_addr)  /* use for this task only */
>  {
>   struct nlist*sym_start, *sym_end;

Heh, right, this is now getting the const qualifier :)

> diff --git a/ddb/db_ext_symtab.c b/ddb/db_ext_symtab.c
> index 9c89fb95..db7bec25 100644
> --- a/ddb/db_ext_symtab.c
> +++ b/ddb/db_ext_symtab.c
> @@ -35,7 +35,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
>  
> @@ -50,7 +50,7 @@ kern_return_t
>  host_load_symbol_table(
>   host_t  host,
>   task_t  task,
> - char *  name,
> + const char *name,
>   pointer_t   symtab,
>   unsigned intsymtab_count)
>  {
> diff --git a/ddb/db_sym.c b/ddb/db_sym.c
> index d205ff74..a247b645 100644
> --- a/ddb/db_sym.c
> +++ b/ddb/db_sym.c
> @@ -60,7 +60,7 @@ db_add_symbol_table(
>   int  type,
>   char *start,
>   char *end,
> - char *name,
> + const char *name,
>   char *ref,
>   char *map_pointer)
>  {
> @@ -506,7 +506,7 @@ void db_free_symbol(db_sym_t s)
>   */
>  
>  static void dummy_db_free_symbol(db_sym_t symbol) { }
> -static boolean_t dummy_db_sym_init(char *a, char *b, char *c, char *d) {
> +static boolean_t dummy_db_sym_init(char *a, char *b, const char *c, char *d) 
> {
>return FALSE;
>  }
>  
> diff --git a/ddb/db_sym.h b/ddb/db_sym.h
> index 8b586996..bc8a10dd 100644
> --- a/ddb/db_sym.h
> +++ b/ddb/db_sym.h
> @@ -94,7 +94,7 @@ extern boolean_tdb_qualify_ambiguous_names;
>  extern boolean_t db_add_symbol_table(int type,
>   char * start,
>   char * end,
> - char *name,
> + const char *name,
>   char *ref,
>   char *map_pointer );
>  
> @@ -186,7 +186,7 @@ extern struct db_sym_switch {
>   boolean_t   (*init)(
>   char *start,
>   char *end,
> - char *name,
> + const char *name,
>   char *task_addr
>   );
>  
> @@ -241,7 +241,7 @@ extern boolean_t db_line_at_pc(
>  extern boolean_t aout_db_sym_init(
>   char *symtab,
>   char *esymtab,
> - char *name,
> + const char *name,
>   char *task_addr);
>  
>  extern boolean_t elf_db_sym_init (
> diff --git a/ipc/mach_debug.c b/ipc/mach_debug.c
> index 57c3133a..7dca4b6b 100644
> --- a/ipc/mach_debug.c
> +++ b/ipc/mach_debug.c
> @@ -41,7 +41,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/ipc/mach_port.c b/ipc/mach_port.c
> index 67713a50..b35d8bcf 100644
> --- a/ipc/mach_port.c
> +++ b/ipc/mach_port.c
> @@ -60,6 +60,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  
>  /*
> diff --git a/ipc/mach_port.h b/ipc/mach_port.h
> index ec260b31..e91e4952 100644
> --- a/ipc/mach_port.h
> +++ b/ipc/mach_port.h
> @@ -34,136 +34,4 @@
>  void db_debug_port_references (boolean_t enable);
>  #endif   /* MACH_KDB */
>  
> -/* RPCs */
> -
> -extern kern_return_t
> -mach_port_allocate_name (
> -ipc_space_t space,
> -mach_port_right_t right,
> -mach_port_name_t name);
> -
> -extern kern_return_t
> -mach_port_allocate (
> -ipc_space_t space,
> -mach_port_right_t right,
> -mach_port_name_t *namep);
> -
> -extern kern_return_t
> -mach_port_destroy(
> -ipc_space_t space,
> -mach_port_name_t name);
> -
> -extern kern_return_t
> -mach_port_deallocate(
> -ipc_space_t space,
> -mach_port_name_t name);
> -
> -extern kern_return_t
> -mach_port_insert_right(
> -ipc_space_t space,
> -mach_port_name_t name,
> -ipc_port_t  poly,
> -mach_msg_type_name_tpolyPoly);
> -
> -kern_return_t
> -mach_port_get_receive_status(
> - ipc_space_t space,
> - mach_port_name_tname,
> - mach_port_status_t  *statusp);
> -
> -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,
> 

Re: [PATCH v2 rumpkernel] pci-userspace: Add acpi lookup of irqs with fallback

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

Damien Zammit, le mer. 18 janv. 2023 07:36:18 +, a ecrit:
> ---
>  debian/patches/acpi.diff | 78 
>  debian/patches/series|  1 +
>  2 files changed, 79 insertions(+)
>  create mode 100644 debian/patches/acpi.diff
> 
> diff --git a/debian/patches/acpi.diff b/debian/patches/acpi.diff
> new file mode 100644
> index 0..3ee6d2151
> --- /dev/null
> +++ b/debian/patches/acpi.diff
> @@ -0,0 +1,78 @@
> +--- a/pci-userspace/src-gnu/Makefile.inc
>  b/pci-userspace/src-gnu/Makefile.inc
> +@@ -3,7 +3,7 @@
> + PCIDIR:=${.PARSEDIR}
> + .PATH:  ${PCIDIR}
> +
> +-RUMPCOMP_USER_SRCS= pci_user-gnu.c mach_debugUser.c
> ++RUMPCOMP_USER_SRCS= pci_user-gnu.c mach_debugUser.c acpiUser.c
> + RUMPCOMP_USER_CPPFLAGS+=-I${PCIDIR} -I${DESTDIR}/usr/include
> + RUMPCOMP_CPPFLAGS+= -I${PCIDIR} -I${DESTDIR}/usr/include
> + CPPFLAGS+=  -I${PCIDIR}
> +@@ -16,3 +16,11 @@
> + -user mach_debugUser.c \
> + -server /dev/null \
> + -header mach_debug_U.h
> ++
> ++acpiUser.c:
> ++echo '#include ' \
> ++| ${CC} -E -x c - -o - \
> ++| mig -cc cat - /dev/null -subrprefix __ \
> ++-user acpiUser.c \
> ++-server /dev/null \
> ++-header acpi_U.h
> +--- a/pci-userspace/src-gnu/pci_user-gnu.c
>  b/pci-userspace/src-gnu/pci_user-gnu.c
> +@@ -67,6 +67,7 @@
> + #include 
> + #include 
> + #include "mach_debug_U.h"
> ++#include "acpi_U.h"
> + #include 
> + #include 
> +
> +@@ -90,6 +91,7 @@
> + static mach_port_t master_host;
> + static mach_port_t master_device;
> + static device_t irq_dev;
> ++static device_t acpi_dev;
> +
> + #define PCI_CFG1_START 0xcf8
> + #define PCI_CFG1_END   0xcff
> +@@ -130,6 +132,12 @@
> + if (device_open (master_device, D_READ, "irq", _dev))
> + err(2, "device_open irq");
> +
> ++/* Optional */
> ++if (device_open (master_device, D_READ, "acpi", _dev)) {
> ++MACH_PRINT("device_open acpi failed... continue\n");
> ++acpi_dev = MACH_PORT_NULL;
> ++}
> ++
> + pci_system_init ();
> + struct pci_device_iterator *dev_iter;
> + struct pci_device *pci_dev;
> +@@ -363,6 +371,7 @@
> + rumpcomp_pci_irq_map(unsigned bus, unsigned dev, unsigned fun,
> + int intrline, unsigned cookie)
> + {
> ++int ret;
> + struct irq *irq;
> + irq = malloc(sizeof(*irq));
> + if (irq == NULL)
> +@@ -374,6 +383,15 @@
> + irq->fun = fun;
> + irq->intrline = intrline;
> +
> ++/* We can do better by reading irq from acpi device, but with fallback 
> */
> ++if (acpi_dev != MACH_PORT_NULL) {
> ++ret = acpi_get_pci_irq (acpi_dev, bus, dev, fun, 
> >intrline);
> ++if (ret) {
> ++MACH_PRINT("acpi_get_pci_irq failed, continue with 
> intrline\n");
> ++irq->intrline = intrline;
> ++}
> ++}
> ++
> + pthread_mutex_lock();
> + LIST_INSERT_HEAD(, irq, entries);
> + pthread_mutex_unlock();
> diff --git a/debian/patches/series b/debian/patches/series
> index 5654d3549..adbc5acb9 100644
> --- a/debian/patches/series
> +++ b/debian/patches/series
> @@ -14,3 +14,4 @@ pci-userspace-rump.diff
>  rumpuser-evcnt.diff
>  ps-comm.diff
>  idtype_t.diff
> +acpi.diff
> --
> 2.34.1
> 
> 
> 

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



Re: [PATCH] Fix some compiler warnings

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

Svante Signell, le mer. 18 janv. 2023 13:29:48 +0100, a ecrit:
> On Wed, 2023-01-18 at 12:27 +0100, Samuel Thibault wrote:
> > Svante Signell, le mer. 18 janv. 2023 11:59:40 +0100, a ecrit:
> > > On Wed, 2023-01-18 at 02:02 +0100, Samuel Thibault wrote:
> > > > Hello,
> > > > 
> > > > 
> > > > But conversely when we'll build it in 64bit, vm_page_size
> > > > (actually uintptr_t) will be an unsigned long.
> > > > 
> > > > This needs to be fixed the *proper* way: either use the PRIuPTR
> > > > macro, or cast the value into unsigned long.
> > > 
> > > Now cast to an unsigned long, new patch attached.
> > 
> > I only took the ext2fs.c part for an example, but it's the same for
> > all other files.
> 
> I've changed to (unsigned long) everywhere.
> 
> (There is also debug code not triggered by normal build needing fixes).
> 
> Thanks!
> 

> Index: hurd-0.9.git20221224/ext2fs/ext2fs.c
> ===
> --- hurd-0.9.git20221224.orig/ext2fs/ext2fs.c
> +++ hurd-0.9.git20221224/ext2fs/ext2fs.c
> @@ -233,7 +233,7 @@ main (int argc, char **argv)
>  ext2_panic ("device too small for superblock (%Ld bytes)", store->size);
>if (store->log2_blocks_per_page < 0)
>  ext2_panic ("device block size (%zu) greater than page size (%lu)",
> - store->block_size, vm_page_size);
> + store->block_size, (unsigned long)vm_page_size);
>  
>/* Map the entire disk. */
>create_disk_pager ();
> Index: hurd-0.9.git20221224/ext2fs/dir.c
> ===
> --- hurd-0.9.git20221224.orig/ext2fs/dir.c
> +++ hurd-0.9.git20221224/ext2fs/dir.c
> @@ -417,7 +417,7 @@ dirscanblock (vm_address_t blockaddr, st
>   {
> ext2_warning ("bad directory entry: inode: %Ld offset: %lu",
>   dp->cache_id,
> - currentoff - blockaddr + idx * DIRBLKSIZ);
> + (unsigned long)(currentoff - blockaddr + idx * 
> DIRBLKSIZ));
> return ENOENT;
>   }
>  
> Index: hurd-0.9.git20221224/libpager/data-request.c
> ===
> --- hurd-0.9.git20221224.orig/libpager/data-request.c
> +++ hurd-0.9.git20221224/libpager/data-request.c
> @@ -49,7 +49,7 @@ _pager_S_memory_object_data_request (str
>  }
>if (length != __vm_page_size)
>  {
> -  printf ("incg data request: bad length size %lu\n", length);
> +  printf ("incg data request: bad length size %lu\n", (unsigned 
> long)length);
>goto release_out;
>  }
>if (offset % __vm_page_size)
> Index: hurd-0.9.git20221224/libpager/data-return.c
> ===
> --- hurd-0.9.git20221224.orig/libpager/data-return.c
> +++ hurd-0.9.git20221224/libpager/data-return.c
> @@ -60,7 +60,7 @@ _pager_do_write_request (struct pager *p
>  }
>if (length % __vm_page_size)
>  {
> -  printf ("incg data return: bad length size %lu\n", length);
> +  printf ("incg data return: bad length size %lu\n", (unsigned 
> long)length);
>goto release_out;
>  }
>if (offset % __vm_page_size)
> Index: hurd-0.9.git20221224/libpager/data-unlock.c
> ===
> --- hurd-0.9.git20221224.orig/libpager/data-unlock.c
> +++ hurd-0.9.git20221224/libpager/data-unlock.c
> @@ -58,7 +58,7 @@ _pager_S_memory_object_data_unlock (stru
>  }
>if (length != __vm_page_size)
>  {
> -  printf ("incg data unlock: bad length size %lu\n", length);
> +  printf ("incg data unlock: bad length size %lu\n", (unsigned 
> long)length);
>goto out;
>  }
>  
> Index: hurd-0.9.git20221224/ext2fs/pager.c
> ===
> --- hurd-0.9.git20221224.orig/ext2fs/pager.c
> +++ hurd-0.9.git20221224/ext2fs/pager.c
> @@ -643,7 +643,7 @@ pager_unlock_page (struct user_pager_inf
>   ext2_warning ("This filesystem is out of space.");
>else if (err)
>   ext2_warning ("inode=%Ld, page=0x%lx: %s",
> -   node->cache_id, page, strerror (err));
> +   node->cache_id, (unsigned long)page, strerror (err));
>  
>return err;
>  }
> @@ -906,7 +906,7 @@ disk_cache_init (void)
>  {
>if (block_size != vm_page_size)
>  ext2_panic ("Block size %u != vm_page_size %lu",
> - block_size, vm_page_size);
> + block_size, (unsigned long)vm_page_size);
>  
>pthread_mutex_init (_cache_lock, NULL);
>pthread_cond_init (_cache_reassociation, NULL);
> Index: hurd-0.9.git20221224/mach-defpager/main.c
> ===
> --- hurd-0.9.git20221224.orig/mach-defpager/main.c
> +++ hurd-0.9.git20221224/mach-defpager/main.c
> @@ -43,6 +43,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  /* XXX */
>  


-- 
Samuel
---

Re: [PATCH] Fix some compiler warnings

2023-01-18 Thread Svante Signell
On Wed, 2023-01-18 at 12:27 +0100, Samuel Thibault wrote:
> Svante Signell, le mer. 18 janv. 2023 11:59:40 +0100, a ecrit:
> > On Wed, 2023-01-18 at 02:02 +0100, Samuel Thibault wrote:
> > > Hello,
> > > 
> > > 
> > > But conversely when we'll build it in 64bit, vm_page_size
> > > (actually uintptr_t) will be an unsigned long.
> > > 
> > > This needs to be fixed the *proper* way: either use the PRIuPTR
> > > macro, or cast the value into unsigned long.
> > 
> > Now cast to an unsigned long, new patch attached.
> 
> I only took the ext2fs.c part for an example, but it's the same for
> all other files.

I've changed to (unsigned long) everywhere.

(There is also debug code not triggered by normal build needing fixes).

Thanks!

Index: hurd-0.9.git20221224/ext2fs/ext2fs.c
===
--- hurd-0.9.git20221224.orig/ext2fs/ext2fs.c
+++ hurd-0.9.git20221224/ext2fs/ext2fs.c
@@ -233,7 +233,7 @@ main (int argc, char **argv)
 ext2_panic ("device too small for superblock (%Ld bytes)", store->size);
   if (store->log2_blocks_per_page < 0)
 ext2_panic ("device block size (%zu) greater than page size (%lu)",
-		store->block_size, vm_page_size);
+		store->block_size, (unsigned long)vm_page_size);
 
   /* Map the entire disk. */
   create_disk_pager ();
Index: hurd-0.9.git20221224/ext2fs/dir.c
===
--- hurd-0.9.git20221224.orig/ext2fs/dir.c
+++ hurd-0.9.git20221224/ext2fs/dir.c
@@ -417,7 +417,7 @@ dirscanblock (vm_address_t blockaddr, st
 	{
 	  ext2_warning ("bad directory entry: inode: %Ld offset: %lu",
 			dp->cache_id,
-			currentoff - blockaddr + idx * DIRBLKSIZ);
+			(unsigned long)(currentoff - blockaddr + idx * DIRBLKSIZ));
 	  return ENOENT;
 	}
 
Index: hurd-0.9.git20221224/libpager/data-request.c
===
--- hurd-0.9.git20221224.orig/libpager/data-request.c
+++ hurd-0.9.git20221224/libpager/data-request.c
@@ -49,7 +49,7 @@ _pager_S_memory_object_data_request (str
 }
   if (length != __vm_page_size)
 {
-  printf ("incg data request: bad length size %lu\n", length);
+  printf ("incg data request: bad length size %lu\n", (unsigned long)length);
   goto release_out;
 }
   if (offset % __vm_page_size)
Index: hurd-0.9.git20221224/libpager/data-return.c
===
--- hurd-0.9.git20221224.orig/libpager/data-return.c
+++ hurd-0.9.git20221224/libpager/data-return.c
@@ -60,7 +60,7 @@ _pager_do_write_request (struct pager *p
 }
   if (length % __vm_page_size)
 {
-  printf ("incg data return: bad length size %lu\n", length);
+  printf ("incg data return: bad length size %lu\n", (unsigned long)length);
   goto release_out;
 }
   if (offset % __vm_page_size)
Index: hurd-0.9.git20221224/libpager/data-unlock.c
===
--- hurd-0.9.git20221224.orig/libpager/data-unlock.c
+++ hurd-0.9.git20221224/libpager/data-unlock.c
@@ -58,7 +58,7 @@ _pager_S_memory_object_data_unlock (stru
 }
   if (length != __vm_page_size)
 {
-  printf ("incg data unlock: bad length size %lu\n", length);
+  printf ("incg data unlock: bad length size %lu\n", (unsigned long)length);
   goto out;
 }
 
Index: hurd-0.9.git20221224/ext2fs/pager.c
===
--- hurd-0.9.git20221224.orig/ext2fs/pager.c
+++ hurd-0.9.git20221224/ext2fs/pager.c
@@ -643,7 +643,7 @@ pager_unlock_page (struct user_pager_inf
 	ext2_warning ("This filesystem is out of space.");
   else if (err)
 	ext2_warning ("inode=%Ld, page=0x%lx: %s",
-		  node->cache_id, page, strerror (err));
+		  node->cache_id, (unsigned long)page, strerror (err));
 
   return err;
 }
@@ -906,7 +906,7 @@ disk_cache_init (void)
 {
   if (block_size != vm_page_size)
 ext2_panic ("Block size %u != vm_page_size %lu",
-		block_size, vm_page_size);
+		block_size, (unsigned long)vm_page_size);
 
   pthread_mutex_init (_cache_lock, NULL);
   pthread_cond_init (_cache_reassociation, NULL);
Index: hurd-0.9.git20221224/mach-defpager/main.c
===
--- hurd-0.9.git20221224.orig/mach-defpager/main.c
+++ hurd-0.9.git20221224/mach-defpager/main.c
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 /* XXX */
 


Re: [PATCH] Add libraries to Makefiles.

2023-01-18 Thread Samuel Thibault
Svante Signell, le mer. 18 janv. 2023 12:36:55 +0100, a ecrit:
> On Wed, 2023-01-18 at 11:54 +0100, Samuel Thibault wrote:
> > 
> > Then you need to check that the linking of e.g. storeio does use the
> > shared library and not the static library. For instance you can re-run
> > the corresponding linking command and add -Wl,-verbose to check in the
> > verbose output which precise libstore file it takes.
> 
> 
> /cross-tools/bin/i686-pc-gnu-gcc -L. -L../libbpf/ -L../libcons/ -
> L../libdiskfs/ -L../libfshelp/ -L../libftpconn/ -L../libhurdbugaddr/ -
> L../libhurd-slab/ -L../libihash/ -L../libiohelp/ -L../libmachdev/ -
> L../libnetfs/ -L../libpager/ -L../libpipe/ -L../libports/ -L../libps/ -
> L../libshouldbeinlibc/ -L../libstore/ -L../libtrivfs/ -Wl,-rpath-
> link=../libbpf/ -Wl,-rpath-link=../libcons/ -Wl,-rpath-
> link=../libdiskfs/ -Wl,-rpath-link=../libfshelp/ -Wl,-rpath-
> link=../libftpconn/ -Wl,-rpath-link=../libhurdbugaddr/ -Wl,-rpath-
> link=../libhurd-slab/ -Wl,-rpath-link=../libihash/ -Wl,-rpath-
> link=../libiohelp/ -Wl,-rpath-link=../libmachdev/ -Wl,-rpath-
> link=../libnetfs/ -Wl,-rpath-link=../libpager/ -Wl,-rpath-
> link=../libpipe/ -Wl,-rpath-link=../libports/ -Wl,-rpath-link=../libps/
> -Wl,-rpath-link=../libshouldbeinlibc/ -Wl,-rpath-link=../libstore/ -
> Wl,-rpath-link=../libtrivfs/ -std=gnu99 -fgnu89-inline -Wall -g -O3 -
> fno-strict-aliasing  -g -O2  -Wl,-verbose,-L/tools/lib -lblkid -luuid -
> lz -lncursesw -ltinfow -ldl  -uargp_program_bug_address -o storeio \
>   dev.o storeio.o open.o pager.o io.o \
>   '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so
> ../libtrivfs/libtrivfs.so ../libpager/libpager.so
> ../libfshelp/libfshelp.so ../libiohelp/libiohelp.so
> ../libstore/libstore.so ../libports/libports.so ../libihash/libihash.so
> ../libshouldbeinlibc/libshouldbeinlibc.so \
> -lpthread -lz \
>   '-Wl,-)'
> ...
> 
> attempt to open /tools/lib/libz.so succeeded
> /tools/lib/libz.so

I'm not talking about libz.so, but about libstore.so. Is that
libstore.so really a shared library that has libz in NEEDED? If so there
is really no need to add -lz to linking storeio. Unless you actually
send us the actual error message you get without an explicit -lz, we
can't know why you'd have to add -lz.

Samuel



Re: [PATCH] Add libraries to Makefiles.

2023-01-18 Thread Svante Signell
On Wed, 2023-01-18 at 11:54 +0100, Samuel Thibault wrote:
> 
> Then you need to check that the linking of e.g. storeio does use the
> shared library and not the static library. For instance you can re-run
> the corresponding linking command and add -Wl,-verbose to check in the
> verbose output which precise libstore file it takes.


/cross-tools/bin/i686-pc-gnu-gcc -L. -L../libbpf/ -L../libcons/ -
L../libdiskfs/ -L../libfshelp/ -L../libftpconn/ -L../libhurdbugaddr/ -
L../libhurd-slab/ -L../libihash/ -L../libiohelp/ -L../libmachdev/ -
L../libnetfs/ -L../libpager/ -L../libpipe/ -L../libports/ -L../libps/ -
L../libshouldbeinlibc/ -L../libstore/ -L../libtrivfs/ -Wl,-rpath-
link=../libbpf/ -Wl,-rpath-link=../libcons/ -Wl,-rpath-
link=../libdiskfs/ -Wl,-rpath-link=../libfshelp/ -Wl,-rpath-
link=../libftpconn/ -Wl,-rpath-link=../libhurdbugaddr/ -Wl,-rpath-
link=../libhurd-slab/ -Wl,-rpath-link=../libihash/ -Wl,-rpath-
link=../libiohelp/ -Wl,-rpath-link=../libmachdev/ -Wl,-rpath-
link=../libnetfs/ -Wl,-rpath-link=../libpager/ -Wl,-rpath-
link=../libpipe/ -Wl,-rpath-link=../libports/ -Wl,-rpath-link=../libps/
-Wl,-rpath-link=../libshouldbeinlibc/ -Wl,-rpath-link=../libstore/ -
Wl,-rpath-link=../libtrivfs/ -std=gnu99 -fgnu89-inline -Wall -g -O3 -
fno-strict-aliasing  -g -O2  -Wl,-verbose,-L/tools/lib -lblkid -luuid -
lz -lncursesw -ltinfow -ldl  -uargp_program_bug_address -o storeio \
  dev.o storeio.o open.o pager.o io.o \
  '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so
../libtrivfs/libtrivfs.so ../libpager/libpager.so
../libfshelp/libfshelp.so ../libiohelp/libiohelp.so
../libstore/libstore.so ../libports/libports.so ../libihash/libihash.so
../libshouldbeinlibc/libshouldbeinlibc.so \
-lpthread -lz \
  '-Wl,-)'
...

attempt to open /tools/lib/libz.so succeeded
/tools/lib/libz.so

Same stuff when linking other executables, e.g. pflocal, pfinet, etc





Re: [PATCH] Fix some compiler warnings

2023-01-18 Thread Samuel Thibault
Svante Signell, le mer. 18 janv. 2023 11:59:40 +0100, a ecrit:
> On Wed, 2023-01-18 at 02:02 +0100, Samuel Thibault wrote:
> > Hello,
> > 
> > 
> > But conversely when we'll build it in 64bit, vm_page_size (actually
> > uintptr_t) will be an unsigned long.
> > 
> > This needs to be fixed the *proper* way: either use the PRIuPTR
> > macro, or cast the value into unsigned long.
> 
> Now cast to an unsigned long, new patch attached.

I only took the ext2fs.c part for an example, but it's the same for all
other files.

Samuel

> Index: hurd-0.9.git20221224/ext2fs/ext2fs.c
> ===
> --- hurd-0.9.git20221224.orig/ext2fs/ext2fs.c
> +++ hurd-0.9.git20221224/ext2fs/ext2fs.c
> @@ -233,7 +233,7 @@ main (int argc, char **argv)
>  ext2_panic ("device too small for superblock (%Ld bytes)", store->size);
>if (store->log2_blocks_per_page < 0)
>  ext2_panic ("device block size (%zu) greater than page size (%lu)",
> - store->block_size, vm_page_size);
> + store->block_size, (unsigned long)vm_page_size);
>  
>/* Map the entire disk. */
>create_disk_pager ();
> Index: hurd-0.9.git20221224/ext2fs/dir.c
> ===
> --- hurd-0.9.git20221224.orig/ext2fs/dir.c
> +++ hurd-0.9.git20221224/ext2fs/dir.c
> @@ -415,7 +415,7 @@ dirscanblock (vm_address_t blockaddr, st
> || EXT2_DIR_REC_LEN (entry->name_len) > le16toh (entry->rec_len)
> || memchr (entry->name, '\0', entry->name_len))
>   {
> -   ext2_warning ("bad directory entry: inode: %Ld offset: %lu",
> +   ext2_warning ("bad directory entry: inode: %Ld offset: %u",
>   dp->cache_id,
>   currentoff - blockaddr + idx * DIRBLKSIZ);
> return ENOENT;
> Index: hurd-0.9.git20221224/libpager/data-request.c
> ===
> --- hurd-0.9.git20221224.orig/libpager/data-request.c
> +++ hurd-0.9.git20221224/libpager/data-request.c
> @@ -49,7 +49,7 @@ _pager_S_memory_object_data_request (str
>  }
>if (length != __vm_page_size)
>  {
> -  printf ("incg data request: bad length size %lu\n", length);
> +  printf ("incg data request: bad length size %u\n", length);
>goto release_out;
>  }
>if (offset % __vm_page_size)
> Index: hurd-0.9.git20221224/libpager/data-return.c
> ===
> --- hurd-0.9.git20221224.orig/libpager/data-return.c
> +++ hurd-0.9.git20221224/libpager/data-return.c
> @@ -60,7 +60,7 @@ _pager_do_write_request (struct pager *p
>  }
>if (length % __vm_page_size)
>  {
> -  printf ("incg data return: bad length size %lu\n", length);
> +  printf ("incg data return: bad length size %u\n", length);
>goto release_out;
>  }
>if (offset % __vm_page_size)
> Index: hurd-0.9.git20221224/libpager/data-unlock.c
> ===
> --- hurd-0.9.git20221224.orig/libpager/data-unlock.c
> +++ hurd-0.9.git20221224/libpager/data-unlock.c
> @@ -58,7 +58,7 @@ _pager_S_memory_object_data_unlock (stru
>  }
>if (length != __vm_page_size)
>  {
> -  printf ("incg data unlock: bad length size %lu\n", length);
> +  printf ("incg data unlock: bad length size %u\n", length);
>goto out;
>  }
>  
> Index: hurd-0.9.git20221224/ext2fs/pager.c
> ===
> --- hurd-0.9.git20221224.orig/ext2fs/pager.c
> +++ hurd-0.9.git20221224/ext2fs/pager.c
> @@ -642,7 +642,7 @@ pager_unlock_page (struct user_pager_inf
>if (err == ENOSPC)
>   ext2_warning ("This filesystem is out of space.");
>else if (err)
> - ext2_warning ("inode=%Ld, page=0x%lx: %s",
> + ext2_warning ("inode=%Ld, page=0x%x: %s",
> node->cache_id, page, strerror (err));
>  
>return err;
> @@ -905,7 +905,7 @@ static void
>  disk_cache_init (void)
>  {
>if (block_size != vm_page_size)
> -ext2_panic ("Block size %u != vm_page_size %lu",
> +ext2_panic ("Block size %u != vm_page_size %u",
>   block_size, vm_page_size);
>  
>pthread_mutex_init (_cache_lock, NULL);
> Index: hurd-0.9.git20221224/mach-defpager/main.c
> ===
> --- hurd-0.9.git20221224.orig/mach-defpager/main.c
> +++ hurd-0.9.git20221224/mach-defpager/main.c
> @@ -43,6 +43,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  /* XXX */
>  


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



Re: [PATCH] Fix some compiler warnings

2023-01-18 Thread Svante Signell
On Wed, 2023-01-18 at 02:02 +0100, Samuel Thibault wrote:
> Hello,
> 
> 
> But conversely when we'll build it in 64bit, vm_page_size (actually
> uintptr_t) will be an unsigned long.
> 
> This needs to be fixed the *proper* way: either use the PRIuPTR
> macro, or cast the value into unsigned long.

Now cast to an unsigned long, new patch attached.

Thanks!
Index: hurd-0.9.git20221224/ext2fs/ext2fs.c
===
--- hurd-0.9.git20221224.orig/ext2fs/ext2fs.c
+++ hurd-0.9.git20221224/ext2fs/ext2fs.c
@@ -233,7 +233,7 @@ main (int argc, char **argv)
 ext2_panic ("device too small for superblock (%Ld bytes)", store->size);
   if (store->log2_blocks_per_page < 0)
 ext2_panic ("device block size (%zu) greater than page size (%lu)",
-		store->block_size, vm_page_size);
+		store->block_size, (unsigned long)vm_page_size);
 
   /* Map the entire disk. */
   create_disk_pager ();
Index: hurd-0.9.git20221224/ext2fs/dir.c
===
--- hurd-0.9.git20221224.orig/ext2fs/dir.c
+++ hurd-0.9.git20221224/ext2fs/dir.c
@@ -415,7 +415,7 @@ dirscanblock (vm_address_t blockaddr, st
 	  || EXT2_DIR_REC_LEN (entry->name_len) > le16toh (entry->rec_len)
 	  || memchr (entry->name, '\0', entry->name_len))
 	{
-	  ext2_warning ("bad directory entry: inode: %Ld offset: %lu",
+	  ext2_warning ("bad directory entry: inode: %Ld offset: %u",
 			dp->cache_id,
 			currentoff - blockaddr + idx * DIRBLKSIZ);
 	  return ENOENT;
Index: hurd-0.9.git20221224/libpager/data-request.c
===
--- hurd-0.9.git20221224.orig/libpager/data-request.c
+++ hurd-0.9.git20221224/libpager/data-request.c
@@ -49,7 +49,7 @@ _pager_S_memory_object_data_request (str
 }
   if (length != __vm_page_size)
 {
-  printf ("incg data request: bad length size %lu\n", length);
+  printf ("incg data request: bad length size %u\n", length);
   goto release_out;
 }
   if (offset % __vm_page_size)
Index: hurd-0.9.git20221224/libpager/data-return.c
===
--- hurd-0.9.git20221224.orig/libpager/data-return.c
+++ hurd-0.9.git20221224/libpager/data-return.c
@@ -60,7 +60,7 @@ _pager_do_write_request (struct pager *p
 }
   if (length % __vm_page_size)
 {
-  printf ("incg data return: bad length size %lu\n", length);
+  printf ("incg data return: bad length size %u\n", length);
   goto release_out;
 }
   if (offset % __vm_page_size)
Index: hurd-0.9.git20221224/libpager/data-unlock.c
===
--- hurd-0.9.git20221224.orig/libpager/data-unlock.c
+++ hurd-0.9.git20221224/libpager/data-unlock.c
@@ -58,7 +58,7 @@ _pager_S_memory_object_data_unlock (stru
 }
   if (length != __vm_page_size)
 {
-  printf ("incg data unlock: bad length size %lu\n", length);
+  printf ("incg data unlock: bad length size %u\n", length);
   goto out;
 }
 
Index: hurd-0.9.git20221224/ext2fs/pager.c
===
--- hurd-0.9.git20221224.orig/ext2fs/pager.c
+++ hurd-0.9.git20221224/ext2fs/pager.c
@@ -642,7 +642,7 @@ pager_unlock_page (struct user_pager_inf
   if (err == ENOSPC)
 	ext2_warning ("This filesystem is out of space.");
   else if (err)
-	ext2_warning ("inode=%Ld, page=0x%lx: %s",
+	ext2_warning ("inode=%Ld, page=0x%x: %s",
 		  node->cache_id, page, strerror (err));
 
   return err;
@@ -905,7 +905,7 @@ static void
 disk_cache_init (void)
 {
   if (block_size != vm_page_size)
-ext2_panic ("Block size %u != vm_page_size %lu",
+ext2_panic ("Block size %u != vm_page_size %u",
 		block_size, vm_page_size);
 
   pthread_mutex_init (_cache_lock, NULL);
Index: hurd-0.9.git20221224/mach-defpager/main.c
===
--- hurd-0.9.git20221224.orig/mach-defpager/main.c
+++ hurd-0.9.git20221224/mach-defpager/main.c
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 /* XXX */
 


Re: [PATCH] Add libraries to Makefiles.

2023-01-18 Thread Samuel Thibault
Svante Signell, le mer. 18 janv. 2023 11:34:32 +0100, a ecrit:
> On Wed, 2023-01-18 at 11:10 +0100, Samuel Thibault wrote:
> > 
> > That's not enough information: I'm asking about your cross-toolchain.
> > 
> > Do you actually get e.g. libstore/libstore.so for instance?
> > If so, run objdump -x on it and check that libz is indeed in NEEDED.
> > That's what is supposed to save having to add -lz everywhere.
> 
> /tools/lib/libstore.so
> /tools/lib/libstore.so.0.3
> objdump -x  /tools/lib/libstore.so.0.3 | less
> Dynamic Section:
>   NEEDED   libblkid.so.1
>   NEEDED   libuuid.so.1
>   NEEDED   libz.so
>   NEEDED   libncursesw.so.6
>   NEEDED   libtinfow.so.6
>   NEEDED   libshouldbeinlibc.so.0.3
>   NEEDED   libpthread.so.0.3
>   NEEDED   libc.so.0.3
>   NEEDED   libmachuser.so.1
>   NEEDED   libhurduser.so.0.3
>   SONAME   libstore.so.0.3

Then you need to check that the linking of e.g. storeio does use the
shared library and not the static library. For instance you can re-run
the corresponding linking command and add -Wl,-verbose to check in the
verbose output which precise libstore file it takes.

Samuel



Re: [PATCH] Add libraries to Makefiles.

2023-01-18 Thread Svante Signell
On Wed, 2023-01-18 at 11:10 +0100, Samuel Thibault wrote:
> 
> That's not enough information: I'm asking about your cross-toolchain.
> 
> Do you actually get e.g. libstore/libstore.so for instance?
> If so, run objdump -x on it and check that libz is indeed in NEEDED.
> That's what is supposed to save having to add -lz everywhere.


/tools/lib/libstore.so
/tools/lib/libstore.so.0.3
objdump -x  /tools/lib/libstore.so.0.3 | less
Dynamic Section:
  NEEDED   libblkid.so.1
  NEEDED   libuuid.so.1
  NEEDED   libz.so
  NEEDED   libncursesw.so.6
  NEEDED   libtinfow.so.6
  NEEDED   libshouldbeinlibc.so.0.3
  NEEDED   libpthread.so.0.3
  NEEDED   libc.so.0.3
  NEEDED   libmachuser.so.1
  NEEDED   libhurduser.so.0.3
  SONAME   libstore.so.0.3
...



Re: [PATCH] Add libraries to Makefiles.

2023-01-18 Thread Samuel Thibault
Svante Signell, le mer. 18 janv. 2023 11:05:17 +0100, a ecrit:
> On Wed, 2023-01-18 at 01:54 +0100, Samuel Thibault wrote:
> > But none of these directories are actually using libz, so it doesn't
> > make sense to make them use -lz.
> > 
> > Are you sure that your cross-toolchain supports linking shared
> > libraries?
> 
> Here are the configure flags:

That's not enough information: I'm asking about your cross-toolchain.

Do you actually get e.g. libstore/libstore.so for instance?
If so, run objdump -x on it and check that libz is indeed in NEEDED.
That's what is supposed to save having to add -lz everywhere.

Samuel



Re: [PATCH] Add libraries to Makefiles.

2023-01-18 Thread Svante Signell
On Wed, 2023-01-18 at 01:54 +0100, Samuel Thibault wrote:
> Hello,
> 
> But none of these directories are actually using libz, so it doesn't
> make sense to make them use -lz.
> 
> Are you sure that your cross-toolchain supports linking shared
> libraries?

Here are the configure flags:
   CPPFLAGS="-I$TARGET_ROOT/include -fno-omit-frame-pointer" \
   LDFLAGS="-L$TARGET_ROOT/lib -lblkid -luuid -lz -lncursesw -ltinfow -
ldl" \
   ../$HURD_SRC/configure \
  --build="$HOST" \
  --host="$TARGET" \
  --prefix="$TARGET_ROOT" \
  --without-parted \
  --enable-static-progs=ext2fs,iso9660fs,pci-arbiter \
  --with-ncursesw-include-dir="$TARGET_ROOT/include/ncursesw" \
  --with-libgcrypt-prefix="$TARGET_ROOT" \
  --with-libcrypt \
  --with-libz \
  --without-rump \
  --without-acpica \
  --without-libdaemon \
  --without-libbz2 \
  --without-rump \
  --enable-ncursesw \
  --disable-profile