This patch implements the PVM File Server (PVMFS) functionality for the PVM System, version 3.3.4. Use to following to add it to your PVM software: % cd $PVM_ROOT % patch -p < this_file Then read the Readme.fs in $PVM_ROOT. Chris -------- Christopher G. Phillips pefv700@pe.utexas.edu *** pvm3.ornl/Makefile Thu Aug 25 18:03:30 1994 --- Makefile Sun Jul 24 18:03:38 1994 *************** *** 15,23 **** BINDIR = $(TOPBINDIR)/$(PVM_ARCH) SHELL = /bin/sh ! default: s c f g ! all: s f c g m clean: cd src; ../lib/aimk clean --- 15,23 ---- BINDIR = $(TOPBINDIR)/$(PVM_ARCH) SHELL = /bin/sh ! default: s c f fs l ! all: s f c g m fs l clean: cd src; ../lib/aimk clean *************** *** 24,29 **** --- 24,31 ---- cd console; ../lib/aimk clean cd libfpvm; ../lib/aimk clean cd pvmgs; ../lib/aimk clean + cd pvmfs; ../lib/aimk clean + cd libc; ../lib/aimk clean $(LIBDIR): - mkdir $(LIBDIR) *************** *** 60,62 **** --- 62,71 ---- m: cd xep; ../lib/aimk + ## build pvmfs ## + fs: + cd pvmfs; ../lib/aimk install + + ## build libc ## + l: + cd libc; ../lib/aimk install *** /dev/null Thu Aug 25 19:19:25 1994 --- Readme.fs Thu Aug 25 23:29:42 1994 *************** *** 0 **** --- 1,215 ---- + PVMFS - PVM File Server + + + PVMFS is a PVM task process which facilitates I/O for programs + utilizing the Parallel Virtual Machine system (see pvm(1PVM)) on a + cluster of workstations. The file server presents a common file system + and support for coordinated I/O to its parent and siblings. + + + ------------------------------------------------------------------------ + + + Making PVMFS + + + If you don't have an ANSI C compiler, compile ccwrap and regress + in libc/cc and make them accessible via your PATH. + + Then, do the following (where ``sharfile'' is probably called pvm333fs.shar): + + % cd $PVM_ROOT + % sh sharfile + % patch -p < patches/pvm333fs.patch + + Finally, + + % make + + Typing ``make'' in your PVM_ROOT directory will, by default, compile + the new system call handling code as well as the file server. If you, + for whatever reason, *don't* want the file server support, don't + #define PVMFS as it now is in various Makefile.aimk's. + + One caveat is that you have to prepare libc/pvmerrno.[ch] for all of + the machines you will ever want to use in your virtual machine. A perl + script, libc/pvmerrno.pl is provided to make this easier. cd to libc + and type + + % cd $PVM_ROOT/libc + % pvmerrno.pl + + which is usually + + % pvmerrno.pl /usr/include/sys/errno.h + + (If you don't have perl, basically you want to add every E* constant to + libc/pvmerrno.[ch] just like the others already there.) + + Take libc/pvmerrno.[ch] to every other machine and do the same thing. + What these files do is provide a mapping from one machine's errno + constants to another's. In libc/$PVM_ARCH, the file errnoconf.h is + created. This file deals with compilers not liking multiple case + statements with the same value (such as if EAGAIN == EWOULDBLOCK).) + + There are cases which fool pvmerrno.pl. These will present + themselves as compiler errors and should be fairly easy to fix. + + For the RS6K, there is another problem. Because of the unusual + linking required, you will need to make things out of the normal order. + Try + % make l + % make f + % make + + Hopefully, this will work. + + + ------------------------------------------------------------------------ + + + Examples + + + There are two example programs to run to check whether the linking is + good and to peruse example programming with the file server. These are + under $PVM_ROOT/fsexamples and are called io and iot. + + io contains programs that read and write files using the various I/O + modes with UNIX, ANSI C, and FORTRAN functions. You can just type + ``aimk'' and it will try to run all the example programs. Besides each + individual program, ``aimk c'' will do the UNIX examples, ``aimk stdc'' + the ANSI C examples (files named *_stdc_[rw].c), and ``aimk f'' the + FORTRAN examples (files named *_f_[rw].f). These all use the files + [01]_w and 01_r (although not directly). + + ###WARNING: Some of the cases, especially if they don't use + buffering, can take a long time on a loaded system. If this is + a problem, decrease the number of lines in 01_r, 0_w, and 1_w. + All of the examples are designed to run on just one host, + although if you coordinate the making of the executables (io + and fio), you can run on multiple hosts. + + The shell script ``test2'' is provided to test these using two hosts in + the virtual machine. The syntax is + + machine1% test2 machine2 [target] + + where target is as when using aimk above. + + iot is like perl in that it can be interactive and its syntax resembles + the calling of UNIX system calls. Unless DEBUG is #defined, it runs + one process on the current host and another as given by argv[1] (or + both on the current host if argc == 1. The (remote) spawned process + actually reads the input and has the file server perform the requested + actions. Type a system call name followed by a space if you want to + know the syntax. Also, reads and writes use an anonymous buffer so you + can read and then write the stuff you read. Use aimk to make iot. + + + ----------------------------------------------------------------------- + + + Notes + + + There's a new -f option to the kill command of the console program. It + kills the file server whose tid is specified and all processes with + that fstid. + + If you're interested, you can #define DEBUG in the Makefile.aimk's in + src and pvmfs (this affects src/lpvm.c and pvmfs/fs.c), create the + named pipe /tmp/fspipe and run the file server in a debugger. + + Also, you can #define TRACE and set the global variable pvmdebug + nonzero and system calls (and some POSIX calls like opendir) will print + out a trace (it may be bypassed in write). It's amazing how often the + RS6K and SUN4 FORTRAN libraries call isatty... + + If you don't want a file server (as we don't for the console process), + just don't call pvm_usefs with a nonzero argument. By default, you + don't get a file server (unless your parent has one). + + + ----------------------------------------------------------------------- + + + Bugs + + + The POSIX terminal I/O tc* functions aren't implemented. And you + don't want to ask about ioctl :-) + + File locking, which must be implemented in the file server because of + pid considerations, isn't. + + Writing binary data should be fun. You potentially have to know how to + convert from one architecture's format to another's. + + The most important thing to get right when using the file server is the + linking. Look at the Makefile*'s for the examples. Note that all of + the true system calls (and some other functions easily emulated) are in + libc/syscalls.c. libc/posix.c has functions that are *not* system + calls and cannot be called indirectly using syscall (like opendir). If + you want to call opendir via the file server and then *locally* later, + you're out of luck. + + + ----------------------------------------------------------------------- + + + FORTRAN hints + + + When you use shared files (other than mode PvmIomodeIndividual), + you should not specify STATUS = 'new' for output files. The reason + is that the file server will remember that it has opened a file, but + isn't smart enough to lie about a call to access. Use 'unknown' + and make sure the file is empty when you start up your program. + + ftruncate has been disabled for shared files because, when you use + 'unknown' and then write to a file, some FORTRAN I/O libraries + immediately do an lseek followed by an ftruncate. When these are + done by multiple processes, data can be lost. + + The SyncBC mode will currently only work for reading if your FORTRAN + I/O libraries all use the same size. + + Be aware of buffering!!! + + + ----------------------------------------------------------------------- + + + Porting Notes + + + As I said above, the most important thing to get right is the linking. + It's not good to think your FORTRAN code is trying to open a file via + the file server when it's really not because the linking is wrong. + Take some super-small C and FORTRAN programs and use the compiler's + (-v) option (if any) during the linking to see all of the libraries and + stuff in the argument list to ld. Generally speaking, satisfy all of + the FORTRAN references first and have the system call trapping code + last (assuming a ``left-to-right'' linker). The SUN4 and ALPHA are + examples. + + If your system has unusual linking, put this stuff in + libc/$PVM_ARCH/Mfile. The RS6K is one example. + + When you've figured out the linking, set ARCHFFSLIB (and ARCHFSLIB if + really weird) in conf/$PVM_ARCH.def. + + You need to find out what return and argument types your system's read, + readv, write, writev, and select take and make appropriate changes to + libc/argtypes.h. + + + Enjoy! + + + Chris + ---------- + + Christopher G. Phillips + pefv700@pe.utexas.edu *** pvm3.ornl/conf/ALPHA.def Thu Aug 25 18:03:31 1994 --- conf/ALPHA.def Sun Jul 24 18:07:44 1994 *************** *** 4,6 **** --- 4,8 ---- ARCHLIB = HASRANLIB = t PVM_ARCH = ALPHA + ARCHFFSLIB = -lUfor -lfor -lFutil -lm -lots + SCC = cc -std1 *** pvm3.ornl/conf/CNVXN.def Thu Aug 25 18:03:34 1994 --- conf/CNVXN.def Sun Jul 24 18:08:29 1994 *************** *** 4,6 **** --- 4,9 ---- ARCHLIB = HASRANLIB = t PVM_ARCH = CNVXN + ARCHFFSLIB = -lU77 -lF77 -lI77 -lD77 -lmathC2 #-llfs + SCC = cc + FC = fc *** pvm3.ornl/conf/CRAY.def Thu Aug 25 18:03:35 1994 --- conf/CRAY.def Sun Jul 24 18:09:05 1994 *************** *** 4,6 **** --- 4,9 ---- ARCHLIB = HASRANLIB = f PVM_ARCH = CRAY + ARCHFFSLIB = -Wl"-D dupentry=caution,note,note" + SCC = cc + FC = $(CF) *** pvm3.ornl/conf/PMAX.def Thu Aug 25 18:03:41 1994 --- conf/PMAX.def Sun Jul 24 18:09:33 1994 *************** *** 4,6 **** --- 4,8 ---- ARCHLIB = HASRANLIB = t PVM_ARCH = PMAX + ARCHFFSLIB = -lUfor -lfor -lutil -li -lots -lm + SCC = ccwrap cc *** pvm3.ornl/conf/RS6K.def Tue Sep 06 10:17:41 1994 --- conf/RS6K.def Tue Sep 06 10:40:33 1994 *************** *** 5,7 **** --- 5,10 ---- HASRANLIB = t PVM_ARCH = RS6K RWBSPECIAL = |sed '/^.include \"pvm3.h\"/d' |sed '/^.include \"pvm_consts.h\"/d' + ARCHFFSLIB = + ARCHFSLIB = -L$(PVM_ROOT)/libc/RS6K -L$(PVM_ROOT)/lib/RS6K -bI:$(PVM_ROOT)/libc/RS6K/syscall.exp -bnodelcsect -bnso -lxlf -lm -lfpvm3 -lpvm3 -lpvmfs -bI:/lib/syscalls.exp + SCC = cc *** pvm3.ornl/conf/SUN4.def Thu Aug 25 18:03:44 1994 --- conf/SUN4.def Sun Jul 24 18:11:21 1994 *************** *** 4,6 **** --- 4,11 ---- ARCHLIB = HASRANLIB = t PVM_ARCH = SUN4 + #ARCHFFSLIB = -L$(PVM_ROOT)/libc/$(PVM_ARCH) + ARCHFFSLIB = -L/usr/lang/SC1.0/cg87 -L/usr/lang/SC1.0 -lF77 -lm + #SCC = gcc -ansi + SCC = ccwrap cc + CC = cc *** pvm3.ornl/console/Makefile.aimk Fri Aug 26 14:33:07 1994 --- console/Makefile.aimk Mon Jul 25 14:48:09 1994 *************** *** 11,18 **** PVMIDIR = ../../include PVMLDIR = ../../lib/$(PVM_ARCH) PVMLIB = -lpvm3 ! CFLAGS = -g -DIMA_$(PVM_ARCH) -I$(PVMIDIR) -L$(PVMLDIR) $(ARCHCFLAGS) ! LIBS = $(PVMLIB) $(ARCHLIB) OBJ = cons.o cmds.o job.o tevfmt.o default: pvm --- 11,18 ---- PVMIDIR = ../../include PVMLDIR = ../../lib/$(PVM_ARCH) PVMLIB = -lpvm3 ! CFLAGS = -g -DIMA_$(PVM_ARCH) -I$(PVMIDIR) -L$(PVMLDIR) $(ARCHCFLAGS) -DPVMFS ! LIBS = $(PVMLIB) $(ARCHLIB) $(ARCHFSLIB) OBJ = cons.o cmds.o job.o tevfmt.o default: pvm *** pvm3.ornl/console/cmds.c Thu Aug 25 18:03:50 1994 --- console/cmds.c Mon Jul 25 16:11:55 1994 *************** *** 437,442 **** --- 437,445 ---- "kill KILL - Terminate tasks", "kill Syntax: kill [ options ] tid ...", "kill Options: -c kill children of tid", + #ifdef PVMFS + "kill -f kill children of fstid", + #endif /* PVMFS */ "lookup-LOOKUP - Find entry in database", "lookup-Syntax: lookup name index|-1", *************** *** 456,462 **** "ps A.OUT executable name", "ps TID task id", "ps PTID parent task id", ! "ps PTID task process id", "ps FLAG status", "ps FLAG values:", "ps c task connected to pvmd", --- 459,468 ---- "ps A.OUT executable name", "ps TID task id", "ps PTID parent task id", ! "ps PID task process id", ! #ifdef PVMFS ! "ps FSTID file server task id", ! #endif /* PVMFS */ "ps FLAG status", "ps FLAG values:", "ps c task connected to pvmd", *************** *** 638,643 **** --- 644,652 ---- char *p; int host = 0; int cflg = 0; + #ifdef PVMFS + int fflg = 0; + #endif /* PVMFS */ struct pvmtaskinfo *tip; int ntask; *************** *** 650,655 **** --- 659,670 ---- cflg = 1; break; + #ifdef PVMFS + case 'f': + fflg = 1; + break; + #endif /* PVMFS */ + case '-': break; *************** *** 664,670 **** --- 679,689 ---- return; } + #ifdef PVMFS + if ((cflg || fflg) && pvm_tasks(host, &ntask, &tip) < 0) + #else if (cflg && pvm_tasks(host, &ntask, &tip) < 0) + #endif /* PVMFS */ return 1; while (ac > 1) { *************** *** 679,684 **** --- 698,713 ---- pvm_kill(tid2); } + #ifdef PVMFS + } else if (fflg) { + for (i = 0; i < ntask; i++) + if (tip[i].ti_fstid == tid) { + tid2 = tip[i].ti_tid; + if (tid2 != mytid) + pvm_kill(tid2); + } + #endif /* PVMFS */ + } else { if (tid == mytid) printf("t%x: that's me.\n", tid); *************** *** 987,995 **** --- 1016,1030 ---- print_task_hdr(lflg) int lflg; { + #ifdef PVMFS if (lflg) + fputs(" HOST TID PTID FSTID PID FLAG COMMAND\n", + stdout); + #else + if (lflg) fputs(" HOST TID PTID PID FLAG COMMAND\n", stdout); + #endif /* PVMFS */ else fputs(" HOST TID FLAG COMMAND\n", stdout); *************** *** 1025,1034 **** --- 1060,1079 ---- printf(" %8x", tip->ti_ptid); else printf(" -"); + #ifdef PVMFS + if (tip->ti_fstid) + printf(" %8x", tip->ti_fstid); + else + printf(" -"); + #endif /* PVMFS */ printf(" %6d", tip->ti_pid); } printf(" %9s", task_flags(tip->ti_flag)); + #ifdef PVMFS + printf(" %-11s", tip->ti_a_out[0] ? tip->ti_a_out : "-"); + #else printf(" %-12s", tip->ti_a_out[0] ? tip->ti_a_out : "-"); + #endif /* PVMFS */ return 0; } *** /dev/null Thu Aug 25 19:19:25 1994 --- doc/fsarches Mon Jul 25 16:26:43 1994 *************** *** 0 **** --- 1,11 ---- + PVMFS 1.1 Supported Architectures + December 17, 1993 + + PVM name Machine and OS + -------- -------------- + ALPHA DEC Alpha/OSF-1 + CNVXN Convex using native f.p. + CRAY Cray + PMAX DEC/Mips arch (3100, 5000, etc.) + RS6K IBM/RS6000 + SUN4 Sun 4, 4c, sparc, etc. *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/CNVXN/Makefile Sun Jul 24 18:14:55 1994 *************** *** 0 **** --- 1,640 ---- + # Imports: + # PVM_ARCH = the official pvm-name of your processor + # ARCHCFLAGS = special cc flags + # ARCHFFSLIB = special libs needed for getting the FORTRAN library to use pvmfs + # + SHELL = /bin/sh + PVMIDIR = ../../../include + PVMLDIR = ../../../lib/$(PVM_ARCH) + PVMFSLDIR= ../../../libc/$(PVM_ARCH) + PVMLIB = -lpvm3 + CFLAGS = -g -I$(PVMIDIR) -DIMA_$(PVM_ARCH) $(ARCHCFLAGS) -I../../../src -DPVMFS + FFLAGS = -g + FSOBJS = $(PVMFSLDIR)/syscalls.o $(PVMFSLDIR)/pvmerrno.o $(PVMFSLDIR)/posix.o + LIBS = -g -L$(PVMLDIR) $(PVMLIB) + FLIBS1 = $(ARCHFFSLIB) + FLIBS2 = -g -L$(PVMLDIR) -lfpvm3 $(PVMLIB) + OBJS = io.o startup.o wait4fs.o + FOBJS = fio.o fstartup.o wait4fs.o + + include ../../../conf/CNVXN.def + + all: c stdc f + + c: common_r common_w independent_r independent_w syncBC_r syncBC_w \ + syncseq_r syncseq_w + + stdc: common_stdc_r common_stdc_w independent_stdc_r independent_stdc_w \ + syncBC_stdc_r syncBC_stdc_w syncseq_stdc_r syncseq_stdc_w + + f: common_f_r common_f_w independent_f_r independent_f_w \ + syncBC_f_r syncBC_f_w syncseq_f_r syncseq_f_w + + files: mkfiles + @if [ ! -f 01_r ]; \ + then \ + mkfiles; \ + mv 01_r 0_w 1_w ..; \ + else \ + exit 0; \ + fi + + mkfiles: mkfiles.o + $(CC) -o $@ mkfiles.o + + mkfiles.o: ../mkfiles.c + $(SCC) -c ../mkfiles.c + + io: $(OBJS) $(PVMLDIR)/libpvm3.a $(FSOBJS) files + $(SCC) -o $@ $(OBJS) $(FSOBJS) $(LIBS) + rm -f $(HOME)/pvm3/bin/$(PVM_ARCH)/$@ + -ln -s `pwd`/$@ $(HOME)/pvm3/bin/$(PVM_ARCH) + + fio: $(FOBJS) $(PVMLDIR)/libpvm3.a $(PVMLDIR)/libfpvm3.a $(FSOBJS) files + $(CC) -o $@ $(FOBJS) $(FLIBS1) $(FSOBJS) $(FLIBS2) -lc -llfs + rm -f $(HOME)/pvm3/bin/$(PVM_ARCH)/$@ + -ln -s `pwd`/$@ $(HOME)/pvm3/bin/$(PVM_ARCH) + + io.o: ../io.c + $(SCC) $(CFLAGS) -c ../io.c + + fio.o: ../fio.f + $(FC) $(FFLAGS) -c ../fio.f + + startup.o: ../startup.c + $(SCC) $(CFLAGS) -c ../startup.c + + fstartup.o: ../fstartup.f + $(FC) $(FFLAGS) -c ../fstartup.f + + wait4fs.o: ../wait4fs.c + $(SCC) $(CFLAGS) -c ../wait4fs.c + + common_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_r.c ../io.c; \ + cp ../common_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_r ok <======================"; \ + fi + + common_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_w.c ../io.c; \ + cp ../common_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_w ok <======================"; \ + fi + + independent_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_r.c ../io.c; \ + cp ../independent_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> independent_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_r ok <======================"; \ + fi + + independent_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_w.c ../io.c; \ + cp ../independent_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`wc -l < ../0.out`; \ + wc3=`wc -l < ../1.out`; \ + if [ $$wc1 -ne $$wc2 -o $$wc1 -ne $$wc3 ]; \ + then \ + echo "======================> independent_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_w ok <======================"; \ + fi + + syncBC_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_r.c ../io.c; \ + cp ../syncBC_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> syncBC_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_r ok <======================"; \ + fi + + syncBC_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_w.c ../io.c; \ + cp ../syncBC_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @cmp -s ../0.out ../file; \ + if [ $$? -ne 0 ]; \ + then \ + echo "======================> syncBC_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_w ok <======================"; \ + fi + + syncseq_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_r.c ../io.c; \ + cp ../syncseq_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_r ok <======================"; \ + fi + + syncseq_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_w.c ../io.c; \ + cp ../syncseq_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_w ok <======================"; \ + fi + + common_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_stdc_r.c ../io.c; \ + cp ../common_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_stdc_r ok <======================"; \ + fi + + common_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_stdc_w.c ../io.c; \ + cp ../common_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_stdc_w ok <======================"; \ + fi + + independent_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_stdc_r.c ../io.c; \ + cp ../independent_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> independent_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_stdc_r ok <======================"; \ + fi + + independent_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_stdc_w.c ../io.c; \ + cp ../independent_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`wc -l < ../0.out`; \ + wc3=`wc -l < ../1.out`; \ + if [ $$wc1 -ne $$wc2 -o $$wc1 -ne $$wc3 ]; \ + then \ + echo "======================> independent_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_stdc_w ok <======================"; \ + fi + + syncBC_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_stdc_r.c ../io.c; \ + cp ../syncBC_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> syncBC_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_stdc_r ok <======================"; \ + fi + + syncBC_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_stdc_w.c ../io.c; \ + cp ../syncBC_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @cmp -s ../0.out ../file; \ + if [ $$? -ne 0 ]; \ + then \ + echo "======================> syncBC_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_stdc_w ok <======================"; \ + fi + + syncseq_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_stdc_r.c ../io.c; \ + cp ../syncseq_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_stdc_r ok <======================"; \ + fi + + syncseq_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_stdc_w.c ../io.c; \ + cp ../syncseq_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_stdc_w ok <======================"; \ + fi + + common_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../common_f_r.f ../fio.f; \ + cp ../common_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_f_r ok <======================"; \ + fi + + common_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../common_f_w.f ../fio.f; \ + cp ../common_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_f_w ok <======================"; \ + fi + + independent_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../independent_f_r.f ../fio.f; \ + cp ../independent_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> independent_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_f_r ok <======================"; \ + fi + + independent_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../independent_f_w.f ../fio.f; \ + cp ../independent_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`wc -l < ../0.out`; \ + wc3=`wc -l < ../1.out`; \ + if [ $$wc1 -ne $$wc2 -o $$wc1 -ne $$wc3 ]; \ + then \ + echo "======================> independent_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_f_w ok <======================"; \ + fi + + syncBC_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_f_r.f ../fio.f; \ + cp ../syncBC_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> syncBC_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_f_r ok <======================"; \ + fi + + syncBC_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_f_w.f ../fio.f; \ + cp ../syncBC_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @cmp -s ../0.out ../file; \ + if [ $$? -ne 0 ]; \ + then \ + echo "======================> syncBC_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_f_w ok <======================"; \ + fi + + syncseq_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_f_r.f ../fio.f; \ + cp ../syncseq_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_f_r ok <======================"; \ + fi + + syncseq_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_f_w.f ../fio.f; \ + cp ../syncseq_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_f_w ok <======================"; \ + fi + + clean: + rm -f $(OBJS) io $(FOBJS) fio mkfiles mkfiles.o ../01_r ../0_w ../1_w *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/Makefile.aimk Sun Jul 24 18:14:53 1994 *************** *** 0 **** --- 1,638 ---- + # Imports: + # PVM_ARCH = the official pvm-name of your processor + # ARCHCFLAGS = special cc flags + # ARCHFFSLIB = special libs needed for getting the FORTRAN library to use pvmfs + # + SHELL = /bin/sh + PVMIDIR = ../../../include + PVMLDIR = ../../../lib/$(PVM_ARCH) + PVMFSLDIR= ../../../libc/$(PVM_ARCH) + PVMLIB = -lpvm3 + CFLAGS = -g -I$(PVMIDIR) -DIMA_$(PVM_ARCH) $(ARCHCFLAGS) -I../../../src -DPVMFS + FFLAGS = -g + FSOBJS = $(PVMFSLDIR)/syscalls.o $(PVMFSLDIR)/pvmerrno.o $(PVMFSLDIR)/posix.o + LIBS = -L$(PVMLDIR) $(PVMLIB) + FLIBS1 = $(ARCHFFSLIB) + FLIBS2 = -L$(PVMLDIR) -lfpvm3 $(PVMLIB) + OBJS = io.o startup.o wait4fs.o + FOBJS = fio.o fstartup.o wait4fs.o + + all: c stdc f + + c: common_r common_w independent_r independent_w syncBC_r syncBC_w \ + syncseq_r syncseq_w + + stdc: common_stdc_r common_stdc_w independent_stdc_r independent_stdc_w \ + syncBC_stdc_r syncBC_stdc_w syncseq_stdc_r syncseq_stdc_w + + f: common_f_r common_f_w independent_f_r independent_f_w \ + syncBC_f_r syncBC_f_w syncseq_f_r syncseq_f_w + + files: mkfiles + @if [ ! -f 01_r ]; \ + then \ + mkfiles; \ + mv 01_r 0_w 1_w ..; \ + else \ + exit 0; \ + fi + + mkfiles: mkfiles.o + $(CC) -o $@ mkfiles.o + + mkfiles.o: ../mkfiles.c + $(SCC) -c ../mkfiles.c + + io: $(OBJS) $(PVMLDIR)/libpvm3.a $(FSOBJS) files + $(SCC) -o $@ $(OBJS) $(FSOBJS) $(LIBS) + rm -f $(HOME)/pvm3/bin/$(PVM_ARCH)/$@ + -ln -s `pwd`/$@ $(HOME)/pvm3/bin/$(PVM_ARCH) + + fio: $(FOBJS) $(PVMLDIR)/libpvm3.a $(PVMLDIR)/libfpvm3.a $(FSOBJS) files + $(FC) -o $@ $(FOBJS) $(FLIBS1) $(FSOBJS) $(FLIBS2) + rm -f $(HOME)/pvm3/bin/$(PVM_ARCH)/$@ + -ln -s `pwd`/$@ $(HOME)/pvm3/bin/$(PVM_ARCH) + + io.o: ../io.c + $(SCC) $(CFLAGS) -c ../io.c + + fio.o: ../fio.f + $(FC) $(FFLAGS) -c ../fio.f + + startup.o: ../startup.c + $(SCC) $(CFLAGS) -c ../startup.c + + fstartup.o: ../fstartup.f + $(FC) $(FFLAGS) -c ../fstartup.f + + wait4fs.o: ../wait4fs.c + $(SCC) $(CFLAGS) -c ../wait4fs.c + + common_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_r.c ../io.c; \ + cp ../common_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_r ok <======================"; \ + fi + + common_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_w.c ../io.c; \ + cp ../common_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_w ok <======================"; \ + fi + + independent_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_r.c ../io.c; \ + cp ../independent_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> independent_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_r ok <======================"; \ + fi + + independent_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_w.c ../io.c; \ + cp ../independent_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`wc -l < ../0.out`; \ + wc3=`wc -l < ../1.out`; \ + if [ $$wc1 -ne $$wc2 -o $$wc1 -ne $$wc3 ]; \ + then \ + echo "======================> independent_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_w ok <======================"; \ + fi + + syncBC_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_r.c ../io.c; \ + cp ../syncBC_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> syncBC_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_r ok <======================"; \ + fi + + syncBC_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_w.c ../io.c; \ + cp ../syncBC_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @cmp -s ../0.out ../file; \ + if [ $$? -ne 0 ]; \ + then \ + echo "======================> syncBC_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_w ok <======================"; \ + fi + + syncseq_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_r.c ../io.c; \ + cp ../syncseq_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_r ok <======================"; \ + fi + + syncseq_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_w.c ../io.c; \ + cp ../syncseq_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_w ok <======================"; \ + fi + + common_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_stdc_r.c ../io.c; \ + cp ../common_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_stdc_r ok <======================"; \ + fi + + common_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_stdc_w.c ../io.c; \ + cp ../common_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_stdc_w ok <======================"; \ + fi + + independent_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_stdc_r.c ../io.c; \ + cp ../independent_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> independent_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_stdc_r ok <======================"; \ + fi + + independent_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_stdc_w.c ../io.c; \ + cp ../independent_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`wc -l < ../0.out`; \ + wc3=`wc -l < ../1.out`; \ + if [ $$wc1 -ne $$wc2 -o $$wc1 -ne $$wc3 ]; \ + then \ + echo "======================> independent_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_stdc_w ok <======================"; \ + fi + + syncBC_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_stdc_r.c ../io.c; \ + cp ../syncBC_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> syncBC_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_stdc_r ok <======================"; \ + fi + + syncBC_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_stdc_w.c ../io.c; \ + cp ../syncBC_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @cmp -s ../0.out ../file; \ + if [ $$? -ne 0 ]; \ + then \ + echo "======================> syncBC_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_stdc_w ok <======================"; \ + fi + + syncseq_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_stdc_r.c ../io.c; \ + cp ../syncseq_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_stdc_r ok <======================"; \ + fi + + syncseq_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_stdc_w.c ../io.c; \ + cp ../syncseq_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_stdc_w ok <======================"; \ + fi + + common_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../common_f_r.f ../fio.f; \ + cp ../common_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_f_r ok <======================"; \ + fi + + common_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../common_f_w.f ../fio.f; \ + cp ../common_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_f_w ok <======================"; \ + fi + + independent_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../independent_f_r.f ../fio.f; \ + cp ../independent_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> independent_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_f_r ok <======================"; \ + fi + + independent_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../independent_f_w.f ../fio.f; \ + cp ../independent_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`wc -l < ../0.out`; \ + wc3=`wc -l < ../1.out`; \ + if [ $$wc1 -ne $$wc2 -o $$wc1 -ne $$wc3 ]; \ + then \ + echo "======================> independent_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_f_w ok <======================"; \ + fi + + syncBC_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_f_r.f ../fio.f; \ + cp ../syncBC_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> syncBC_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_f_r ok <======================"; \ + fi + + syncBC_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_f_w.f ../fio.f; \ + cp ../syncBC_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @cmp -s ../0.out ../file; \ + if [ $$? -ne 0 ]; \ + then \ + echo "======================> syncBC_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_f_w ok <======================"; \ + fi + + syncseq_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_f_r.f ../fio.f; \ + cp ../syncseq_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_f_r ok <======================"; \ + fi + + syncseq_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_f_w.f ../fio.f; \ + cp ../syncseq_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_f_w ok <======================"; \ + fi + + clean: + rm -f $(OBJS) io $(FOBJS) fio mkfiles mkfiles.o ../01_r ../0_w ../1_w *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/RS6K/Makefile Sun Jul 24 18:14:55 1994 *************** *** 0 **** --- 1,639 ---- + # Imports: + # PVM_ARCH = the official pvm-name of your processor + # ARCHCFLAGS = special cc flags + # ARCHFFSLIB = special libs needed for getting the FORTRAN library to use pvmfs + # + SHELL = /bin/sh + PVMIDIR = ../../../include + PVMLDIR = ../../../lib/$(PVM_ARCH) + PVMFSLDIR= ../../../libc/$(PVM_ARCH) + PVMLIB = -lpvm3 + CFLAGS = -g -I$(PVMIDIR) -DIMA_$(PVM_ARCH) $(ARCHCFLAGS) -I../../../src -DPVMFS + FFLAGS = -g + FSOBJS = $(PVMFSLDIR)/syscalls.o $(PVMFSLDIR)/pvmerrno.o $(PVMFSLDIR)/posix.o + LIBS = -g -L$(PVMLDIR) $(PVMLIB) $(ARCHFSLIB) + FLIBS2 = -g $(ARCHFSLIB) + OBJS = io.o startup.o wait4fs.o + FOBJS = fio.o fstartup.o wait4fs.o + + include ../../../conf/$(PVM_ARCH).def + + all: c stdc f + + c: common_r common_w independent_r independent_w syncBC_r syncBC_w \ + syncseq_r syncseq_w + + stdc: common_stdc_r common_stdc_w independent_stdc_r independent_stdc_w \ + syncBC_stdc_r syncBC_stdc_w syncseq_stdc_r syncseq_stdc_w + + f: common_f_r common_f_w independent_f_r independent_f_w \ + syncBC_f_r syncBC_f_w syncseq_f_r syncseq_f_w + + files: mkfiles + @if [ ! -f 01_r ]; \ + then \ + mkfiles; \ + mv 01_r 0_w 1_w ..; \ + else \ + exit 0; \ + fi + + mkfiles: mkfiles.o + $(CC) -o $@ mkfiles.o + + mkfiles.o: ../mkfiles.c + $(SCC) -c ../mkfiles.c + + io: $(OBJS) $(PVMLDIR)/libpvm3.a $(FSOBJS) files + $(SCC) -o $@ $(OBJS) $(FSOBJS) $(LIBS) + rm -f $(HOME)/pvm3/bin/$(PVM_ARCH)/$@ + -ln -s `pwd`/$@ $(HOME)/pvm3/bin/$(PVM_ARCH) + + fio: $(FOBJS) $(PVMLDIR)/libpvm3.a $(PVMLDIR)/libfpvm3.a $(FSOBJS) files + $(FC) -o $@ $(FOBJS) $(FLIBS1) $(FSOBJS) $(FLIBS2) + rm -f $(HOME)/pvm3/bin/$(PVM_ARCH)/$@ + -ln -s `pwd`/$@ $(HOME)/pvm3/bin/$(PVM_ARCH) + + io.o: ../io.c + $(SCC) $(CFLAGS) -c ../io.c + + fio.o: ../fio.f + $(FC) $(FFLAGS) -c ../fio.f + + startup.o: ../startup.c + $(SCC) $(CFLAGS) -c ../startup.c + + fstartup.o: ../fstartup.f + $(FC) $(FFLAGS) -c ../fstartup.f + + wait4fs.o: ../wait4fs.c + $(SCC) $(CFLAGS) -c ../wait4fs.c + + common_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_r.c ../io.c; \ + cp ../common_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_r ok <======================"; \ + fi + + common_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_w.c ../io.c; \ + cp ../common_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_w ok <======================"; \ + fi + + independent_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_r.c ../io.c; \ + cp ../independent_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> independent_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_r ok <======================"; \ + fi + + independent_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_w.c ../io.c; \ + cp ../independent_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`wc -l < ../0.out`; \ + wc3=`wc -l < ../1.out`; \ + if [ $$wc1 -ne $$wc2 -o $$wc1 -ne $$wc3 ]; \ + then \ + echo "======================> independent_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_w ok <======================"; \ + fi + + syncBC_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_r.c ../io.c; \ + cp ../syncBC_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> syncBC_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_r ok <======================"; \ + fi + + syncBC_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_w.c ../io.c; \ + cp ../syncBC_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @cmp -s ../0.out ../file; \ + if [ $$? -ne 0 ]; \ + then \ + echo "======================> syncBC_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_w ok <======================"; \ + fi + + syncseq_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_r.c ../io.c; \ + cp ../syncseq_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_r ok <======================"; \ + fi + + syncseq_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_w.c ../io.c; \ + cp ../syncseq_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_w ok <======================"; \ + fi + + common_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_stdc_r.c ../io.c; \ + cp ../common_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_stdc_r ok <======================"; \ + fi + + common_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../common_stdc_w.c ../io.c; \ + cp ../common_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_stdc_w ok <======================"; \ + fi + + independent_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_stdc_r.c ../io.c; \ + cp ../independent_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> independent_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_stdc_r ok <======================"; \ + fi + + independent_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../independent_stdc_w.c ../io.c; \ + cp ../independent_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`wc -l < ../0.out`; \ + wc3=`wc -l < ../1.out`; \ + if [ $$wc1 -ne $$wc2 -o $$wc1 -ne $$wc3 ]; \ + then \ + echo "======================> independent_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_stdc_w ok <======================"; \ + fi + + syncBC_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_stdc_r.c ../io.c; \ + cp ../syncBC_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> syncBC_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_stdc_r ok <======================"; \ + fi + + syncBC_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_stdc_w.c ../io.c; \ + cp ../syncBC_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @cmp -s ../0.out ../file; \ + if [ $$? -ne 0 ]; \ + then \ + echo "======================> syncBC_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_stdc_w ok <======================"; \ + fi + + syncseq_stdc_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_stdc_r.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_stdc_r.c ../io.c; \ + cp ../syncseq_stdc_r.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + ./io 3 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_stdc_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_stdc_r ok <======================"; \ + fi + + syncseq_stdc_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_stdc_w.c ../io.c; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_stdc_w.c ../io.c; \ + cp ../syncseq_stdc_w.c ../io.c; \ + fi + (cd ..; ../../lib/aimk io) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + ./io 2 + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_stdc_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_stdc_w ok <======================"; \ + fi + + common_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../common_f_r.f ../fio.f; \ + cp ../common_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_f_r ok <======================"; \ + fi + + common_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../common_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../common_f_w.f ../fio.f; \ + cp ../common_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> common_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> common_f_w ok <======================"; \ + fi + + independent_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../independent_f_r.f ../fio.f; \ + cp ../independent_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> independent_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_f_r ok <======================"; \ + fi + + independent_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../independent_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../independent_f_w.f ../fio.f; \ + cp ../independent_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`wc -l < ../0.out`; \ + wc3=`wc -l < ../1.out`; \ + if [ $$wc1 -ne $$wc2 -o $$wc1 -ne $$wc3 ]; \ + then \ + echo "======================> independent_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> independent_f_w ok <======================"; \ + fi + + syncBC_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_f_r.f ../fio.f; \ + cp ../syncBC_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @diff=`(cmp ../0.out ../file; cmp ../1.out ../file; cmp ../2.out ../file) | wc -l`; \ + if [ $$diff -ne 0 ]; \ + then \ + echo "======================> syncBC_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_f_r ok <======================"; \ + fi + + syncBC_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncBC_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncBC_f_w.f ../fio.f; \ + cp ../syncBC_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @cmp -s ../0.out ../file; \ + if [ $$? -ne 0 ]; \ + then \ + echo "======================> syncBC_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncBC_f_w ok <======================"; \ + fi + + syncseq_f_r: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_f_r.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_f_r.f ../fio.f; \ + cp ../syncseq_f_r.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../01_r ../file + rm -f ../0.out ../1.out ../2.out + touch ../0.out ../1.out ../2.out + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[0-2].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_f_r problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_f_r ok <======================"; \ + fi + + syncseq_f_w: + @echo "#######################" TESTING $@ "#######################" + @if cmp -s ../syncseq_f_w.f ../fio.f; \ + then \ + exit 0; \ + else \ + echo cp ../syncseq_f_w.f ../fio.f; \ + cp ../syncseq_f_w.f ../fio.f; \ + fi + (cd ..; ../../lib/aimk fio) + cp ../0_w ../0.out + cp ../1_w ../1.out + rm -f ../file + touch ../file + ./fio + @wc1=`wc -l < ../file`; \ + wc2=`cat ../[01].out | wc -l`; \ + if [ $$wc1 -ne $$wc2 ]; \ + then \ + echo "======================> syncseq_f_w problem <======================"; \ + exit 1; \ + else \ + echo "======================> syncseq_f_w ok <======================"; \ + fi + + clean: + rm -f $(OBJS) io $(FOBJS) fio mkfiles mkfiles.o ../01_r ../0_w ../1_w *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/common_f_r.f Sun Jul 24 18:14:53 1994 *************** *** 0 **** --- 1,80 ---- + program common_f_r + include '../../include/fpvm3.h' + integer stderr + parameter (stderr = 0) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer startup + integer ierr + character*31 buf, infile, outfile + character*1 cme + + nodes = 3 + me = startup('fio') + + infile = '../file' + call pvmfsetdefiomode(PvmIomodeCommon, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(10, file = infile, status = 'old', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', infile + call pvmfexit(ierr) + stop + endif + + if (me .eq. 0) then + cme = '0' + else if (me .eq. 1) then + cme = '1' + else + cme = '2' + endif + + outfile = '../' // cme // '.out' + call pvmfsetdefiomode(PvmIomodeIndividual, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(11, file = outfile, status = 'unknown', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', outfile + call pvmfexit(ierr) + stop + endif + + 10 read(10, '(A31)', iostat = ierr, err = 30, end = 20) buf + write(11, '(A31)', iostat = ierr, err = 40) buf + go to 10 + + 20 close(10, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', infile + call pvmfexit(ierr) + stop + endif + close(11, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', outfile + call pvmfexit(ierr) + stop + endif + call pvmfexit(ierr) + call wait4fs + stop + + 30 write(stderr, 50) infile, ': read error' + call pvmfexit(ierr) + stop + 40 write(stderr, 50) outfile, ': write error' + call pvmfexit(ierr) + stop + + 50 format(1x, A, A) + + end *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/common_f_w.f Sun Jul 24 18:14:53 1994 *************** *** 0 **** --- 1,80 ---- + program common_f_w + include '../../include/fpvm3.h' + integer stderr + parameter (stderr = 0) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer startup + integer ierr + character*31 buf, infile, outfile + character*1 cme + + nodes = 2 + me = startup('fio') + + outfile = '../file' + call pvmfsetdefiomode(PvmIomodeCommon, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(10, file = outfile, status = 'unknown', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', outfile + call pvmfexit(ierr) + stop + endif + + if (me .eq. 0) then + cme = '0' + else if (me .eq. 1) then + cme = '1' + else + cme = '2' + endif + + infile = '../' // cme // '.out' + call pvmfsetdefiomode(PvmIomodeIndividual, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(11, file = infile, status = 'old', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', infile + call pvmfexit(ierr) + stop + endif + + 10 read(11, '(A31)', iostat = ierr, err = 30, end = 20) buf + write(10, '(A31)', iostat = ierr, err = 40) buf + go to 10 + + 20 close(11, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', infile + call pvmfexit(ierr) + stop + endif + close(10, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', outfile + call pvmfexit(ierr) + stop + endif + call pvmfexit(ierr) + call wait4fs + stop + + 30 write(stderr, 50) infile, ': read error' + call pvmfexit(ierr) + stop + 40 write(stderr, 50) outfile, ': write error' + call pvmfexit(ierr) + stop + + 50 format(1x, A, A) + + end *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/common_r.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,56 ---- + #include + #include + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + int fdr; + int fdw; + char buf[32]; + char wfile[BUFSIZ]; + int nbytes; + + me = startup(&argc, argv); + + pvm_setdefiomode(PvmIomodeCommon); + if ((fdr = open("../file", O_RDONLY)) == -1) { + perror("../file"); + EXIT(1); + } + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fdw = open(wfile, O_CREAT | O_TRUNC | O_WRONLY, 0600)) == -1) { + perror(wfile); + EXIT(1); + } + + do { + if ((nbytes = read(fdr, buf, sizeof buf)) > 0) + if (write(fdw, buf, nbytes) == -1) { + perror("write"); + EXIT(1); + } + } while (nbytes > 0); + if (nbytes == -1) { + perror("read"); + EXIT(1); + } + + if (close(fdr) == -1) + perror("../file"); + if (close(fdw) == -1) + perror(wfile); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/common_stdc_r.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,54 ---- + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + FILE *fpr; + FILE *fpw; + char buf[32]; + char wfile[BUFSIZ]; + size_t nbytes; + + me = startup(&argc, argv); + + pvm_setdefiomode(PvmIomodeCommon); + if ((fpr = fopen("../file", "r")) == NULL) { + perror("../file"); + EXIT(1); + } + + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fpw = fopen(wfile, "w")) == NULL) { + perror(wfile); + EXIT(1); + } + + while (nbytes = fread(buf, sizeof *buf, sizeof buf, fpr)) { + if (fwrite(buf, sizeof *buf, nbytes, fpw) != nbytes) { + perror("fwrite"); + EXIT(1); + } + } + if (ferror(fpr)) { + perror("fread"); + EXIT(1); + } + + if (fclose(fpr) == EOF) + perror("../file"); + if (fclose(fpw) == EOF) + perror(wfile); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/common_stdc_w.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,54 ---- + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + FILE *fpr; + FILE *fpw; + char buf[32]; + char wfile[BUFSIZ]; + size_t nbytes; + + me = startup(&argc, argv); + + pvm_setdefiomode(PvmIomodeCommon); + if ((fpw = fopen("../file", "w")) == NULL) { + perror("../file"); + EXIT(1); + } + + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fpr = fopen(wfile, "r")) == NULL) { + perror(wfile); + EXIT(1); + } + + while (nbytes = fread(buf, sizeof *buf, sizeof buf, fpr)) { + if (fwrite(buf, sizeof *buf, nbytes, fpw) != nbytes) { + perror("fwrite"); + EXIT(1); + } + } + if (ferror(fpr)) { + perror("fread"); + EXIT(1); + } + + if (fclose(fpr) == EOF) + perror(wfile); + if (fclose(fpw) == EOF) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/common_w.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,56 ---- + #include + #include + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + int fdr; + int fdw; + char buf[32]; + char wfile[BUFSIZ]; + int nbytes; + + me = startup(&argc, argv); + + pvm_setdefiomode(PvmIomodeCommon); + if ((fdw = open("../file", O_CREAT | O_TRUNC | O_WRONLY, 0600)) + == -1) { + perror("../file"); + EXIT(1); + } + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fdr = open(wfile, O_RDONLY)) == -1) { + perror(wfile); + EXIT(1); + } + + while ((nbytes = read(fdr, buf, sizeof buf)) > 0) { + if (write(fdw, buf, nbytes) == -1) { + perror("write"); + EXIT(1); + } + } + if (nbytes == -1) { + perror("read"); + EXIT(1); + } + + if (close(fdr) == -1) + perror(wfile); + if (close(fdw) == -1) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/fstartup.f Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,122 ---- + C + C Author: Christopher G. Phillips + C Copyright (C) 1993 All Rights Reserved + C + C NOTICE + C + C Permission to use, copy, modify, and distribute this software and + C its documentation for any purpose and without fee is hereby granted + C provided that the above copyright notice appear in all copies and + C that both the copyright notice and this permission notice appear in + C supporting documentation. + C + C The author makes no representations about the suitability of this + C software for any purpose. This software is provided ``as is'' + C without express or implied warranty. + C + + subroutine standdown(num_spawned) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer num_spawned + + do 10 i = 2, num_spawned + if (tids(i) .ge. 0) then + call pvmfkill(tids(i), idummy) + endif + 10 continue + + write(0, *) 'Shutting down...' + stop + end + + subroutine gsync + include '../../include/fpvm3.h' + integer gsync_type + parameter(gsync_type = 32765) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer i, info + + if (nodes .gt. 1) then + if (me .eq. 0) then + do 10 i = 2, nodes + call pvmfrecv(-1, gsync_type, info) + 10 continue + call pvmfinitsend(PVMDEFAULT, info) + call pvmfmcast(nodes - 1, tids(2), + + gsync_type + 1, info) + else + call pvmfinitsend(PVMDEFAULT, info) + call pvmfsend(parent, gsync_type, info) + call pvmfrecv(parent, gsync_type + 1, info) + endif + endif + + return + end + + integer function startup(task) + include '../../include/fpvm3.h' + integer gsync_type + parameter(gsync_type = 16777216) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + character*(*) task + + integer mytid, numt + + call pvmfusefs(1, info) + if (info .lt. 0) then + call pvmfperror('pvmfusefs', info) + stop + endif + + call pvmfmytid(mytid) + if (mytid .lt. 0) then + call pvmfperror('pvmfmytid', mytid) + stop + endif + + call pvmfparent(parent) + if (parent .lt. 0) then + if (nodes .gt. 1) then + tids(1) = mytid + + c call pvmfspawn(task, PVMDEFAULT + PVMDEBUG, '*', + call pvmfspawn(task, PVMDEFAULT, '*', + + nodes - 1, tids(2), numt) + if (numt .ne. nodes - 1) then + call standdown(nodes - 1) + endif + + call pvmfinitsend(PVMDEFAULT, info) + if (info .lt. 0) call standdown(nodes - 1) + call pvmfpack(INTEGER4, nodes, 1, 1, info) + if (info .lt. 0) call standdown(nodes - 1) + call pvmfpack(INTEGER4, tids, nodes, 1, info) + if (info .lt. 0) call standdown(nodes - 1) + call pvmfmcast(nodes - 1, tids(2), 32767, info) + if (info .lt. 0) call standdown(nodes - 1) + endif + me = 0 + else + call pvmfrecv(parent, 32767, info) + if (info .lt. 0) call standdown(0) + call pvmfunpack(INTEGER4, nodes, 1, 1, info) + if (info .lt. 0) call standdown(0) + call pvmfunpack(INTEGER4, tids, nodes, 1, info) + if (info .lt. 0) call standdown(0) + + do 10 i = 2, nodes + if (tids(i) .eq. mytid) then + me = i - 1 + endif + 10 continue + endif + + call gsync + + startup = me + return + end *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/independent_f_r.f Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,80 ---- + program independent_f_r + include '../../include/fpvm3.h' + integer stderr + parameter (stderr = 0) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer startup + integer ierr + character*31 buf, infile, outfile + character*1 cme + + nodes = 3 + me = startup('fio') + + infile = '../file' + call pvmfsetdefiomode(PvmIomodeIndependent, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(10, file = infile, status = 'old', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', infile + call pvmfexit(ierr) + stop + endif + + if (me .eq. 0) then + cme = '0' + else if (me .eq. 1) then + cme = '1' + else + cme = '2' + endif + + outfile = '../' // cme // '.out' + call pvmfsetdefiomode(PvmIomodeIndividual, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(11, file = outfile, status = 'unknown', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', outfile + call pvmfexit(ierr) + stop + endif + + 10 read(10, '(A31)', iostat = ierr, err = 30, end = 20) buf + write(11, '(A31)', iostat = ierr, err = 40) buf + go to 10 + + 20 close(10, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', infile + call pvmfexit(ierr) + stop + endif + close(11, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', outfile + call pvmfexit(ierr) + stop + endif + call pvmfexit(ierr) + call wait4fs + stop + + 30 write(stderr, 50) infile, ': read error' + call pvmfexit(ierr) + stop + 40 write(stderr, 50) outfile, ': write error' + call pvmfexit(ierr) + stop + + 50 format(1x, A, A) + + end *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/independent_f_w.f Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,80 ---- + program independent_f_w + include '../../include/fpvm3.h' + integer stderr + parameter (stderr = 0) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer startup + integer ierr + character*31 buf, infile, outfile + character*1 cme + + nodes = 2 + me = startup('fio') + + outfile = '../file' + call pvmfsetdefiomode(PvmIomodeIndependent, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(10, file = outfile, status = 'unknown', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', outfile + call pvmfexit(ierr) + stop + endif + + if (me .eq. 0) then + cme = '0' + else if (me .eq. 1) then + cme = '1' + else + cme = '2' + endif + + infile = '../' // cme // '.out' + call pvmfsetdefiomode(PvmIomodeIndividual, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(11, file = infile, status = 'old', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', infile + call pvmfexit(ierr) + stop + endif + + 10 read(11, '(A31)', iostat = ierr, err = 30, end = 20) buf + write(10, '(A31)', iostat = ierr, err = 40) buf + go to 10 + + 20 close(11, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', infile + call pvmfexit(ierr) + stop + endif + close(10, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', outfile + call pvmfexit(ierr) + stop + endif + call pvmfexit(ierr) + call wait4fs + stop + + 30 write(stderr, 50) infile, ': read error' + call pvmfexit(ierr) + stop + 40 write(stderr, 50) outfile, ': write error' + call pvmfexit(ierr) + stop + + 50 format(1x, A, A) + + end *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/independent_r.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,55 ---- + #include + #include + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + int fdr; + int fdw; + char buf[32]; + char wfile[BUFSIZ]; + int nbytes; + + me = startup(&argc, argv); + + pvm_setdefiomode(PvmIomodeIndependent); + if ((fdr = open("../file", O_RDONLY)) == -1) { + perror("../file"); + EXIT(1); + } + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fdw = open(wfile, O_CREAT | O_TRUNC | O_WRONLY, 0600)) == -1) { + perror(wfile); + EXIT(1); + } + do { + if ((nbytes = read(fdr, buf, sizeof buf)) > 0) + if (write(fdw, buf, nbytes) == -1) { + perror("write"); + EXIT(1); + } + } while (nbytes > 0); + if (nbytes == -1) { + perror("read"); + EXIT(1); + } + + if (close(fdr) == -1) + perror("../file"); + if (close(fdw) == -1) + perror(wfile); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/independent_stdc_r.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,55 ---- + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + FILE *fpr; + FILE *fpw; + char buf[32]; + char wfile[BUFSIZ]; + size_t nbytes; + + me = startup(&argc, argv); + + pvm_setdefiomode(PvmIomodeIndependent); + if ((fpr = fopen("../file", "r")) == NULL) { + perror("../file"); + EXIT(1); + } + + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fpw = fopen(wfile, "w")) == NULL) { + perror(wfile); + EXIT(1); + } + + while (nbytes = fread(buf, sizeof *buf, sizeof buf, fpr)) { + if (fwrite(buf, sizeof *buf, nbytes, fpw) != nbytes) { + perror("fwrite"); + EXIT(1); + } + } + + if (ferror(fpr)) { + perror("fread"); + EXIT(1); + } + + if (fclose(fpr) == EOF) + perror("../file"); + if (fclose(fpw) == EOF) + perror(wfile); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/independent_stdc_w.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,54 ---- + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + FILE *fpr; + FILE *fpw; + char buf[32]; + char wfile[BUFSIZ]; + size_t nbytes; + + me = startup(&argc, argv); + + pvm_setdefiomode(PvmIomodeIndependent); + if ((fpw = fopen("../file", "w")) == NULL) { + perror("../file"); + EXIT(1); + } + + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fpr = fopen(wfile, "r")) == NULL) { + perror(wfile); + EXIT(1); + } + + while (nbytes = fread(buf, sizeof *buf, sizeof buf, fpr)) { + if (fwrite(buf, sizeof *buf, nbytes, fpw) != nbytes) { + perror("fwrite"); + EXIT(1); + } + } + if (ferror(fpr)) { + perror("fread"); + EXIT(1); + } + + if (fclose(fpr) == EOF) + perror(wfile); + if (fclose(fpw) == EOF) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/independent_w.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,56 ---- + #include + #include + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + int fdr; + int fdw; + char buf[32]; + char wfile[BUFSIZ]; + int nbytes; + + me = startup(&argc, argv); + + pvm_setdefiomode(PvmIomodeIndependent); + if ((fdw = open("../file", O_CREAT | O_TRUNC | O_WRONLY, 0600)) + == -1) { + perror("../file"); + EXIT(1); + } + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fdr = open(wfile, O_RDONLY)) == -1) { + perror(wfile); + EXIT(1); + } + + while ((nbytes = read(fdr, buf, sizeof buf)) > 0) { + if (write(fdw, buf, nbytes) == -1) { + perror("write"); + EXIT(1); + } + } + if (nbytes == -1) { + perror("read"); + EXIT(1); + } + + if (close(fdr) == -1) + perror(wfile); + if (close(fdw) == -1) + perror("../file"); + + EXIT2(0); + } *** /dev/null Mon Aug 29 14:27:25 1994 --- fsexamples/io/test2 Mon Aug 29 14:17:23 1994 *************** *** 0 **** --- 1,51 ---- + #!/bin/sh + + if [ $# -eq 1 ] + then + machine=$1 + target="common_r common_w independent_r independent_w syncBC_r \ + syncBC_w syncseq_r syncseq_w \ + common_stdc_r common_stdc_w independent_stdc_r independent_stdc_w \ + syncBC_stdc_r syncBC_stdc_w syncseq_stdc_r syncseq_stdc_w \ + common_f_r common_f_w independent_f_r independent_f_w \ + syncBC_f_r syncBC_f_w syncseq_f_r syncseq_f_w" + elif [ $# -eq 2 ] + then + machine=$1 + target=$2 + else + echo Usage: $0 marchine [target] + exit 1 + fi + + if [ X$target = "Xc" ] + then + target="common_r common_w independent_r independent_w syncBC_r \ + syncBC_w syncseq_r syncseq_w" + elif [ X$target = "Xstdc" ] + then + target="common_stdc_r common_stdc_w independent_stdc_r \ + independent_stdc_w syncBC_stdc_r syncBC_stdc_w syncseq_stdc_r \ + syncseq_stdc_w" + elif [ X$target = "Xf" ] + then + target="common_f_r common_f_w independent_f_r independent_f_w \ + syncBC_f_r syncBC_f_w syncseq_f_r syncseq_f_w" + fi + + for i in $target + do + if `echo $i | grep '_f_[rw]$' > /dev/null` + then + p=f + s=f + else + p="" + s=c + fi + echo "Target is $i <---------------------------------------------" + rsh $machine "cd \$PVM_ROOT/fsexamples/io; cp $i.$s ${p}io.$s; \ + \$PVM_ROOT/lib/aimk ${p}io; echo $machine done" + $PVM_ROOT/lib/aimk $i + ls -l *out file + done *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/mkfiles.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,101 ---- + #include + #include + + #define FILENAME1 "0_w" + #define FILENAME2 "1_w" + #define FILENAME3 "01_r" + + #define STRING1 "XXXXXabcdefghijklmnopqrstuvwxyz" + #define STRING2 "XXXXXABCDEFGHIJKLMNOPQRSTUVWXYZ" + + #define NUMBER1 "XXXXX11111111111111111111111111" + #define NUMBER2 "XXXXX22222222222222222222222222" + #define NUMBER3 "XXXXX33333333333333333333333333" + #define NUMBER4 "XXXXX44444444444444444444444444" + #define NUMBER5 "XXXXX55555555555555555555555555" + #define NUMBER6 "XXXXX66666666666666666666666666" + #define NUMBER7 "XXXXX77777777777777777777777777" + #define NUMBER8 "XXXXX88888888888888888888888888" + + #define LINES1 1024 + #define LINES2 1024 + #define LINES3 1536 /* must be a multiple of 8 */ + + #define MAX(a,b) ((a) > (b) ? (a) : (b)) + + int + main(int argc, char **argv) + { + FILE *fp1, *fp2, *fp3; + char string1[33], string2[33], number[8][33]; + char line[6]; + int max; + int i, j; + + if ((fp1 = fopen(FILENAME1, "w")) == NULL) { + perror(FILENAME1); + exit(1); + } + if ((fp2 = fopen(FILENAME2, "w")) == NULL) { + perror(FILENAME2); + exit(1); + } + if ((fp3 = fopen(FILENAME3, "w")) == NULL) { + perror(FILENAME3); + exit(1); + } + + max = MAX(LINES1, LINES2); + max = MAX(max, LINES3); + + strcpy(string1, STRING1); + strcat(string1, "\n"); + strcpy(string2, STRING2); + strcat(string2, "\n"); + + strcpy(number[0], NUMBER1); + strcpy(number[1], NUMBER2); + strcpy(number[2], NUMBER3); + strcpy(number[3], NUMBER4); + strcpy(number[4], NUMBER5); + strcpy(number[5], NUMBER6); + strcpy(number[6], NUMBER7); + strcpy(number[7], NUMBER8); + strcat(number[0], "\n"); + strcat(number[1], "\n"); + strcat(number[2], "\n"); + strcat(number[3], "\n"); + strcat(number[4], "\n"); + strcat(number[5], "\n"); + strcat(number[6], "\n"); + strcat(number[7], "\n"); + + for (i = j = 0; i < max; i++, j++) { + sprintf(line, "%05d", i + 1); + if (i < LINES1) { + memcpy(string1, line, 5); + if (fputs(string1, fp1) == EOF) { + perror(FILENAME1); + exit(1); + } + } + if (i < LINES2) { + memcpy(string2, line, 5); + if (fputs(string2, fp2) == EOF) { + perror(FILENAME2); + exit(1); + } + } + if (i < LINES3) { + if (j == 8) + j = 0; + memcpy(number[j], line, 5); + if (fputs(number[j], fp3) == EOF) { + perror(FILENAME3); + exit(1); + } + } + } + + exit(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/startup.c Mon Aug 29 14:26:53 1994 *************** *** 0 **** --- 1,195 ---- + /* + * Author: Christopher G. Phillips + * Copyright (C) 1993 All Rights Reserved + * + * NOTICE + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted + * provided that the above copyright notice appear in all copies and + * that both the copyright notice and this permission notice appear in + * supporting documentation. + * + * The author makes no representations about the suitability of this + * software for any purpose. This software is provided ``as is'' + * without express or implied warranty. + */ + + #include + #include + #include + #include + #include "pvm3.h" + + #ifndef MAXHOSTNAMELEN + #define MAXHOSTNAMELEN 100 + #endif + + static int *tids; + static int nodes; + static int me; + static int parent; + extern int pvm_errno; + static char *program_name; + + static void + usage(void) + { + fprintf(stderr, "Usage: %s nodes ...\n", program_name); + exit(1); + } + + static void + say_hello(void) + { + char hostname[MAXHOSTNAMELEN]; + + fflush(stdout); + pvm_setiomode(fileno(stdout), PvmIomodeCommon); + pvm_setiomode(fileno(stderr), PvmIomodeCommon); + if (gethostname(hostname, sizeof hostname) == -1) + strcpy(hostname, "Unknown"); + printf("Hello world from node %d running on %s!\n", me, hostname); + fflush(stdout); + } + + static void + standdown(int num_spawned, char *s) + { + int i; + extern int pvmmyfstid; + + pvmmyfstid = 0; + if (s) + pvm_perror(s); + else if (num_spawned == 0) + pvm_perror("pvm_spawn"); + + for (i = 1; i < num_spawned; i++) + if (tids[i] < 0) { + pvm_errno = tids[i]; + pvm_perror("pvm_spawn"); + } else if (pvm_kill(tids[i]) < 0) + pvm_perror("pvm_kill"); + + exit(1); + } + + #define GSYNC_TYPE 0x11000000 + + void + gsync(void) + { + int i; + + if (nodes > 1) { + if (me == 0) { + for (i = 1; i < nodes; i++) + pvm_recv(-1, GSYNC_TYPE); + pvm_initsend(PvmDataDefault); + pvm_mcast(&tids[1], nodes - 1, GSYNC_TYPE + 1); + } else { + pvm_initsend(PvmDataDefault); + pvm_send(parent, GSYNC_TYPE); + pvm_recv(parent, GSYNC_TYPE + 1); + } + } + } + + int + startup(int *argcp, char **argv) + { + int mytid; + char *slash; + int argc = *argcp; + + pvm_usefs(1); + + if (slash = strrchr(argv[0], '/')) + argv[0] = slash + 1; + program_name = argv[0]; + + if ((mytid = pvm_mytid()) < 0) { + pvm_perror("pvm_mytid"); + exit(1); + } + + if ((parent = pvm_parent()) < 0) { + if (argc < 2) + usage(); + + if ((nodes = atoi(argv[1])) <= 0) + usage(); + if (nodes > 1) { + int done = 1; + int i; + int j; + int nhost; + int this_host; + struct pvmhostinfo *hip; + + this_host = pvm_tidtohost(mytid); + if ((tids = malloc(nodes * sizeof(*tids))) == NULL) { + perror(argv[0]); + exit(1); + } + tids[0] = mytid; + + if (pvm_config(&nhost, &j, &hip) < 0) { + pvm_perror("pvm_config"); + exit(1); + } + + for (i = 0; i < nhost; i++) { + j = nodes / nhost; + if (i < nodes % nhost) + j++; + if (hip[i].hi_tid == this_host) + j--; + if (j <= 0) + continue; + + if (pvm_spawn(argv[0], argv + 2, + PvmTaskHost, hip[i].hi_name, j, &tids[done]) + != j) + standdown(done, NULL); + + done += j; + } + + for (i = 1; i < argc; i++) + argv[i] = argv[i + 1]; + (*argcp)--; + + if (pvm_packf("%+ %d %*d", PvmDataDefault, nodes, nodes, + tids) < 0) + standdown(done, "pvm_packf"); + if (pvm_mcast(&tids[1], nodes - 1, 32767) < 0) + standdown(done, "pvm_mcast"); + } + me = 0; + } else { + if (pvm_recv(parent, 32767) < 0) + standdown(0, "pvm_recv"); + if (pvm_unpackf("%d", &nodes) < 0) + standdown(0, "pvm_unpackf"); + + if ((tids = malloc(nodes * sizeof(*tids))) == NULL) { + perror("malloc"); + exit(1); + } + if (pvm_unpackf("%*d", nodes, tids) < 0) + standdown(0, "pvm_unpackf"); + + for (me = nodes; me > 0; me--) + if (tids[me] == mytid) + break; + /*assert(me);*/ + } + + say_hello(); + + gsync(); + + return me; + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncBC_f_r.f Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,86 ---- + program syncBC_f_r + include '../../include/fpvm3.h' + integer stderr + parameter (stderr = 0) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer startup + integer ierr + character*31 buf, infile, outfile + character*1 cme + + nodes = 3 + me = startup('fio') + call pvmfsetioorder(me, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetioorder', ierr) + call pvmfexit(ierr) + stop + endif + + infile = '../file' + call pvmfsetdefiomode(PvmIomodeSyncBC, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(10, file = infile, status = 'old', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', infile + call pvmfexit(ierr) + stop + endif + + if (me .eq. 0) then + cme = '0' + else if (me .eq. 1) then + cme = '1' + else + cme = '2' + endif + + outfile = '../' // cme // '.out' + call pvmfsetdefiomode(PvmIomodeIndividual, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(11, file = outfile, status = 'unknown', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', outfile + call pvmfexit(ierr) + stop + endif + + 10 read(10, '(A31)', iostat = ierr, err = 30, end = 20) buf + write(11, '(A31)', iostat = ierr, err = 40) buf + go to 10 + + 20 close(10, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', infile + call pvmfexit(ierr) + stop + endif + close(11, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', outfile + call pvmfexit(ierr) + stop + endif + call pvmfexit(ierr) + call wait4fs + stop + + 30 write(stderr, 50) infile, ': read error' + call pvmfexit(ierr) + stop + 40 write(stderr, 50) outfile, ': write error' + call pvmfexit(ierr) + stop + + 50 format(1x, A, A) + + end *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncBC_f_w.f Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,86 ---- + program syncBC_f_w + include '../../include/fpvm3.h' + integer stderr + parameter (stderr = 0) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer startup + integer ierr + character*31 buf, infile, outfile + character*1 cme + + nodes = 2 + me = startup('fio') + call pvmfsetioorder(me, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetioorder', ierr) + call pvmfexit(ierr) + stop + endif + + outfile = '../file' + call pvmfsetdefiomode(PvmIomodeSyncBC, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(10, file = outfile, status = 'unknown', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', outfile + call pvmfexit(ierr) + stop + endif + + if (me .eq. 0) then + cme = '0' + else if (me .eq. 1) then + cme = '1' + else + cme = '2' + endif + + infile = '../' // cme // '.out' + call pvmfsetdefiomode(PvmIomodeIndividual, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(11, file = infile, status = 'old', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', infile + call pvmfexit(ierr) + stop + endif + + 10 read(11, '(A31)', iostat = ierr, err = 30, end = 20) buf + write(10, '(A31)', iostat = ierr, err = 40) buf + go to 10 + + 20 close(11, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', infile + call pvmfexit(ierr) + stop + endif + close(10, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', outfile + call pvmfexit(ierr) + stop + endif + call pvmfexit(ierr) + call wait4fs + stop + + 30 write(stderr, 50) infile, ': read error' + call pvmfexit(ierr) + stop + 40 write(stderr, 50) outfile, ': write error' + call pvmfexit(ierr) + stop + + 50 format(1x, A, A) + + end *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncBC_r.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,55 ---- + #include + #include + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + int fdr; + int fdw; + char buf[32]; + char wfile[BUFSIZ]; + int nbytes; + + me = startup(&argc, argv); + + pvm_setioorder(me); + pvm_setdefiomode(PvmIomodeSyncBC); + if ((fdr = open("../file", O_RDONLY)) == -1) { + perror("../file"); + EXIT(1); + } + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fdw = open(wfile, O_CREAT | O_TRUNC | O_WRONLY, 0600)) == -1) { + perror(wfile); + EXIT(1); + } + while ((nbytes = read(fdr, buf, sizeof buf)) > 0) { + if (write(fdw, buf, nbytes) == -1) { + perror("write"); + EXIT(1); + } + } + if (nbytes == -1) { + perror("read"); + EXIT(1); + } + + if (close(fdr) == -1) + perror(wfile); + if (close(fdw) == -1) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncBC_stdc_r.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,55 ---- + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + FILE *fpr; + FILE *fpw; + char buf[32]; + char wfile[BUFSIZ]; + size_t nbytes; + + me = startup(&argc, argv); + + pvm_setioorder(me); + pvm_setdefiomode(PvmIomodeSyncBC); + if ((fpr = fopen("../file", "r")) == NULL) { + perror("../file"); + EXIT(1); + } + + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fpw = fopen(wfile, "w")) == NULL) { + perror(wfile); + EXIT(1); + } + + while (nbytes = fread(buf, sizeof *buf, sizeof buf, fpr)) { + if (fwrite(buf, sizeof *buf, nbytes, fpw) != nbytes) { + perror("fwrite"); + EXIT(1); + } + } + if (ferror(fpr)) { + perror("fread"); + EXIT(1); + } + + if (fclose(fpr) == EOF) + perror(wfile); + if (fclose(fpw) == EOF) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncBC_stdc_w.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,55 ---- + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + FILE *fpr; + FILE *fpw; + char buf[32]; + char wfile[BUFSIZ]; + size_t nbytes; + + me = startup(&argc, argv); + + pvm_setioorder(me); + pvm_setdefiomode(PvmIomodeSyncBC); + if ((fpw = fopen("../file", "w")) == NULL) { + perror("../file"); + EXIT(1); + } + + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fpr = fopen(wfile, "r")) == NULL) { + perror(wfile); + EXIT(1); + } + + while (nbytes = fread(buf, sizeof *buf, sizeof buf, fpr)) { + if (fwrite(buf, sizeof *buf, nbytes, fpw) != nbytes) { + perror("fwrite"); + EXIT(1); + } + } + if (ferror(fpr)) { + perror("fread"); + EXIT(1); + } + + if (fclose(fpr) == EOF) + perror(wfile); + if (fclose(fpw) == EOF) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncBC_w.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,56 ---- + #include + #include + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + int fdr; + int fdw; + char buf[32]; + char wfile[BUFSIZ]; + int nbytes; + + me = startup(&argc, argv); + + pvm_setioorder(me); + pvm_setdefiomode(PvmIomodeSyncBC); + if ((fdw = open("../file", O_CREAT | O_TRUNC | O_WRONLY, 0600)) + == -1) { + perror("../file"); + EXIT(1); + } + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fdr = open(wfile, O_RDONLY)) == -1) { + perror(wfile); + EXIT(1); + } + while ((nbytes = read(fdr, buf, sizeof buf)) > 0) { + if (write(fdw, buf, nbytes) == -1) { + perror("write"); + EXIT(1); + } + } + if (nbytes == -1) { + perror("read"); + EXIT(1); + } + + if (close(fdr) == -1) + perror(wfile); + if (close(fdw) == -1) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncseq_f_r.f Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,86 ---- + program syncseq_f_r + include '../../include/fpvm3.h' + integer stderr + parameter (stderr = 0) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer startup + integer ierr + character*31 buf, infile, outfile + character*1 cme + + nodes = 3 + me = startup('fio') + call pvmfsetioorder(me, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetioorder', ierr) + call pvmfexit(ierr) + stop + endif + + infile = '../file' + call pvmfsetdefiomode(PvmIomodeSyncSeq, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(10, file = infile, status = 'old', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', infile + call pvmfexit(ierr) + stop + endif + + if (me .eq. 0) then + cme = '0' + else if (me .eq. 1) then + cme = '1' + else + cme = '2' + endif + + outfile = '../' // cme // '.out' + call pvmfsetdefiomode(PvmIomodeIndividual, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(11, file = outfile, status = 'unknown', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', outfile + call pvmfexit(ierr) + stop + endif + + 10 read(10, '(A31)', iostat = ierr, err = 30, end = 20) buf + write(11, '(A31)', iostat = ierr, err = 40) buf + go to 10 + + 20 close(10, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', infile + call pvmfexit(ierr) + stop + endif + close(11, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', outfile + call pvmfexit(ierr) + stop + endif + call pvmfexit(ierr) + call wait4fs + stop + + 30 write(stderr, 50) infile, ': read error' + call pvmfexit(ierr) + stop + 40 write(stderr, 50) outfile, ': write error' + call pvmfexit(ierr) + stop + + 50 format(1x, A, A) + + end *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncseq_f_w.f Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,86 ---- + program syncseq_f_w + include '../../include/fpvm3.h' + integer stderr + parameter (stderr = 0) + common /mvp/ tids(3), nodes, me, parent + integer tids, nodes, me, parent + integer startup + integer ierr + character*31 buf, infile, outfile + character*1 cme + + nodes = 2 + me = startup('fio') + call pvmfsetioorder(me, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetioorder', ierr) + call pvmfexit(ierr) + stop + endif + + outfile = '../file' + call pvmfsetdefiomode(PvmIomodeSyncSeq, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(10, file = outfile, status = 'unknown', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', outfile + call pvmfexit(ierr) + stop + endif + + if (me .eq. 0) then + cme = '0' + else if (me .eq. 1) then + cme = '1' + else + cme = '2' + endif + + infile = '../' // cme // '.out' + call pvmfsetdefiomode(PvmIomodeIndividual, ierr) + if (ierr .ne. 0) then + call pvmfperror('pvmfsetdefiomode', ierr) + call pvmfexit(ierr) + stop + endif + open(11, file = infile, status = 'old', iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Can''t open ', infile + call pvmfexit(ierr) + stop + endif + + 10 read(11, '(A31)', iostat = ierr, err = 30, end = 20) buf + write(10, '(A31)', iostat = ierr, err = 40) buf + go to 10 + + 20 close(11, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', infile + call pvmfexit(ierr) + stop + endif + close(10, iostat = ierr) + if (ierr .ne. 0) then + write(stderr, 50) 'Close error: ', outfile + call pvmfexit(ierr) + stop + endif + call pvmfexit(ierr) + call wait4fs + stop + + 30 write(stderr, 50) infile, ': read error' + call pvmfexit(ierr) + stop + 40 write(stderr, 50) outfile, ': write error' + call pvmfexit(ierr) + stop + + 50 format(1x, A, A) + + end *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncseq_r.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,55 ---- + #include + #include + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + int fdr; + int fdw; + char buf[32]; + char wfile[BUFSIZ]; + int nbytes; + + me = startup(&argc, argv); + + pvm_setioorder(me); + pvm_setdefiomode(PvmIomodeSyncSeq); + if ((fdr = open("../file", O_RDONLY)) == -1) { + perror("../file"); + EXIT(1); + } + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fdw = open(wfile, O_CREAT | O_TRUNC | O_WRONLY, 0600)) == -1) { + perror(wfile); + EXIT(1); + } + while ((nbytes = read(fdr, buf, sizeof buf)) > 0) { + if (write(fdw, buf, nbytes) == -1) { + perror("write"); + EXIT(1); + } + } + if (nbytes == -1) { + perror("read"); + EXIT(1); + } + + if (close(fdr) == -1) + perror(wfile); + if (close(fdw) == -1) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncseq_stdc_r.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,55 ---- + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + FILE *fpr; + FILE *fpw; + char buf[32]; + char wfile[BUFSIZ]; + size_t nbytes; + + me = startup(&argc, argv); + + pvm_setioorder(me); + pvm_setdefiomode(PvmIomodeSyncSeq); + if ((fpr = fopen("../file", "r")) == NULL) { + perror("../file"); + EXIT(1); + } + + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fpw = fopen(wfile, "w")) == NULL) { + perror(wfile); + EXIT(1); + } + + while (nbytes = fread(buf, sizeof *buf, sizeof buf, fpr)) { + if (fwrite(buf, sizeof *buf, nbytes, fpw) != nbytes) { + perror("fwrite"); + EXIT(1); + } + } + if (ferror(fpr)) { + perror("fread"); + EXIT(1); + } + + if (fclose(fpr) == EOF) + perror(wfile); + if (fclose(fpw) == EOF) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncseq_stdc_w.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,56 ---- + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + FILE *fpr; + FILE *fpw; + char buf[32], fpwbuf[32]; + char wfile[BUFSIZ]; + size_t nbytes; + + me = startup(&argc, argv); + + pvm_setioorder(me); + pvm_setdefiomode(PvmIomodeSyncSeq); + if ((fpw = fopen("../file", "w")) == NULL) { + perror("../file"); + EXIT(1); + } + setvbuf(fpw, fpwbuf, _IOFBF, sizeof fpwbuf); + + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fpr = fopen(wfile, "r")) == NULL) { + perror(wfile); + EXIT(1); + } + + while (nbytes = fread(buf, sizeof *buf, sizeof buf, fpr)) { + if (fwrite(buf, sizeof *buf, nbytes, fpw) != nbytes) { + perror("fwrite"); + EXIT(1); + } + } + if (ferror(fpr)) { + perror("fread"); + EXIT(1); + } + + if (fclose(fpr) == EOF) + perror(wfile); + if (fclose(fpw) == EOF) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/syncseq_w.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,56 ---- + #include + #include + #include + #include + #include + #include + + #define EXIT pvm_exit(), exit + #define EXIT2 pvm_exit(), wait4fs(), exit + + extern int startup __ProtoGlarp__((int *, char **)); + extern void wait4fs __ProtoGlarp__((void)); + + int + main(int argc, char **argv) + { + int me; + int fdr; + int fdw; + char buf[32]; + char wfile[BUFSIZ]; + int nbytes; + + me = startup(&argc, argv); + + pvm_setioorder(me); + pvm_setdefiomode(PvmIomodeSyncSeq); + if ((fdw = open("../file", O_CREAT | O_TRUNC | O_WRONLY, 0600)) + == -1) { + perror("../file"); + EXIT(1); + } + sprintf(wfile, "../%d.out", me); + pvm_setdefiomode(PvmIomodeIndividual); + if ((fdr = open(wfile, O_RDONLY)) == -1) { + perror(wfile); + EXIT(1); + } + while ((nbytes = read(fdr, buf, sizeof buf)) > 0) { + if (write(fdw, buf, nbytes) == -1) { + perror("write"); + EXIT(1); + } + } + if (nbytes == -1) { + perror("read"); + EXIT(1); + } + + if (close(fdr) == -1) + perror(wfile); + if (close(fdw) == -1) + perror("../file"); + + EXIT2(0); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/io/wait4fs.c Sun Jul 24 18:14:54 1994 *************** *** 0 **** --- 1,29 ---- + #include + #include + + void + wait4fs(void) + { + int status; + + while (wait(&status) != -1) + ; + } + + void + wait4fs_(void) + { + wait4fs(); + } + + void + WAIT4FS(void) + { + wait4fs(); + } + + void + WAIT4FS_(void) + { + wait4fs(); + } *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/iot/Makefile.aimk Tue Jul 26 09:06:27 1994 *************** *** 0 **** --- 1,26 ---- + # Imports: + # PVM_ARCH = the official pvm-name of your processor + # ARCHCFLAGS = special cc flags + # ARCHLIB = special libs needed for daemon + # + SHELL = /bin/sh + CC = cc + PVMIDIR = ../../../include + PVMLDIR = ../../../lib/$(PVM_ARCH) + PVMLIB = -lpvm3 + LIBS = -g -L$(PVMLDIR) $(PVMLIB) $(ARCHFSLIB) + PVMFSLDIR= ../../../libc/$(PVM_ARCH) + FSOBJS = $(PVMFSLDIR)/syscalls.o $(PVMFSLDIR)/pvmerrno.o $(PVMFSLDIR)/posix.o + CFLAGS = -g -I$(PVMIDIR) -I$(PVMFSLDIR) -DIMA_$(PVM_ARCH) $(ARCHCFLAGS) -DPVMFS -I../../../src #-DDEBUG + OBJS = iot.o + + iot: $(OBJS) $(PVMLDIR)/libpvm3.a $(FSOBJS) + $(SCC) -o $@ $(OBJS) $(FSOBJS) $(LIBS) + -@rm -f $(HOME)/pvm3/bin/$(PVM_ARCH)/$@ + -@ln -s `pwd`/$@ $(HOME)/pvm3/bin/$(PVM_ARCH) + + iot.o: ../iot.c + $(SCC) $(CFLAGS) -c ../iot.c + + clean: + rm -f $(OBJS) iot *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/iot/PMAX/Makefile Sun Jul 24 18:14:55 1994 *************** *** 0 **** --- 1,28 ---- + # Imports: + # PVM_ARCH = the official pvm-name of your processor + # ARCHCFLAGS = special cc flags + # ARCHLIB = special libs needed for daemon + # + SHELL = /bin/sh + CC = cc + PVMIDIR = ../../../include + PVMLDIR = ../../../lib/$(PVM_ARCH) + PVMLIB = -lpvm3 + LIBS = -g -L$(PVMLDIR) $(PVMLIB) $(ARCHFSLIB) -YSYSTEM_FIVE + PVMFSLDIR= ../../../libc/$(PVM_ARCH) + FSOBJS = $(PVMFSLDIR)/syscalls.o $(PVMFSLDIR)/pvmerrno.o $(PVMFSLDIR)/posix.o + CFLAGS = -g -I$(PVMIDIR) -I$(PVMFSLDIR) -DIMA_$(PVM_ARCH) $(ARCHCFLAGS) -DPVMFS -I../../../src -YSYSTEM_FIVE #-DDEBUG + OBJS = iot.o + + include ../../../conf/PMAX.def + + iot: $(OBJS) $(PVMLDIR)/libpvm3.a $(FSOBJS) + $(SCC) -o $@ $(OBJS) $(FSOBJS) $(LIBS) + -@rm -f $(HOME)/pvm3/bin/$(PVM_ARCH)/$@ + -@ln -s `pwd`/$@ $(HOME)/pvm3/bin/$(PVM_ARCH) + + iot.o: ../iot.c + $(SCC) $(CFLAGS) -c ../iot.c + + clean: + rm -f $(OBJS) iot *** /dev/null Thu Aug 25 19:19:25 1994 --- fsexamples/iot/iot.c Sun Jul 24 18:14:55 1994 *************** *** 0 **** --- 1,2226 ---- + /* + * Author: Christopher G. Phillips + * Copyright (C) 1993 All Rights Reserved + * + * NOTICE + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted + * provided that the above copyright notice appear in all copies and + * that both the copyright notice and this permission notice appear in + * supporting documentation. + * + * The author makes no representations about the suitability of this + * software for any purpose. This software is provided ``as is'' + * without express or implied warranty. + */ + + #ifdef IMA_SUN4 + #define sprintf ugh + #endif + #include + #include + #include + #include + #ifdef IMA_CRAY + #define _POSIX_SOURCE + #endif + #include + #include + #ifdef IMA_CRAY + #undef _POSIX_SOURCE + #endif + #ifdef IMA_CRAY + #include + #define RLIM_INFINITY 0 + #define RLIMIT_CORE 1 + #define RLIMIT_FSIZE 2 + #define RLIMIT_NOFILE 3 + + typedef unsigned long rlim_t; + + struct rlimit { + rlim_t rlim_cur; + rlim_t rlim_max; + }; + #endif + #include + #include + #include + #include + #include + #ifdef IMA_CRAY + #define _POSIX_SOURCE + #endif + #include + #include + #include + #include + + #if !defined(IMA_RS6K) && !defined(IMA_CRAY) + #include + #include + #else + #include + #include "syscall-fake.h" + #endif + #ifndef PATH_MAX + #define PATH_MAX 1024 + #endif + #ifdef IMA_SUN4 + #undef sprintf + int sprintf __ProtoGlarp__((char *, const char *, ...)); + + char * + strerror(int num) + { + extern int sys_nerr; + extern char *sys_errlist[]; + + if (num > 0 && num < sys_nerr) + return sys_errlist[num]; + else + return "???"; + } + #endif + + #ifdef rewinddir + #undef rewinddir + extern void rewinddir __ProtoGlarp__((DIR *)); + #endif + + #define NUMFPS 10 + static struct { + int used; + FILE *fp; + } gfp[NUMFPS]; + + extern int errno; + static char prompt[] = "pvm$ "; + + #ifndef MAXHOSTNAMELEN + #define MAXHOSTNAMELEN 1024 + #endif + + static void + say_hello(void) + { + char hostname[MAXHOSTNAMELEN]; + + if (gethostname(hostname, sizeof hostname) == -1) + strcpy(hostname, "Unknown"); + printf("Reading commands on %s!\n", hostname); + } + + int + main(int argc, char **argv) + { + int me; + int int1, int2, int3, int4; + int saved_errno; + int retval; + int n; + struct stat st; + struct timeval tv[2], *tvp; + fd_set wset, rset, eset; + fd_set *wsetp, *rsetp, *esetp; + struct flock flock; + struct rlimit rl; + char path1[PATH_MAX], path2[PATH_MAX]; + char buf[BUFSIZ]; + char rwbuf[BUFSIZ]; + char *cp; + long long1, long2, long3, long4; + long offset1, offset2, offset3, offset4; + unsigned long ul1, ul2; + DIR *dp; + FILE *fp; + #ifndef IMA_SUN4 + fpos_t fpos1; + #endif + struct dirent *dirp; + struct utimbuf ut, *utp; + + int other; + #ifdef DEBUG + extern int pvmdebug; + + pvmdebug = 1; + #endif + + pvm_usefs(1); + + if ((other = pvm_parent()) < 0) { + #ifndef DEBUG + char *slash; + + if (slash = strrchr(argv[0], '/')) + argv[0] = slash + 1; + if (pvm_spawn(argv[0], argv, + argc > 1 ? PvmTaskHost : PvmTaskDefault, + argc > 1 ? argv[1] : NULL, 1, &other) != 1) { + extern int pvm_errno; + + pvm_errno = other; + pvm_perror("pvm_spawn"); + exit(1); + } + #endif + me = 0; + } else + me = 1; + #ifdef DEBUG + me = !me; + #endif + + if (pvm_setiomode(0, PvmIomodeCommon) == -1) + perror("pvm_setiomode"); + if (pvm_setiomode(1, PvmIomodeCommon) == -1) + perror("pvm_setiomode"); + if (pvm_setiomode(2, PvmIomodeCommon) == -1) + perror("pvm_setiomode"); + + if (me == 0) { + pvm_notify(PvmTaskExit, 10, 1, &other); + pvm_recv(-1, 10); + pvm_exit(); + exit(0); + } else + say_hello(); + + for (n = 0; n < NUMFPS; n++) { + gfp[n].used = n < 3; + gfp[n].fp = NULL; + } + gfp[0].fp = stdin; + gfp[1].fp = stdout; + gfp[2].fp = stderr; + + top: + write(1, prompt, sizeof prompt - 1); + while ((n = read(0, buf, sizeof buf - 1)) > 0) { + buf[n] = '\0'; + n = 0; + if (strncmp(buf, "rename ", sizeof("rename")) == 0) { + if (sscanf(buf + sizeof("rename"), "%s %s", path1, + path2) == 2) { + retval = rename(path1, path2); + saved_errno = errno; + n += sprintf(buf + n, + "rename(\"%s\", \"%s\") = %d", + path1, path2, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else + n += sprintf(buf + n, + "usage: rename path1 path2\n"); + } else if (strncmp(buf, "fcntl ", sizeof("fcntl")) == 0) { + if (sscanf(buf + sizeof("fcntl"), "%d %d %d", + &int1, &int2, &int3) == 3) { + retval = fcntl(int1, int2, int3); + saved_errno = errno; + n += sprintf(buf + n, "fcntl(%d, %d, %d) = %d", + int1, int2, int3, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else if (sscanf(buf + sizeof("fcntl"), + "%d %d %ld %ld %ld %ld", &int1, &int2, &long1, &long2, + &long3, &long4) == 6) { + flock.l_type = long1; + flock.l_start = long2; + flock.l_whence = long3; + flock.l_len = long4; + retval = fcntl(int1, int2, &flock); + saved_errno = errno; + n += sprintf(buf + n, + "fcntl(%d, %d, <%ld, %ld, %ld, %ld>) = %d", + int1, int2, long1, long2, long3, long4, + retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else { + n += sprintf(buf + n, + "usage: fcntl fd cmd arg\n"); + n += sprintf(buf + n, + "or fcntl fd cmd l_type l_start l_whence l_len\n"); + } + } else if (strncmp(buf, "link ", sizeof("link")) == 0) { + if (sscanf(buf + sizeof("link"), "%s %s", path1, path2) + == 2) { + retval = link(path1, path2); + saved_errno = errno; + n += sprintf(buf + n, + "link(\"%s\", \"%s\") = %d", + path1, path2, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else + n += sprintf(buf + n, + "usage: link path1 path2\n"); + } else if (strncmp(buf, "symlink ", sizeof("symlink")) == 0) { + if (sscanf(buf + sizeof("symlink"), "%s %s", path1, + path2) == 2) { + retval = symlink(path1, path2); + saved_errno = errno; + n += sprintf(buf + n, + "symlink(\"%s\", \"%s\") = %d", + path1, path2, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else + n += sprintf(buf + n, + "usage: symlink path1 path2\n"); + } else if (strncmp(buf, "mkdir ", sizeof("mkdir")) == 0) { + if (sscanf(buf + sizeof("mkdir"), "%s %lo", path1, + &long1) == 2) { + retval = mkdir(path1, long1); + saved_errno = errno; + n += sprintf(buf + n, + "mkdir(\"%s\", %04o) = %d", + path1, (int)long1, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else + n += sprintf(buf + n, + "usage: mkdir path octal_mode\n"); + } else if (strncmp(buf, "readlink ", sizeof("readlink")) == 0) { + if (sscanf(buf + sizeof("readlink"), "%s %d", path1, + &int1) == 2) { + path2[0] = '\0'; + retval = readlink(path1, path2, int1); + saved_errno = errno; + n += sprintf(buf + n, + "readlink(\"%s\", \"%s\", %d) = %d", + path1, path2, int1, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else + n += sprintf(buf + n, + "usage: readlink path length\n"); + } else if (strncmp(buf, "mkfifo ", sizeof("mkfifo")) == 0) { + if (sscanf(buf + sizeof("mkfifo"), "%s %lo", path1, + &long1) == 2) { + retval = mkfifo(path1, long1); + saved_errno = errno; + n += sprintf(buf + n, + "mkfifo(\"%s\", %04o) = %d", + path1, (int)long1, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else + n += sprintf(buf + n, + "usage: mkfifo path octal_mode\n"); + } else if (strncmp(buf, "mknod ", sizeof("mknod")) == 0) { + if (sscanf(buf + sizeof("mknod"), "%s %lo %d", path1, + &long1, &int1) == 3) { + retval = mknod(path1, long1, int1); + saved_errno = errno; + n += sprintf(buf + n, + "mknod(\"%s\", %04o, %d) = %d", + path1, (int)long1, int1, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else + n += sprintf(buf + n, + "usage: mknod path octal_mode device\n"); + } else if (strncmp(buf, "truncate ", sizeof("truncate")) == 0) { + if (sscanf(buf + sizeof("truncate"), "%s %ld", path1, + &long1) == 2) { + retval = truncate(path1, long1); + saved_errno = errno; + n += sprintf(buf + n, + "truncate(\"%s\", %ld) = %d", + path1, long1, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else + n += sprintf(buf + n, + "usage: truncate path length\n"); + } else if (strncmp(buf, "ftruncate ", sizeof("ftruncate")) + == 0) { + if (sscanf(buf + sizeof("ftruncate"), "%d %ld", + &int1, &long1) == 2) { + retval = ftruncate(int1, long1); + saved_errno = errno; + n += sprintf(buf + n, + "ftruncate(%d, %ld) = %d", + int1, long1, retval); + errno = saved_errno; + if (retval == -1) + n += sprintf(buf + n, " (%s)", + strerror(errno)); + n += sprintf(buf + n, "\n"); + } else + n += sprintf(buf + n, + "usage: f