Lines Matching refs:f
30 int sfpurge(Sfio_t* f) in sfpurge() argument
32 int sfpurge(f) in sfpurge()
33 Sfio_t* f; in sfpurge()
37 SFMTXDECL(f);
39 SFMTXENTER(f,-1);
41 if((mode = f->mode&SF_RDWR) != (int)f->mode && _sfmode(f,mode|SF_SYNCED,0) < 0)
42 SFMTXRETURN(f, -1);
44 if((f->flags&SF_IOCHECK) && f->disc && f->disc->exceptf)
45 (void)(*f->disc->exceptf)(f,SF_PURGE,(Void_t*)((int)1),f->disc);
47 if(f->disc == _Sfudisc)
48 (void)sfclose((*_Sfstack)(f,NIL(Sfio_t*)));
51 if((f->flags&SF_STRING) && (f->mode&SF_READ) )
54 SFLOCK(f,0);
58 if(f->bits&SF_MMAP)
59 { f->here -= f->endb - f->next;
60 if(f->data)
61 { SFMUNMAP(f,f->data,f->endb-f->data);
62 (void)SFSK(f,f->here,SEEK_SET,f->disc);
64 SFOPEN(f,0);
65 SFMTXRETURN(f, 0);
69 switch(f->mode&~SF_LOCK)
72 SFOPEN(f,0);
73 SFMTXRETURN(f, -1);
75 f->next = f->data;
76 if(!f->proc || !(f->flags&SF_READ) || !(f->mode&SF_WRITE) )
80 (void)_sfmode(f,SF_READ,1);
83 if(f->extent >= 0 && f->endb > f->next)
84 { f->here -= f->endb-f->next;
85 (void)SFSK(f,f->here,SEEK_SET,f->disc);
87 f->endb = f->next = f->data;
91 SFOPEN(f,0);
94 if((f->flags&SF_IOCHECK) && f->disc && f->disc->exceptf)
95 (void)(*f->disc->exceptf)(f,SF_PURGE,(Void_t*)((int)0),f->disc);
97 SFMTXRETURN(f, 0);