MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsFileLock

Function cupsFileLock

cups/file.c:1020–1040  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1018 */
1019
1020int /* O - 0 on success, -1 on error */
1021cupsFileLock(cups_file_t *fp, /* I - CUPS file */
1022 int block) /* I - 1 to wait for the lock, 0 to fail right away */
1023{
1024 /*
1025 * Range check...
1026 */
1027
1028 if (!fp || fp->mode == 's')
1029 return (-1);
1030
1031 /*
1032 * Try the lock...
1033 */
1034
1035#ifdef _WIN32
1036 return (_locking(fp->fd, block ? _LK_LOCK : _LK_NBLCK, 0));
1037#else
1038 return (lockf(fp->fd, block ? F_LOCK : F_TLOCK, 0));
1039#endif /* _WIN32 */
1040}
1041
1042
1043/*

Callers 2

helpLoadIndexFunction · 0.85
helpSaveIndexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected