diff options
Diffstat (limited to 'hurd')
-rw-r--r-- | hurd/fopenport.c | 15 | ||||
-rw-r--r-- | hurd/hurd/port.h | 2 | ||||
-rw-r--r-- | hurd/port-cleanup.c | 3 | ||||
-rw-r--r-- | hurd/vpprintf.c | 6 |
4 files changed, 17 insertions, 9 deletions
diff --git a/hurd/fopenport.c b/hurd/fopenport.c index 60afb44..be6aa30 100644 --- a/hurd/fopenport.c +++ b/hurd/fopenport.c @@ -28,9 +28,10 @@ readio (void *cookie, char *buf, size_t n) mach_msg_type_number_t nread; error_t err; char *bufp = buf; + io_t io = (io_t) (uintptr_t) cookie; nread = n; - if (err = __io_read ((io_t) cookie, &bufp, &nread, -1, n)) + if (err = __io_read (io, &bufp, &nread, -1, n)) return __hurd_fail (err); if (bufp != buf) @@ -50,8 +51,9 @@ writeio (void *cookie, const char *buf, size_t n) { vm_size_t wrote; error_t err; + io_t io = (io_t) (uintptr_t) cookie; - if (err = __io_write ((io_t) cookie, buf, n, -1, &wrote)) + if (err = __io_write (io, buf, n, -1, &wrote)) return __hurd_fail (err); return wrote; @@ -65,7 +67,8 @@ seekio (void *cookie, off64_t *pos, int whence) { - error_t err = __io_seek ((file_t) cookie, *pos, whence, pos); + io_t io = (io_t) (uintptr_t) cookie; + error_t err = __io_seek (io, *pos, whence, pos); return err ? __hurd_fail (err) : 0; } @@ -74,8 +77,9 @@ seekio (void *cookie, static int closeio (void *cookie) { + io_t io = (io_t) (uintptr_t) cookie; error_t error = __mach_port_deallocate (__mach_task_self (), - (mach_port_t) cookie); + io); if (error) return __hurd_fail (error); return 0; @@ -127,6 +131,7 @@ __fopenport (mach_port_t port, const char *mode) return NULL; } - return fopencookie ((void *) port, mode, funcsio); + return fopencookie ((void *) (uintptr_t) port, + mode, funcsio); } weak_alias (__fopenport, fopenport) diff --git a/hurd/hurd/port.h b/hurd/hurd/port.h index fdba8db..1e47397 100644 --- a/hurd/hurd/port.h +++ b/hurd/hurd/port.h @@ -96,7 +96,7 @@ _hurd_port_locked_get (struct hurd_port *port, if (result != MACH_PORT_NULL) { link->cleanup = &_hurd_port_cleanup; - link->cleanup_data = (void *) result; + link->cleanup_data = (void *) (uintptr_t) result; _hurd_userlink_link (&port->users, link); } __spin_unlock (&port->lock); diff --git a/hurd/port-cleanup.c b/hurd/port-cleanup.c index 08ab3d4..ad43b83 100644 --- a/hurd/port-cleanup.c +++ b/hurd/port-cleanup.c @@ -26,7 +26,8 @@ void _hurd_port_cleanup (void *cleanup_data, jmp_buf env, int val) { - __mach_port_deallocate (__mach_task_self (), (mach_port_t) cleanup_data); + mach_port_t port = (mach_port_t) (uintptr_t) cleanup_data; + __mach_port_deallocate (__mach_task_self (), port); } /* We were cancelled while using a port, and called from the cleanup unwinding. diff --git a/hurd/vpprintf.c b/hurd/vpprintf.c index fe73494..010f04c 100644 --- a/hurd/vpprintf.c +++ b/hurd/vpprintf.c @@ -25,8 +25,9 @@ static ssize_t do_write (void *cookie, const char *buf, size_t n) { + io_t io = (io_t) (uintptr_t) cookie; vm_size_t amount = n; - error_t error = __io_write ((io_t) cookie, buf, n, -1, &amount); + error_t error = __io_write (io, buf, n, -1, &amount); if (error) return __hurd_fail (error); return n; @@ -51,7 +52,8 @@ vpprintf (io_t port, const char *format, va_list arg) #endif _IO_cookie_init (&temp_f.cfile, _IO_NO_READS, - (void *) port, (cookie_io_functions_t) { write: do_write }); + (void *) (uintptr_t) port, + (cookie_io_functions_t) { write: do_write }); done = __vfprintf_internal (&temp_f.cfile.__fp.file, format, arg, 0); |