From 48d0548e88e4c06722165a969fccfbd429dff2f0 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 13 Jun 2002 21:26:39 +0000 Subject: 2002-06-13 Roland McGrath * firmlink.c (trivfs_S_io_read): Fix type of DATA argument. * streamio.c (trivfs_S_io_read): Likewise. (trivfs_S_io_write): Likewise. * hello.c (trivfs_S_io_read): Likewise. * hello-mt.c (trivfs_S_io_read): Likewise. * null.c (trivfs_S_io_read): Likewise. (trivfs_S_io_write): Likewise. (trivfs_S_file_set_size): Add reply port args. * hello.c (trivfs_S_io_read): off_t -> loff_t * hello-mt.c (trivfs_S_io_read): Likewise. * streamio.c (trivfs_S_io_read, trivfs_S_io_write): Likewise. (trivfs_S_file_sync): Add missing arg. --- trans/hello-mt.c | 15 ++++++++++----- trans/hello.c | 13 ++++++++----- trans/streamio.c | 10 +++++----- 3 files changed, 23 insertions(+), 15 deletions(-) (limited to 'trans') diff --git a/trans/hello-mt.c b/trans/hello-mt.c index 83278e1b..cc338f92 100644 --- a/trans/hello-mt.c +++ b/trans/hello-mt.c @@ -1,5 +1,5 @@ /* hello-mt.c - A trivial single-file translator, multithreaded version - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1998,99,2001,02 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -123,8 +123,8 @@ close_hook (struct trivfs_peropen *peropen) error_t trivfs_S_io_read (struct trivfs_protid *cred, mach_port_t reply, mach_msg_type_name_t reply_type, - vm_address_t *data, mach_msg_type_number_t *data_len, - off_t offs, mach_msg_type_number_t amount) + char **data, mach_msg_type_number_t *data_len, + loff_t offs, mach_msg_type_number_t amount) { struct open *op; @@ -154,8 +154,13 @@ trivfs_S_io_read (struct trivfs_protid *cred, { /* Possibly allocate a new buffer. */ if (*data_len < amount) - *data = (vm_address_t) mmap (0, amount, PROT_READ|PROT_WRITE, - MAP_ANON, 0, 0); + *data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); + if (*data == MAP_FAILED) + { + mutex_unlock (&op->lock); + rwlock_reader_unlock (&contents_lock); + return ENOMEM; + } /* Copy the constant data into the buffer. */ memcpy ((char *) *data, contents + offs, amount); diff --git a/trans/hello.c b/trans/hello.c index 5c53c193..d36ba848 100644 --- a/trans/hello.c +++ b/trans/hello.c @@ -1,5 +1,5 @@ /* hello.c - A trivial single-file translator - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999,2001,02 Free Software Foundation, Inc. Gordon Matzigkeit , 1999 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -113,8 +113,8 @@ close_hook (struct trivfs_peropen *peropen) error_t trivfs_S_io_read (struct trivfs_protid *cred, mach_port_t reply, mach_msg_type_name_t reply_type, - vm_address_t *data, mach_msg_type_number_t *data_len, - off_t offs, mach_msg_type_number_t amount) + char **data, mach_msg_type_number_t *data_len, + loff_t offs, mach_msg_type_number_t amount) { struct open *op; @@ -139,8 +139,11 @@ trivfs_S_io_read (struct trivfs_protid *cred, { /* Possibly allocate a new buffer. */ if (*data_len < amount) - *data = (vm_address_t) mmap (0, amount, PROT_READ|PROT_WRITE, - MAP_ANON, 0, 0); + { + *data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); + if (*data == MAP_FAILED) + return ENOMEM; + } /* Copy the constant data into the buffer. */ memcpy ((char *) *data, contents + offs, amount); diff --git a/trans/streamio.c b/trans/streamio.c index c1685f38..645f5861 100644 --- a/trans/streamio.c +++ b/trans/streamio.c @@ -474,8 +474,8 @@ trivfs_goaway (struct trivfs_control *fsys, int flags) error_t trivfs_S_io_read (struct trivfs_protid *cred, mach_port_t reply, mach_msg_type_name_t reply_type, - vm_address_t *data, mach_msg_type_number_t *data_len, - off_t offs, mach_msg_type_number_t amount) + char **data, mach_msg_type_number_t *data_len, + loff_t offs, mach_msg_type_number_t amount) { error_t err; @@ -513,8 +513,8 @@ trivfs_S_io_readable (struct trivfs_protid *cred, error_t trivfs_S_io_write (struct trivfs_protid *cred, mach_port_t reply, mach_msg_type_name_t reply_type, - vm_address_t data, mach_msg_type_number_t data_len, - off_t offs, mach_msg_type_number_t *amount) + char *data, mach_msg_type_number_t data_len, + loff_t offs, mach_msg_type_number_t *amount) { error_t err; @@ -662,7 +662,7 @@ trivfs_S_io_clear_some_openmodes (struct trivfs_protid *cred, error_t trivfs_S_file_sync (struct trivfs_protid *cred, mach_port_t reply, mach_msg_type_name_t reply_type, - int wait) + int wait, int omit_metadata) { error_t err; -- cgit v1.2.3