public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sergey Bugaev <bugaevc@gmail.com>
To: bug-hurd@gnu.org, libc-alpha@sourceware.org
Cc: "Flávio Cruz" <flaviocruz@gmail.com>,
	"Sergey Bugaev" <bugaevc@gmail.com>
Subject: [RFC PATCH 2/9] hurd: Use proper integer types
Date: Sat, 18 Feb 2023 23:37:10 +0300	[thread overview]
Message-ID: <20230218203717.373211-3-bugaevc@gmail.com> (raw)
In-Reply-To: <20230218203717.373211-1-bugaevc@gmail.com>

Fix a few more cases of build errors caused by mismatched types. This is a
continuation of f4315054b46d5e58b44a709a51943fb73f846afb.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
 hurd/hurdsig.c                  | 6 +++---
 sysdeps/mach/hurd/getpriority.c | 6 +++---
 sysdeps/mach/hurd/if_index.c    | 2 +-
 sysdeps/mach/hurd/ifreq.c       | 2 +-
 sysdeps/mach/hurd/readdir64.c   | 4 +++-
 sysdeps/mach/hurd/readdir64_r.c | 4 +++-
 6 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 56e8e614..ea79ffb5 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -430,8 +430,8 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread,
      receive completes immediately or aborts.  */
   abort_thread (ss, state, reply);
 
-  if (state->basic.PC >= (natural_t) &_hurd_intr_rpc_msg_about_to
-      && state->basic.PC < (natural_t) &_hurd_intr_rpc_msg_in_trap)
+  if (state->basic.PC >= (uintptr_t) &_hurd_intr_rpc_msg_about_to
+      && state->basic.PC < (uintptr_t) &_hurd_intr_rpc_msg_in_trap)
     {
       /* The thread is about to do the RPC, but hasn't yet entered
 	 mach_msg.  Mutate the thread's state so it knows not to try
@@ -442,7 +442,7 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread,
       state->basic.SYSRETURN = MACH_SEND_INTERRUPTED;
       *state_change = 1;
     }
-  else if (state->basic.PC == (natural_t) &_hurd_intr_rpc_msg_in_trap
+  else if (state->basic.PC == (uintptr_t) &_hurd_intr_rpc_msg_in_trap
 	   /* The thread was blocked in the system call.  After thread_abort,
 	      the return value register indicates what state the RPC was in
 	      when interrupted.  */
diff --git a/sysdeps/mach/hurd/getpriority.c b/sysdeps/mach/hurd/getpriority.c
index 9869c2f5..45b32215 100644
--- a/sysdeps/mach/hurd/getpriority.c
+++ b/sysdeps/mach/hurd/getpriority.c
@@ -30,7 +30,7 @@ __getpriority (enum __priority_which which, id_t who)
   int maxpri = INT_MIN;
   struct procinfo *pip;		/* Just for sizeof.  */
   int pibuf[sizeof *pip + 2 * sizeof (pip->threadinfos[0])], *pi = pibuf;
-  size_t pisize = sizeof pibuf / sizeof pibuf[0];
+  mach_msg_type_number_t pisize = sizeof pibuf / sizeof pibuf[0];
 
   error_t getonepriority (pid_t pid, struct procinfo *pip)
     {
@@ -39,9 +39,9 @@ __getpriority (enum __priority_which which, id_t who)
       else
 	{
 	  int *oldpi = pi;
-	  size_t oldpisize = pisize;
+	  mach_msg_type_number_t oldpisize = pisize;
 	  char *tw = 0;
-	  size_t twsz = 0;
+	  mach_msg_type_number_t twsz = 0;
 	  int flags = PI_FETCH_TASKINFO;
 	  onerr = __USEPORT (PROC, __proc_getprocinfo (port, pid, &flags,
 						       &pi, &pisize,
diff --git a/sysdeps/mach/hurd/if_index.c b/sysdeps/mach/hurd/if_index.c
index a4472269..c8ad7e72 100644
--- a/sysdeps/mach/hurd/if_index.c
+++ b/sysdeps/mach/hurd/if_index.c
@@ -99,7 +99,7 @@ __if_nameindex (void)
     nifs = 0;
   else
     {
-      size_t len = sizeof data;
+      mach_msg_type_number_t len = sizeof data;
       err = __pfinet_siocgifconf (server, -1, &ifc.ifc_buf, &len);
       if (err == MACH_SEND_INVALID_DEST || err == MIG_SERVER_DIED)
 	{
diff --git a/sysdeps/mach/hurd/ifreq.c b/sysdeps/mach/hurd/ifreq.c
index ef210c32..394d020c 100644
--- a/sysdeps/mach/hurd/ifreq.c
+++ b/sysdeps/mach/hurd/ifreq.c
@@ -37,7 +37,7 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
   else
     {
       char *data = NULL;
-      size_t len = 0;
+      mach_msg_type_number_t len = 0;
       error_t err = __pfinet_siocgifconf (server, -1, &data, &len);
       if (err == MACH_SEND_INVALID_DEST || err == MIG_SERVER_DIED)
 	{
diff --git a/sysdeps/mach/hurd/readdir64.c b/sysdeps/mach/hurd/readdir64.c
index 47829d9e..cf98bbb1 100644
--- a/sysdeps/mach/hurd/readdir64.c
+++ b/sysdeps/mach/hurd/readdir64.c
@@ -43,12 +43,13 @@ __readdir64 (DIR *dirp)
 	  /* We've emptied out our buffer.  Refill it.  */
 
 	  char *data = dirp->__data;
+	  mach_msg_type_number_t data_size = dirp->__size;
 	  int nentries;
 	  error_t err;
 
 	  if (err = HURD_FD_PORT_USE (dirp->__fd,
 				      __dir_readdir (port,
-						     &data, &dirp->__size,
+						     &data, &data_size,
 						     dirp->__entry_ptr,
 						     -1, 0, &nentries)))
 	    {
@@ -57,6 +58,7 @@ __readdir64 (DIR *dirp)
 	      break;
 	    }
 
+          dirp->__size = data_size;
 	  /* DATA now corresponds to entry index DIRP->__entry_ptr.  */
 	  dirp->__entry_data = dirp->__entry_ptr;
 
diff --git a/sysdeps/mach/hurd/readdir64_r.c b/sysdeps/mach/hurd/readdir64_r.c
index 7e438aaf..4f4252c2 100644
--- a/sysdeps/mach/hurd/readdir64_r.c
+++ b/sysdeps/mach/hurd/readdir64_r.c
@@ -45,11 +45,12 @@ __readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
 	  /* We've emptied out our buffer.  Refill it.  */
 
 	  char *data = dirp->__data;
+	  mach_msg_type_number_t data_size = dirp->__size;
 	  int nentries;
 
 	  if (err = HURD_FD_PORT_USE (dirp->__fd,
 				      __dir_readdir (port,
-						     &data, &dirp->__size,
+						     &data, &data_size,
 						     dirp->__entry_ptr,
 						     -1, 0, &nentries)))
 	    {
@@ -58,6 +59,7 @@ __readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
 	      break;
 	    }
 
+	  dirp->__size = data_size;
 	  /* DATA now corresponds to entry index DIRP->__entry_ptr.  */
 	  dirp->__entry_data = dirp->__entry_ptr;
 
-- 
2.39.2


  parent reply	other threads:[~2023-02-18 20:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-18 20:37 [RFC PATCH 0/9] More x86_64-gnu glibc work Sergey Bugaev
2023-02-18 20:37 ` [RFC PATCH 1/9] hurd: Move thread state manipulation into _hurd_tls_new () Sergey Bugaev
2023-02-19 23:32   ` Samuel Thibault
2023-02-18 20:37 ` Sergey Bugaev [this message]
2023-02-19 23:33   ` [RFC PATCH 2/9] hurd: Use proper integer types Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 3/9] hurd: Fix xattr function return type Sergey Bugaev
2023-02-19 23:34   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 4/9] hurd: Make timer_t pointer-sized Sergey Bugaev
2023-02-19 23:35   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 5/9] hurd: Simplify init-first.c a bit Sergey Bugaev
2023-02-19 23:45   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 6/9] mach: Use PAGE_SIZE Sergey Bugaev
2023-02-19 23:47   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 7/9] hurd: Generalize init-first.c to support x86_64 Sergey Bugaev
2023-02-20  0:01   ` Samuel Thibault
2023-02-20 16:16     ` Sergey Bugaev
2023-02-20 17:10       ` Sergey Bugaev
2023-02-20 17:31         ` Samuel Thibault
2023-02-20 17:27   ` Noah Goldstein
2023-02-18 20:37 ` [RFC PATCH 8/9 gnumach] Add i386_fsgs_base_state Sergey Bugaev
2023-02-18 20:37 ` [RFC PATCH 9/9] hurd, htl: Add some more x86_64-specific code Sergey Bugaev
2023-02-20  0:30   ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230218203717.373211-3-bugaevc@gmail.com \
    --to=bugaevc@gmail.com \
    --cc=bug-hurd@gnu.org \
    --cc=flaviocruz@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).