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