flocksim.h | flocksim.h | |||
---|---|---|---|---|
/* ======================================================================== | ||||
* Copyright 1988-2006 University of Washington | ||||
* | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | ||||
* You may obtain a copy of the License at | ||||
* | ||||
* http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | ||||
* | ||||
* ======================================================================== | ||||
*/ | ||||
/* | /* | |||
* Program: flock() emulation via fcntl() locking | * Program: flock() emulation via fcntl() locking | |||
* | * | |||
* Author: Mark Crispin | * Author: Mark Crispin | |||
* Networks and Distributed Computing | * Networks and Distributed Computing | |||
* Computing & Communications | * Computing & Communications | |||
* University of Washington | * University of Washington | |||
* Administration Building, AG-44 | * Administration Building, AG-44 | |||
* Seattle, WA 98195 | * Seattle, WA 98195 | |||
* Internet: MRC@CAC.Washington.EDU | * Internet: MRC@CAC.Washington.EDU | |||
* | * | |||
* Date: 10 April 2001 | * Date: 10 April 2001 | |||
* Last Edited: 22 January 2002 | * Last Edited: 30 August 2006 | |||
* | ||||
* The IMAP toolkit provided in this Distribution is | ||||
* Copyright 2002 University of Washington. | ||||
* The full text of our legal notices is contained in the file called | ||||
* CPYRIGHT, included with this Distribution. | ||||
*/ | */ | |||
#define flock flocksim /* use ours instead of theirs */ | #define flock flocksim /* use ours instead of theirs */ | |||
#undef LOCK_SH | #undef LOCK_SH | |||
#define LOCK_SH 1 /* shared lock */ | #define LOCK_SH 1 /* shared lock */ | |||
#undef LOCK_EX | #undef LOCK_EX | |||
#define LOCK_EX 2 /* exclusive lock */ | #define LOCK_EX 2 /* exclusive lock */ | |||
#undef LOCK_NB | #undef LOCK_NB | |||
#define LOCK_NB 4 /* no blocking */ | #define LOCK_NB 4 /* no blocking */ | |||
skipping to change at line 47 | skipping to change at line 55 | |||
safe_delete (dtb,stream,mbx) : (*dtb->mbxdel) (stream,mbx) | safe_delete (dtb,stream,mbx) : (*dtb->mbxdel) (stream,mbx) | |||
#undef SAFE_RENAME | #undef SAFE_RENAME | |||
#define SAFE_RENAME(dtb,stream,old,newname) (dtb->flags & DR_LOCKING) ? \ | #define SAFE_RENAME(dtb,stream,old,newname) (dtb->flags & DR_LOCKING) ? \ | |||
safe_rename (dtb,stream,old,newname) : (*dtb->mbxren) (stream,old,newname ) | safe_rename (dtb,stream,old,newname) : (*dtb->mbxren) (stream,old,newname ) | |||
#undef SAFE_STATUS | #undef SAFE_STATUS | |||
#define SAFE_STATUS(dtb,stream,mbx,bits) (dtb->flags & DR_LOCKING) ? \ | #define SAFE_STATUS(dtb,stream,mbx,bits) (dtb->flags & DR_LOCKING) ? \ | |||
safe_status (dtb,stream,mbx,bits) : (*dtb->status) (stream,mbx,bits) | safe_status (dtb,stream,mbx,bits) : (*dtb->status) (stream,mbx,bits) | |||
#undef SAFE_SCAN_CONTENTS | #undef SAFE_SCAN_CONTENTS | |||
#define SAFE_SCAN_CONTENTS(dtb,name,contents,csiz,fsiz) \ | #define SAFE_SCAN_CONTENTS(dtb,name,contents,csiz,fsiz) \ | |||
(!dtb || (dtb->flags & DR_LOCKING)) ? \ | (!dtb || (dtb->flags & DR_LOCKING)) ? \ | |||
safe_scan_contents (name,contents,csiz,fsiz) : \ | safe_scan_contents (dtb,name,contents,csiz,fsiz) : \ | |||
dummy_scan_contents (name,contents,csiz,fsiz) | scan_contents (dtb,name,contents,csiz,fsiz) | |||
#undef SAFE_COPY | #undef SAFE_COPY | |||
#define SAFE_COPY(dtb,stream,seq,mbx,bits) (dtb->flags & DR_LOCKING) ? \ | #define SAFE_COPY(dtb,stream,seq,mbx,bits) (dtb->flags & DR_LOCKING) ? \ | |||
safe_copy (dtb,stream,seq,mbx,bits) : (*dtb->copy) (stream,seq,mbx,bits) | safe_copy (dtb,stream,seq,mbx,bits) : (*dtb->copy) (stream,seq,mbx,bits) | |||
#undef SAFE_APPEND | #undef SAFE_APPEND | |||
#define SAFE_APPEND(dtb,stream,mbx,af,data) (dtb->flags & DR_LOCKING) ? \ | #define SAFE_APPEND(dtb,stream,mbx,af,data) (dtb->flags & DR_LOCKING) ? \ | |||
safe_append (dtb,stream,mbx,af,data) : (*dtb->append) (stream,mbx,af,data ) | safe_append (dtb,stream,mbx,af,data) : (*dtb->append) (stream,mbx,af,data ) | |||
#undef MM_EXISTS | #undef MM_EXISTS | |||
#define MM_EXISTS (lockslavep ? slave_exists : mm_exists) | #define MM_EXISTS (lockslavep ? slave_exists : mm_exists) | |||
#undef MM_EXPUNGED | #undef MM_EXPUNGED | |||
skipping to change at line 85 | skipping to change at line 93 | |||
#define MM_FATAL (lockslavep ? slave_fatal : mm_fatal) | #define MM_FATAL (lockslavep ? slave_fatal : mm_fatal) | |||
#undef MM_APPEND | #undef MM_APPEND | |||
#define MM_APPEND(af) (lockslavep ? slave_append : (*af)) | #define MM_APPEND(af) (lockslavep ? slave_append : (*af)) | |||
/* Function prototypes */ | /* Function prototypes */ | |||
int flocksim (int fd,int operation); | int flocksim (int fd,int operation); | |||
long safe_delete (DRIVER *dtb,MAILSTREAM *stream,char *mbx); | long safe_delete (DRIVER *dtb,MAILSTREAM *stream,char *mbx); | |||
long safe_rename (DRIVER *dtb,MAILSTREAM *stream,char *old,char *newname); | long safe_rename (DRIVER *dtb,MAILSTREAM *stream,char *old,char *newname); | |||
long safe_status (DRIVER *dtb,MAILSTREAM *stream,char *mbx,long flags); | long safe_status (DRIVER *dtb,MAILSTREAM *stream,char *mbx,long flags); | |||
long safe_scan_contents (char *name,char *contents,unsigned long csiz, | long safe_scan_contents (DRIVER *dtb,char *name,char *contents, | |||
unsigned long fsiz); | unsigned long csiz,unsigned long fsiz); | |||
long safe_copy (DRIVER *dtb,MAILSTREAM *stream,char *seq,char *mbx,long fla gs); | long safe_copy (DRIVER *dtb,MAILSTREAM *stream,char *seq,char *mbx,long fla gs); | |||
long safe_append (DRIVER *dtb,MAILSTREAM *stream,char *mbx,append_t af, | long safe_append (DRIVER *dtb,MAILSTREAM *stream,char *mbx,append_t af, | |||
void *data); | void *data); | |||
void slave_exists (MAILSTREAM *stream,unsigned long number); | void slave_exists (MAILSTREAM *stream,unsigned long number); | |||
void slave_expunged (MAILSTREAM *stream,unsigned long number); | void slave_expunged (MAILSTREAM *stream,unsigned long number); | |||
void slave_flags (MAILSTREAM *stream,unsigned long number); | void slave_flags (MAILSTREAM *stream,unsigned long number); | |||
void slave_notify (MAILSTREAM *stream,char *string,long errflg); | void slave_notify (MAILSTREAM *stream,char *string,long errflg); | |||
void slave_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status); | void slave_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status); | |||
void slave_log (char *string,long errflg); | void slave_log (char *string,long errflg); | |||
End of changes. 4 change blocks. | ||||
10 lines changed or deleted | 18 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |