Lines Matching +defs:val +defs:file

26 **	When this memory is exceeded, a real temp file will be created.
27 ** The temp file creation sequence is somewhat convoluted so that
35 /* File not removable while there is an open file descriptor.
37 ** 1. A discipline to remove a file when the corresponding stream is closed.
38 ** Care must be taken to close the file descriptor before removing the
39 ** file because systems such as NT do not allow file removal while
40 ** there is an open file handle.
50 char name[1]; /* temp file name */
56 static int _tmprmfile(Sfio_t* f, int type, Void_t* val, Sfdisc_t* disc)
58 static int _tmprmfile(f, type, val, disc)
61 Void_t* val;
67 NOTUSED(val);
84 (*_Sfnotify)(f,SF_CLOSING,f->file);
85 CLOSE(f->file);
86 f->file = -1;
119 static int _rmtmp(Sfio_t* f, char* file)
121 static int _rmtmp(f, file)
123 char* file;
132 if(!(ff = (File_t*)malloc(sizeof(File_t)+strlen(file))) )
136 strcpy(ff->name,file);
142 while(sysremovef(file) < 0 && errno == EINTR)
206 reg char* file;
210 if(!(file = pathtemp(NiL,PATH_MAX,NiL,"sf",&fd)))
212 _rmtmp(f, file);
213 free(file);
221 if(!(file = getenv("TMPDIR")) )
222 file = TMPDFLT;
223 if(!(Tmppath[0] = (char*)malloc(strlen(file)+1)) )
228 strcpy(Tmppath[0],file);
232 /* set current directory to create this temp file */
253 file = sfprints("%s/sf%3.3.32lu.%3.3.32lu",
255 if(!file)
258 if((fd = sysopenf(file,O_RDWR|O_CREAT|O_EXCL|O_TEMPORARY,SF_CREATMODE)) >= 0)
261 if((fd = sysopenf(file,O_RDONLY)) >= 0)
262 { /* file already exists */
266 else if((fd = syscreatf(file,SF_CREATMODE)) >= 0)
269 if((fd = sysopenf(file,O_RDWR)) >= 0)
272 /* don't know what happened but must remove file */
273 while(sysremovef(file) < 0 && errno == EINTR)
279 _rmtmp(f, file);
285 static int _tmpexcept(Sfio_t* f, int type, Void_t* val, Sfdisc_t* disc)
287 static int _tmpexcept(f,type,val,disc)
290 Void_t* val;
299 NOTUSED(val);
309 /* try to create the temp file */
318 we are only interested in creating the file, not the stream */
359 (*notifyf)(f, SF_NEW, (void*)((long)f->file));
365 newf.file = -1;
395 /* make the file now */