/* Bypass Copyright (C) 1999-2001 Douglas Thain http://www.cs.wisc.edu/condor/bypass This program is released under the GNU General Public License. See the file COPYING for details. */ /* This interface definition augments a program to record and display the number of bytes that pass through read() and write(). */ agent_prologue {{ @include @include static int bytes_read=0; static int bytes_written=0; }}; ssize_t read( int fd, void *data, size_t nbytes ) agent_action {{ ssize_t result; result = read(fd,data,nbytes); if(result>0) bytes_read += result; return result; }}; ssize_t write( int fd, const void *data, size_t nbytes ) agent_action {{ ssize_t result; result = write(fd,data,nbytes); if(result>0) bytes_written += result; return result; }}; void exit( int status ) agent_action {{ fprintf(stderr, "NOTICE: process %d: %d bytes read, %d bytes written\n", (int)getpid(), bytes_read, bytes_written ); exit(status); }};