X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Fradius%2Fradiusclient%2Flib%2Flock.c;fp=pppd%2Fplugins%2Fradius%2Fradiusclient%2Flib%2Flock.c;h=0000000000000000000000000000000000000000;hb=4abe4296f0eddbb2b6ff11dbbd27100156c85f87;hp=83f79d83bb700fefda8fa012826de07ac828adc7;hpb=4b9bf9ae2701487191810e564aaa4672eb95130e;p=ppp.git diff --git a/pppd/plugins/radius/radiusclient/lib/lock.c b/pppd/plugins/radius/radiusclient/lib/lock.c deleted file mode 100644 index 83f79d8..0000000 --- a/pppd/plugins/radius/radiusclient/lib/lock.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id: lock.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ - * - * Copyright (C) 1997 Lars Fenneberg - * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net - * and I'll send you a copy. - * - */ - -#include "config.h" -#include "includes.h" - -#if defined(HAVE_FLOCK) - -int do_lock_exclusive(int fd) -{ - return flock(fd, LOCK_EX|LOCK_NB); -} - -int do_unlock(int fd) -{ - return flock(fd, LOCK_UN); -} - -#elif defined(HAVE_FCNTL) - -int do_lock_exclusive(int fd) -{ - flock_t fl; - int res; - - memset((void *)&fl, 0, sizeof(fl)); - - fl.l_type = F_WRLCK; - fl.l_whence = fl.l_start = 0; - fl.l_len = 0; /* 0 means "to end of file" */ - - res = fcntl(fd, F_SETLK, &fl); - - if ((res == -1) && (errno == EAGAIN)) - errno = EWOULDBLOCK; - - return res; -} - -int do_unlock(int fd) -{ - flock_t fl; - - memset((void *)&fl, 0, sizeof(fl)); - - fl.l_type = F_UNLCK; - fl.l_whence = fl.l_start = 0; - fl.l_len = 0; /* 0 means "to end of file" */ - - return fcntl(fd, F_SETLK, &fl); -} - -#else -YOU_LOOSE "need either flock(2) or fcntl(2)" -#endif