/[hurd]/hurd/trans/hello-mt.c
ViewVC logotype

Diff of /hurd/trans/hello-mt.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by roland, Mon Feb 26 04:16:01 2001 UTC revision 1.4 by roland, Thu Jun 13 21:26:39 2002 UTC
# Line 1  Line 1 
1  /* hello-mt.c - A trivial single-file translator, multithreaded version  /* hello-mt.c - A trivial single-file translator, multithreaded version
2     Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.     Copyright (C) 1998,99,2001,02 Free Software Foundation, Inc.
3    
4     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
5     modify it under the terms of the GNU General Public License as     modify it under the terms of the GNU General Public License as
# Line 123  close_hook (struct trivfs_peropen *perop Line 123  close_hook (struct trivfs_peropen *perop
123  error_t  error_t
124  trivfs_S_io_read (struct trivfs_protid *cred,  trivfs_S_io_read (struct trivfs_protid *cred,
125                    mach_port_t reply, mach_msg_type_name_t reply_type,                    mach_port_t reply, mach_msg_type_name_t reply_type,
126                    vm_address_t *data, mach_msg_type_number_t *data_len,                    char **data, mach_msg_type_number_t *data_len,
127                    off_t offs, mach_msg_type_number_t amount)                    loff_t offs, mach_msg_type_number_t amount)
128  {  {
129    struct open *op;    struct open *op;
130    
# Line 154  trivfs_S_io_read (struct trivfs_protid * Line 154  trivfs_S_io_read (struct trivfs_protid *
154      {      {
155        /* Possibly allocate a new buffer. */        /* Possibly allocate a new buffer. */
156        if (*data_len < amount)        if (*data_len < amount)
157          *data = (vm_address_t) mmap (0, amount, PROT_READ|PROT_WRITE,          *data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
158                                       MAP_ANON, 0, 0);        if (*data == MAP_FAILED)
159            {
160              mutex_unlock (&op->lock);
161              rwlock_reader_unlock (&contents_lock);
162              return ENOMEM;
163            }
164    
165        /* Copy the constant data into the buffer. */        /* Copy the constant data into the buffer. */
166        memcpy ((char *) *data, contents + offs, amount);        memcpy ((char *) *data, contents + offs, amount);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26