Lines Matching refs:sf
95 FILE *sf; in rc_get_seqnbr() local
100 if ((sf = fopen(seqfile, "a+")) == NULL) in rc_get_seqnbr()
107 while (do_lock_exclusive(fileno(sf))!= 0) in rc_get_seqnbr()
111 fclose(sf); in rc_get_seqnbr()
123 fclose(sf); in rc_get_seqnbr()
127 pos = ftell(sf); in rc_get_seqnbr()
128 rewind(sf); in rc_get_seqnbr()
129 if (fscanf(sf, "%d", &seq_nbr) != 1) { in rc_get_seqnbr()
130 if (pos != ftell(sf)) { in rc_get_seqnbr()
137 rewind(sf); in rc_get_seqnbr()
138 ftruncate(fileno(sf),0); in rc_get_seqnbr()
139 fprintf(sf,"%d\n", (seq_nbr+1) & UCHAR_MAX); in rc_get_seqnbr()
141 fflush(sf); /* fflush because a process may read it between the do_unlock and fclose */ in rc_get_seqnbr()
143 if (do_unlock(fileno(sf)) != 0) in rc_get_seqnbr()
146 fclose(sf); in rc_get_seqnbr()