Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / zotnet / mts / RCS / lock.c,v
1 head    2.19;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 2.19
9 date    93.08.25.17.33.09;      author jromine; state Exp;
10 branches;
11 next    2.18;
12
13 2.18
14 date    92.11.12.23.26.49;      author jromine; state Exp;
15 branches;
16 next    2.17;
17
18 2.17
19 date    92.11.12.19.32.01;      author jromine; state Exp;
20 branches;
21 next    2.16;
22
23 2.16
24 date    92.11.12.19.29.42;      author jromine; state Exp;
25 branches;
26 next    2.15;
27
28 2.15
29 date    92.11.12.01.04.29;      author jromine; state Exp;
30 branches;
31 next    2.14;
32
33 2.14
34 date    92.11.11.20.55.04;      author jromine; state Exp;
35 branches;
36 next    2.13;
37
38 2.13
39 date    92.11.06.03.23.24;      author jromine; state Exp;
40 branches;
41 next    2.12;
42
43 2.12
44 date    92.11.02.18.58.35;      author jromine; state Exp;
45 branches;
46 next    2.11;
47
48 2.11
49 date    92.10.27.16.42.22;      author jromine; state Exp;
50 branches;
51 next    2.10;
52
53 2.10
54 date    92.10.16.16.52.18;      author jromine; state Exp;
55 branches;
56 next    2.9;
57
58 2.9
59 date    92.02.07.19.25.18;      author jromine; state Exp;
60 branches;
61 next    2.8;
62
63 2.8
64 date    92.02.07.17.47.51;      author jromine; state Exp;
65 branches;
66 next    2.7;
67
68 2.7
69 date    92.02.07.17.25.22;      author jromine; state Exp;
70 branches;
71 next    2.6;
72
73 2.6
74 date    92.02.05.19.10.05;      author jromine; state Exp;
75 branches;
76 next    2.5;
77
78 2.5
79 date    92.01.31.22.35.13;      author jromine; state Exp;
80 branches;
81 next    2.4;
82
83 2.4
84 date    91.01.18.08.43.29;      author mh;      state Exp;
85 branches;
86 next    2.3;
87
88 2.3
89 date    90.04.05.15.04.28;      author sources; state Exp;
90 branches;
91 next    2.2;
92
93 2.2
94 date    90.02.06.13.41.44;      author sources; state Exp;
95 branches;
96 next    2.1;
97
98 2.1
99 date    90.02.01.14.36.01;      author sources; state Exp;
100 branches;
101 next    2.0;
102
103 2.0
104 date    89.11.17.15.58.35;      author sources; state Exp;
105 branches;
106 next    1.1;
107
108 1.1
109 date    89.11.17.15.44.58;      author sources; state Exp;
110 branches;
111 next    ;
112
113
114 desc
115 @@
116
117
118 2.19
119 log
120 @off_t fixes for BSD44
121 @
122 text
123 @/* lock.c - universal locking routines */
124 #ifndef lint
125 static char ident[] = "@@(#)$Id: lock.c,v 2.18 1992/11/12 23:26:49 jromine Exp jromine $";
126 #endif
127 /* compile-time priority:
128  *      LOCKF   use if defined
129  *      FCNTL   use if SYS5  defined and LOCKF not defined
130  *      FLOCK   use if BSD42 defined and LOCKF and SYS5 not defined
131  */
132
133 #ifdef  MMDFONLY
134 #define LOCKONLY
135 #endif
136
137 #include "../h/mh.h"
138 #include <stdio.h>
139 #ifndef LOCKONLY
140 #include "../h/strings.h"
141 #include "mts.h"
142 #else   /* LOCKONLY */
143 #include "strings.h"
144 #ifdef  MMDFONLY
145 #include "mmdfonly.h"
146 #include "mts.h"
147 #else   /* not MMDFONLY */
148 #include "lockonly.h"
149 #endif  /* not MMDFONLY */
150 #endif  /* LOCKONLY */
151 #include <sys/types.h>
152 #include <sys/stat.h>
153 #ifdef SVR4
154 #define LOCKF
155 #include <unistd.h>
156 #endif
157 #ifdef  LOCKF
158 #include <sys/errno.h>
159 #include <sys/file.h>
160 #ifndef F_ULOCK
161 #ifdef  UNISTD
162 #include <unistd.h>
163 #else   /* UNISTD */
164 #include <sys/fcntl.h>
165 #endif  /* UNISTD */
166 #endif
167 #endif  /* LOCKF */
168 #if defined(_AIX) || defined(AUX)
169 #include <sys/file.h>
170 #endif
171
172 #ifdef  SYS5
173 #define u_short ushort
174 #define u_long  ulong
175 #endif
176
177
178 #if defined(SYS5) && !defined(_AIX)
179 #define index   strchr
180 #define rindex  strrchr
181 #endif
182 #ifdef  BSD42
183 #define FLOCK           /* LOCKF will override this, if defined */
184 #endif
185
186 extern int  errno;
187
188 #ifdef  LOCKONLY
189 #ifndef MMDFONLY
190 char   *lockldir = "/usr/spool/locks";
191 #endif  /* not MMDFONLY */
192 #endif  /* LOCKONLY */
193
194 static int      b_lkopen(), lockit(), f_lkopen();
195 static          lockname(), timerON(), timerOFF();
196
197 long    time ();
198
199 /* \f */
200
201 int     lkopen (file, access)
202 register char   *file;
203 register int     access;
204 {
205     mts_init ("mts");
206     switch (lockstyle) {
207         case LOK_UNIX:
208 #if     defined (FLOCK) || defined(LOCKF) || defined(FCNTL)
209             return f_lkopen (file, access);
210 #endif
211
212         default:
213             return b_lkopen (file, access);
214         }
215 }
216
217 /* \f */
218
219 static int  b_lkopen (file, access)
220 register char   *file;
221 register int     access;
222 {
223     register int    i,
224                     j;
225     long    curtime;
226     char    curlock[BUFSIZ],
227             tmplock[BUFSIZ];
228     struct stat st;
229
230     if (stat (file, &st) == NOTOK)
231         return NOTOK;
232     lockname (curlock, tmplock, file, (int) st.st_dev, (int) st.st_ino);
233
234     for (i = 0;;)
235         switch (lockit (tmplock, curlock)) {
236             case OK: 
237                 if ((i = open (file, access)) == NOTOK) {
238                     j = errno;
239                     (void) unlink (curlock);
240                     errno = j;
241                 }
242                 timerON (curlock, i);
243                 return i;
244
245             case NOTOK: 
246                 if (stat (curlock, &st) == NOTOK) {
247                     if (i++ > 5)
248                         return NOTOK;
249                     sleep (5);
250                     break;
251                 }
252
253                 i = 0;
254                 (void) time (&curtime);
255                 if (curtime < st.st_ctime + 60L)
256                     sleep (5);
257                 else
258                     (void) unlink (curlock);
259                 break;
260         }
261 }
262
263
264 static int  lockit (tmp, file)
265 register char   *tmp,
266                 *file;
267 {
268     register int    fd;
269
270     if ((fd = creat (tmp, 0400)) == NOTOK)
271         return NOTOK;
272 #if defined(hpux) || defined(ncr)
273     write(fd, "MH lock\n",8);
274 #endif /* hpux */
275     (void) close (fd);
276
277     fd = link (tmp, file);
278     (void) unlink (tmp);
279
280     return (fd != NOTOK ? OK : NOTOK);
281 }
282
283 /* \f */
284
285 static  lockname (curlock, tmplock, file, dev, ino)
286 register char   *curlock,
287                 *tmplock,
288                 *file;
289 register int     dev,
290                  ino;
291 {
292     register char  *bp,
293                    *cp;
294
295     bp = curlock;
296     if ((cp = rindex (file, '/')) == NULL || *++cp == 0)
297         cp = file;
298     if (lockldir == NULL || *lockldir == 0) {
299         if (cp != file) {
300             (void) sprintf (bp, "%.*s", cp - file, file);
301             bp += strlen (bp);
302         }
303     }
304     else {
305         (void) sprintf (bp, "%s/", lockldir);
306         bp += strlen (bp);
307     }
308
309     switch (lockstyle) {
310         case LOK_BELL: 
311         default: 
312             (void) sprintf (bp, "%s.lock", cp);
313             break;
314
315         case LOK_MMDF: 
316             (void) sprintf (bp, "LCK%05d.%05d", dev, ino);
317             break;
318     }
319
320     if (tmplock) {
321         if ((cp = rindex (curlock, '/')) == NULL || *++cp == 0)
322             (void) strcpy (tmplock, ",LCK.XXXXXX");
323         else
324             (void) sprintf (tmplock, "%.*s,LCK.XXXXXX",
325                 cp - curlock, curlock);
326         (void) unlink (mktemp (tmplock));
327     }
328 }
329
330 /* \f */
331
332 #if     defined(FLOCK) || defined(LOCKF) || defined(FCNTL)
333
334 #if     defined(BSD42) || defined(SVR4)
335 #include <sys/file.h>
336 #if     defined(SUN40) || defined(SVR4)
337 #include <sys/fcntl.h>
338 #endif
339 #else 
340 #ifdef  FCNTL
341 #include <fcntl.h>
342 #endif
343 #endif
344
345 static int  f_lkopen (file, access)
346 register char   *file;
347 register int     access;
348 {
349     register int    fd,
350                     i,
351                     j;
352 #ifdef FCNTL
353     struct flock    buf;
354 #endif /* FCNTL */
355
356     for (i = 0; i < 5; i++) {
357 #if defined(LOCKF) || defined(FCNTL)
358         j = access;
359         access &= ~O_APPEND;    /* make sure we open at the beginning */
360         if ((access & 03) == O_RDONLY) {
361         /* We MUST have write permission or lockf/fcntl() won't work */
362         /* (Stupid eh?) */
363             access &= ~O_RDONLY;
364             access |= O_RDWR;
365         }
366 #endif  /* LOCKF || FCNTL */
367         if ((fd = open (file, access | O_NDELAY)) == NOTOK)
368             return NOTOK;
369 #ifndef LOCKF
370 #ifndef FLOCK
371 #ifndef FCNTL
372         /* should be an error? */
373 #else /* FCNTL */
374         buf.l_type = F_WRLCK;
375         buf.l_whence = 0;
376         buf.l_start = 0;
377         buf.l_len = 0;
378         if (fcntl (fd, F_SETLK, &buf) != NOTOK)
379             return fd;
380 #endif
381 #else /* FLOCK */
382         if (flock (fd, LOCK_EX | LOCK_NB) != NOTOK)
383             return fd;
384 #endif
385 #else /* LOCKF */
386         if (lockf (fd, F_TLOCK, 0L) != NOTOK) {
387             /* see if we should be at the end */
388             if (j & O_APPEND)
389 #ifdef SVR4
390                 lseek (fd, (off_t)0, SEEK_END);
391 #else
392                 lseek (fd, (off_t)0, L_XTND);
393 #endif
394             return fd;
395         }
396         /* Fix errno - lockf screws it */
397         if (errno == EACCES)
398             errno = EWOULDBLOCK;
399 #endif
400         j = errno;
401         (void) close (fd);
402
403         sleep (5);
404     }
405
406     (void) close (fd);
407     errno = j;
408     return NOTOK;
409 }
410 #endif  /* FLOCK || LOCKF || FCNTL */
411
412 /* \f */
413
414 /* ARGSUSED */
415
416 int     lkclose (fd, file)
417 register int     fd;
418 register char   *file;
419 {
420     char    curlock[BUFSIZ];
421     struct stat st;
422 #ifdef FCNTL
423     struct flock buf;
424 #endif
425
426     if (fd == NOTOK)
427         return OK;
428     switch (lockstyle) {
429         case LOK_UNIX: 
430 #ifndef LOCKF
431 #ifndef FLOCK
432 #ifndef FCNTL
433         /* should be an error? */
434 #else   /* FCNTL */
435             buf.l_type = F_UNLCK;
436             buf.l_whence = 0;
437             buf.l_start = 0;
438             buf.l_len = 0;
439             fcntl(fd, F_SETLK, &buf);
440             break;
441 #endif
442 #else   /* FLOCK */
443             flock (fd, LOCK_UN);
444             break;
445 #endif
446 #else   /* LOCKF */
447             lseek (fd, (off_t)0, L_SET); /* make sure we unlock the whole thing */
448             lockf (fd, F_ULOCK, 0L);
449             break;
450 #endif  
451
452         default: 
453             if (fstat (fd, &st) != NOTOK) {
454                 lockname (curlock, NULLCP, file, (int) st.st_dev, (int) st.st_ino);
455                 (void) unlink (curlock);
456                 timerOFF (fd);
457             }
458     }
459
460     return (close (fd));
461 }
462
463
464 /* \f */
465
466 FILE    *lkfopen (file, mode)
467 register char   *file,
468                 *mode;
469 {
470     register int    fd;
471     register FILE  *fp;
472
473     if ((fd = lkopen (file, strcmp (mode, "r") ? 2 : 0)) == NOTOK)
474         return NULL;
475
476     if ((fp = fdopen (fd, mode)) == NULL) {
477         (void) close (fd);
478         return NULL;
479     }
480
481     return fp;
482 }
483
484
485 /* ARGSUSED */
486
487 int     lkfclose (fp, file)
488 register FILE   *fp;
489 register char   *file;
490 {
491     char    curlock[BUFSIZ];
492     struct stat st;
493 #ifdef FCNTL
494     struct flock buf;
495 #endif
496
497     if (fp == NULL)
498         return OK;
499
500     switch (lockstyle) {
501         case LOK_UNIX: 
502 #ifndef LOCKF
503 #ifndef FLOCK
504 #ifndef FCNTL
505         /* should be an error? */
506 #else   /* FCNTL */
507             buf.l_type = F_UNLCK;
508             buf.l_whence = 0;
509             buf.l_start = 0;
510             buf.l_len = 0;
511             fcntl(fileno(fp), F_SETLK, &buf);
512             break;
513 #endif
514 #else /* FLOCK */
515             flock (fileno(fp), LOCK_UN);
516             break;
517 #endif
518 #else   /* LOCKF */
519             fseek (fp, 0L, 0); /* make sure we unlock the whole thing */
520             lockf (fileno(fp), F_ULOCK, 0L);
521             break;
522 #endif
523
524         default: 
525             if (fstat (fileno (fp), &st) != NOTOK) {
526                 lockname (curlock, NULLCP, file, (int) st.st_dev, (int) st.st_ino);
527                 (void) unlink (curlock);
528             }
529     }
530
531     return (fclose (fp));
532 }
533
534 /* \f */
535
536 #include <signal.h>
537
538 #define NSECS   ((unsigned) 20)
539
540
541 struct lock {
542     int          l_fd;
543     char        *l_lock;
544     struct lock *l_next;
545 };
546 #define NULLP   ((struct lock *) 0)
547
548 static struct lock *l_top = NULLP;
549
550
551 /* ARGSUSED */
552
553 static TYPESIG alrmser (sig)
554 int     sig;
555 {
556     register int    j;
557     register char  *cp;
558     register struct lock   *lp;
559
560 #ifndef BSD42
561     (void) signal (SIGALRM, alrmser);
562 #endif  /* BSD42 */
563
564     for (lp = l_top; lp; lp = lp -> l_next)
565         if (*(cp = lp -> l_lock) && (j = creat (cp, 0400)) != NOTOK)
566             (void) close (j);
567
568     (void) alarm (NSECS);
569 }
570
571 /* \f */
572
573 static timerON (lock, fd)
574 char   *lock;
575 int     fd;
576 {
577     register struct lock   *lp;
578
579     if ((lp = (struct lock *) malloc ((unsigned) (sizeof *lp))) == NULLP)
580         return;                 /* XXX */
581
582     lp -> l_fd = fd;
583     if ((lp -> l_lock = malloc ((unsigned) (strlen (lock) + 1))) == NULLCP) {
584         free ((char *) lp);
585         return;                 /* XXX */
586     }
587     (void) strcpy (lp -> l_lock, lock);
588     lp -> l_next = NULLP;
589
590     if (l_top)
591         lp -> l_next = l_top -> l_next;
592     else {
593         (void) signal (SIGALRM, alrmser);/* perhaps SIGT{STP,TIN,TOU} */
594         (void) alarm (NSECS);
595     }
596     l_top = lp;
597 }
598
599
600 static timerOFF (fd)
601 int     fd;
602 {
603     register struct lock   *pp,
604                            *lp;
605
606     (void) alarm (0);
607
608     if (l_top) {
609         for (pp = lp = l_top; lp; pp = lp, lp = lp -> l_next)
610             if (lp -> l_fd == fd)
611                 break;
612         if (lp) {
613             if (lp == l_top)
614                 l_top = lp -> l_next;
615             else
616                 pp -> l_next = lp -> l_next;
617
618             free (lp -> l_lock);
619             free ((char *) lp);
620         }
621     }
622
623     if (l_top)
624         (void) alarm (NSECS);
625 }
626 @
627
628
629 2.18
630 log
631 @write to lock file on NCR
632 @
633 text
634 @d3 1
635 a3 1
636 static char ident[] = "@@(#)$Id: lock.c,v 2.17 1992/11/12 19:32:01 jromine Exp jromine $";
637 d268 1
638 a268 1
639                 lseek (fd, 0L, SEEK_END);
640 d270 1
641 a270 1
642                 lseek (fd, 0L, L_XTND);
643 d325 1
644 a325 1
645             lseek (fd, 0L, L_SET); /* make sure we unlock the whole thing */
646 @
647
648
649 2.17
650 log
651 @try to fixup u_short without U_SHORT option
652 @
653 text
654 @d3 1
655 a3 1
656 static char ident[] = "@@(#)$Id: lock.c,v 2.16 1992/11/12 19:29:42 jromine Exp jromine $";
657 d150 1
658 a150 1
659 #ifdef hpux
660 @
661
662
663 2.16
664 log
665 @add U_SHORT
666 @
667 text
668 @d3 1
669 a3 1
670 static char ident[] = "@@(#)$Id: lock.c,v 2.15 1992/11/12 01:04:29 jromine Exp jromine $";
671 a14 5
672 #if     defined(SYS5) && !defined(U_SHORT)
673 #define u_short ushort
674 #define u_long  ulong
675 #endif
676
677 d49 6
678 @
679
680
681 2.15
682 log
683 @SVR4 (u_short)
684 @
685 text
686 @d3 1
687 a3 1
688 static char ident[] = "@@(#)$Id: lock.c,v 2.14 1992/11/11 20:55:04 jromine Exp jromine $";
689 d15 1
690 a15 1
691 #if     defined(SYS5) && !defined(_AIX) && !defined(SVR4)
692 @
693
694
695 2.14
696 log
697 @don't define u_short under aix
698 @
699 text
700 @d3 1
701 a3 1
702 static char ident[] = "@@(#)$Id: lock.c,v 2.13 1992/11/06 03:23:24 jromine Exp jromine $";
703 d15 1
704 a15 1
705 #if     defined(SYS5) && !defined(_AIX)
706 @
707
708
709 2.13
710 log
711 @fixup u_short define for AUX
712 @
713 text
714 @d3 1
715 a3 1
716 static char ident[] = "@@(#)$Id: lock.c,v 2.12 1992/11/02 18:58:35 jromine Exp jromine $";
717 d15 1
718 a15 1
719 #ifdef  SYS5
720 @
721
722
723 2.12
724 log
725 @_AIX
726 @
727 text
728 @d3 1
729 a3 1
730 static char ident[] = "@@(#)$Id: lock.c,v 2.11 1992/10/27 16:42:22 jromine Exp jromine $";
731 d15 5
732 d51 1
733 a51 1
734 #ifdef _AIX
735 @
736
737
738 2.11
739 log
740 @UNISTD
741 @
742 text
743 @d3 1
744 a3 1
745 static char ident[] = "@@(#)$Id: lock.c,v 2.10 1992/10/16 16:52:18 jromine Exp jromine $";
746 d50 1
747 a50 1
748 #ifdef  SYS5
749 @
750
751
752 2.10
753 log
754 @TYPESIG missing on alrmser
755 @
756 text
757 @d3 1
758 a3 1
759 static char ident[] = "@@(#)$Id: lock.c,v 2.9 1992/02/07 19:25:18 jromine Exp jromine $";
760 d15 1
761 d39 1
762 d41 3
763 a48 5
764
765 #define NOTOK   (-1)
766 #define OK      0
767
768 #define NULLCP  ((char *) 0)
769 @
770
771
772 2.9
773 log
774 @SVR4
775 @
776 text
777 @d3 1
778 a3 1
779 static char ident[] = "@@(#)$Id: lock.c,v 2.8 1992/02/07 17:47:51 jromine Exp jromine $";
780 d425 1
781 a425 1
782 static alrmser (sig)
783 @
784
785
786 2.8
787 log
788 @changes for SYS5 merged.
789 @
790 text
791 @d3 1
792 a3 1
793 static char ident[] = "@@(#)$Id: lock.c,v 2.7 1992/02/07 17:25:22 jromine Exp jromine $";
794 d30 4
795 d53 1
796 a53 2
797 #define FCNTL           /* assume all SYS5's have fcntl() locking */
798 #else
799 a56 1
800 #endif
801 a57 1
802
803 d206 1
804 a206 1
805 #ifdef  BSD42
806 d208 1
807 a208 1
808 #ifdef  SUN40
809 d260 6
810 a265 1
811             if (j & O_APPEND) lseek (fd, 0L, L_XTND);
812 @
813
814
815 2.7
816 log
817 @checkpoint
818 @
819 text
820 @d3 7
821 a9 2
822 static char ident[] = "@@(#)$Id: lock.c,v 2.6 1992/02/05 19:10:05 jromine Exp jromine $";
823 #endif  /* lint */
824 d13 1
825 a13 1
826 #endif  /* MMDFONLY */
827 d35 1
828 a35 1
829 #endif/*  */
830 d39 1
831 a39 1
832 #endif/*  */
833 d49 6
834 a54 2
835 #define FCNTL
836 #endif  /* SYS5 */
837 d79 1
838 a79 1
839 #if defined(BSD42) || defined(FCNTL)
840 d81 1
841 a81 1
842 #endif  /* BSD42 || FCNTL */
843 d203 1
844 a203 1
845 #if defined(BSD42) || defined(FCNTL)
846 d205 1
847 a205 1
848 #ifdef BSD42
849 d209 3
850 a211 2
851 #endif  /* SUN40 */
852 #else /* FCNTL */
853 d214 1
854 d237 1
855 a237 1
856 #endif  /* LOCKF */
857 d241 4
858 a244 1
859 #ifdef FCNTL
860 d250 3
861 a252 1
862 #else /* BSD42 */
863 a253 1
864 #endif /* BSD42 */
865 d255 2
866 a256 1
867 #else   /* LOCKF */
868 d263 3
869 a265 2
870         if (errno == EACCES) errno = EWOULDBLOCK;
871 #endif  /* LOCKF */
872 d276 1
873 a276 1
874 #endif  /* BSD42 || FCNTL */
875 a295 1
876 #if defined(BSD42) || defined(FCNTL)
877 d297 4
878 a300 1
879 #ifdef FCNTL
880 d306 3
881 a308 1
882 #else /* BSD42 */
883 d310 2
884 a311 1
885 #endif /* BSD42 */
886 a314 1
887 #endif  /* LOCKF */
888 d316 1
889 a316 1
890 #endif  /* BSD42 */
891 a367 1
892 #if defined(BSD42) || defined(FCNTL)
893 d369 4
894 a372 1
895 #ifdef FCNTL
896 d378 3
897 a380 1
898 #else /* BSD42 */
899 d382 2
900 a383 1
901 #endif /* BSD42 */
902 a386 1
903 #endif  /* LOCKF */
904 d388 1
905 a388 1
906 #endif  /* BSD42 */
907 @
908
909
910 2.6
911 log
912 @fix LOCKF typo
913 @
914 text
915 @d3 2
916 a4 2
917 static char ident[] = "@@(#)$Id: lock.c,v 2.5 1992/01/31 22:35:13 jromine Exp jromine $";
918 #endif  lint
919 d8 1
920 a8 1
921 #endif  MMDFONLY
922 d14 1
923 a14 1
924 #else   LOCKONLY
925 d19 1
926 a19 1
927 #else   not MMDFONLY
928 d21 2
929 a22 2
930 #endif  not MMDFONLY
931 #endif  LOCKONLY
932 d30 2
933 a31 2
934 #endif
935 #endif  LOCKF
936 d34 1
937 a34 1
938 #endif
939 d44 2
940 a45 1
941 #endif  SYS5
942 d53 2
943 a54 2
944 #endif  not MMDFONLY
945 #endif  LOCKONLY
946 d70 1
947 a70 1
948 #ifdef  BSD42
949 d72 1
950 a72 1
951 #endif  BSD42
952 d136 1
953 a136 1
954 #endif hpux
955 d194 1
956 a194 1
957 #ifdef  BSD42
958 d196 1
959 d200 4
960 a203 1
961 #endif  SUN40
962 d212 3
963 d217 1
964 a217 1
965 #ifdef  LOCKF
966 d221 1
967 a221 1
968         /* We MUST have write permission of lockf won't work */
969 d226 1
970 a226 1
971 #endif  LOCKF
972 d230 7
973 d238 1
974 d240 1
975 a240 1
976 #else   LOCKF
977 d248 1
978 a248 1
979 #endif  LOCKF
980 d259 1
981 a259 1
982 #endif  BSD42
983 d271 3
984 d279 1
985 a279 1
986 #ifdef  BSD42
987 d281 7
988 d289 2
989 a290 1
990 #else   LOCKF
991 d293 1
992 a293 1
993 #endif  LOCKF
994 d295 1
995 a295 1
996 #endif  BSD42
997 d338 3
998 d347 1
999 a347 1
1000 #ifdef  BSD42
1001 d349 7
1002 d357 2
1003 a358 1
1004 #else   LOCKF
1005 d361 1
1006 a361 1
1007 #endif  LOCKF
1008 d363 1
1009 a363 1
1010 #endif  BSD42
1011 d403 1
1012 a403 1
1013 #endif  BSD42
1014 @
1015
1016
1017 2.5
1018 log
1019 @kerberos
1020 @
1021 text
1022 @d3 1
1023 a3 1
1024 static char ident[] = "@@(#)$Id: lock.c,v 2.4 91/01/18 08:43:29 mh Exp Locker: mh $";
1025 d211 1
1026 a211 1
1027         access &= ! O_APPEND;   /* make sure we open at the beginning */
1028 d215 1
1029 a215 1
1030             access &= ! O_RDONLY;
1031 @
1032
1033
1034 2.4
1035 log
1036 @add sys/file.h under LOCKF
1037 @
1038 text
1039 @d3 1
1040 a3 1
1041 static char ident[] = "@@(#)$Id: lock.c,v 2.3 90/04/05 15:04:28 sources Exp Locker: mh $";
1042 d28 3
1043 d32 3
1044 a35 1
1045
1046 d157 1
1047 a157 1
1048     if ((cp = rindex (file, '/')) == NULL || *++cp == NULL)
1049 d159 1
1050 a159 1
1051     if (lockldir == NULL || *lockldir == NULL) {
1052 d182 1
1053 a182 1
1054         if ((cp = rindex (curlock, '/')) == NULL || *++cp == NULL)
1055 @
1056
1057
1058 2.3
1059 log
1060 @add ID
1061 @
1062 text
1063 @d3 1
1064 a3 1
1065 static char ident[] = "@@(#)$Id:$";
1066 d27 1
1067 @
1068
1069
1070 2.2
1071 log
1072 @ANSI Compilance
1073 @
1074 text
1075 @d2 3
1076 @
1077
1078
1079 2.1
1080 log
1081 @fix for hpux
1082 @
1083 text
1084 @d46 2
1085 @
1086
1087
1088 2.0
1089 log
1090 @changes for SUN40 shared libraries and NNTP under bbc
1091 @
1092 text
1093 @d122 3
1094 @
1095
1096
1097 1.1
1098 log
1099 @Initial revision
1100 @
1101 text
1102 @d22 3
1103 d182 3
1104 d195 10
1105 d207 1
1106 d210 9
1107 d247 6
1108 d304 6
1109 @