It has been decided that on x86_64, mach_msg_type_number_t stays 32-bit.
Therefore, it's not possible to use mach_msg_type_number_t
interchangeably with size_t, in particular this breaks when a pointer to
a variable is passed to a MIG routine.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230212111044.610942-3-bugaevc@gmail.com>
siocgifconf (int fd, int request, struct ifconf *ifc)
{
error_t err;
- size_t data_len = ifc->ifc_len;
+ mach_msg_type_number_t data_len = ifc->ifc_len;
char *data = ifc->ifc_buf;
if (data_len <= 0)
int *oldpi = pi;
mach_msg_type_number_t oldpisize = pisize;
char *tw = 0;
- size_t twsz = 0;
+ mach_msg_type_number_t twsz = 0;
err = __USEPORT (PROC, __proc_getprocinfo (port, pids[i],
&pi_flags,
&pi, &pisize,
{
char buf[1024];
char *trans = buf;
- size_t translen = sizeof buf;
+ mach_msg_type_number_t translen = sizeof buf;
err = __file_get_translator (*result,
&trans, &translen);
if (!err
if (!strcmp (name, "translator"))
{
char *buf = value;
- size_t bufsz = value ? *size : 0;
+ mach_msg_type_number_t bufsz = value ? *size : 0;
error_t err = __file_get_translator (port, &buf, &bufsz);
if (err)
return err;
{
/* Must make sure it's already there. */
char *buf = NULL;
- size_t bufsz = 0;
+ mach_msg_type_number_t bufsz = 0;
error_t err = __file_get_translator (port, &buf, &bufsz);
if (err)
return err;
int mount_point;
file_t newp;
char *dirdata;
- size_t dirdatasize;
+ mach_msg_type_number_t dirdatasize;
int direntry, nentries;
char retryname[1024];
file_t file;
char *rbuf = buf;
+ mach_msg_type_number_t nread = len;
file_stat = __file_name_lookup_at (fd, 0, file_name, O_NOLINK, 0);
if (file_stat == MACH_PORT_NULL)
goto out;
}
- err = __io_read (file, &rbuf, &len, 0, len);
+ err = __io_read (file, &rbuf, &nread, 0, len);
__mach_port_deallocate (__mach_task_self (), file);
if (err)
goto out;
+ len = nread;
if (rbuf != buf)
{
memcpy (buf, rbuf, len);
- __vm_deallocate (__mach_task_self (), (vm_address_t) rbuf, len);
+ __vm_deallocate (__mach_task_self (), (vm_address_t) rbuf, nread);
}
which might blow if it's huge or address space is real tight. */
char *data = 0;
- size_t datalen = 0;
+ mach_msg_type_number_t datalen = 0;
error_t err = HURD_DPORT_USE (in_fd,
__io_read (port, &data, &datalen,
offset ? *offset : (off_t) -1,