home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / cray / 271 < prev    next >
Encoding:
Text File  |  1992-09-14  |  2.3 KB  |  71 lines

  1. Newsgroups: comp.unix.cray
  2. Path: sparky!uunet!gatech!mailer.cc.fsu.edu!loligo.cc.fsu.edu!bauer
  3. From: bauer@loligo.cc.fsu.edu (Jeff Bauer)
  4. Subject: How to get around lack of statd/lockd on UNICOS
  5. Message-ID: <1992Sep15.141839.21110@mailer.cc.fsu.edu>
  6. Sender: news@mailer.cc.fsu.edu (Usenet News File Owner)
  7. Nntp-Posting-Host: loligo.cc.fsu.edu
  8. Organization: Florida State University Academic Computing & Network Services
  9. Date: Tue, 15 Sep 92 14:18:39 GMT
  10. Lines: 59
  11.  
  12. Cray apparently chose not to support the statd/lockd daemon on UNICOS.
  13.  
  14. We have a third party application running on an RS/6000 using a data file
  15. that is NFS mounted from the Cray.  It behaves VERY slowly and the RS/6000
  16. console whines about not being able to talk to statd/lockd on the Cray.
  17.  
  18. It is the flock() call causing the problem.  This program
  19. runs immediately when locking a file on a local disk as well as a file system
  20. mounted from an AIX host and SunOS NFS server.  It hangs at
  21. the "Locking file..." message when using a file NFS-mounted from the Cray.
  22. The absence or presence of the local lockd/statd daemons makes no difference.  
  23. It does, however, cause the other NFS cases (AIX and Sun) to hang until they
  24. are running.
  25.  
  26. Does anybody know of a work around for this?  I can either spoof the Cray
  27. with a dummy statd/lockd daemon(s) or somehow tell AIX not to use statd/lockd
  28. and ignore any file locks.
  29.  
  30. Any help or pointers would be greatly appreciated!
  31.  
  32. -- flock.c --
  33. #include <stdio.h>
  34. #include <fcntl.h>
  35. #include <sys/file.h>
  36.  
  37. main(argc, argv)
  38. int argc;
  39. char **argv;
  40. {
  41.         int fd;
  42.  
  43.         if (argc != 2) {
  44.           fprintf(stderr, "Usage : %s file\n", argv[0]);
  45.           exit(1);
  46.         }
  47.  
  48.         printf("Opening file...\n");
  49.         if ((fd = open(argv[1], O_RDWR)) < 0) {
  50.           fprintf(stderr, "Cannot open file `%s'\n", argv[1]);
  51.           perror("open");
  52.           exit(1);
  53.         }
  54.  
  55.         printf("Locking file...\n");
  56.         if (flock(fd, LOCK_EX) < 0) {
  57.           perror("flock lock");
  58.           exit(1);
  59.         }
  60.         printf("Unlocking file...\n");
  61.         if (flock(fd, LOCK_UN) < 0) {
  62.           perror("flock unlock");
  63.           exit(1);
  64.         }
  65.         close(fd);
  66.         printf("All done!\n");
  67. }
  68. --
  69. Jeff Bauer                   jtbauer@cc.fsu.edu
  70. FSU Academic Computing & Network Services  (904) 644-2591 x. 113
  71.