From: Guido van Rossum Date: Thu, 23 May 1996 22:56:38 +0000 (+0000) Subject: Added flock(). X-Git-Tag: v1.4b1~144 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3539b1e9194eb63dd893627535d062a7fafc1bf9;p=python Added flock(). --- diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c index 229958532d..d2efd60311 100644 --- a/Modules/fcntlmodule.c +++ b/Modules/fcntlmodule.c @@ -128,11 +128,40 @@ fcntl_ioctl(self, args) } +/* flock(fd, operation) */ + +static object * +fcntl_flock(self, args) + object *self; /* Not used */ + object *args; +{ + int fd; + int code; + int ret; + FILE *f; + + if (!getargs(args, "(ii)", &fd, &code)) + return NULL; + + BGN_SAVE + ret = flock(fd, code); + END_SAVE + if (ret < 0) { + err_errno(IOError); + return NULL; + } + INCREF(None); + return None; +} + + + /* List of functions */ static struct methodlist fcntl_methods[] = { {"fcntl", fcntl_fcntl}, {"ioctl", fcntl_ioctl}, + {"flock", fcntl_flock}, {NULL, NULL} /* sentinel */ };