diff options
author | Guido van Rossum <guido@python.org> | 1996-05-23 22:56:38 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-05-23 22:56:38 (GMT) |
commit | 3539b1e9194eb63dd893627535d062a7fafc1bf9 (patch) | |
tree | c6c42d48646d88ccd3a913589a55cda47837ed1f /Modules/fcntlmodule.c | |
parent | 7081cf54bfe6a6138ad7d60666ae0be2058291ae (diff) | |
download | cpython-3539b1e9194eb63dd893627535d062a7fafc1bf9.zip cpython-3539b1e9194eb63dd893627535d062a7fafc1bf9.tar.gz cpython-3539b1e9194eb63dd893627535d062a7fafc1bf9.tar.bz2 |
Added flock().
Diffstat (limited to 'Modules/fcntlmodule.c')
-rw-r--r-- | Modules/fcntlmodule.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c index 2299585..d2efd60 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 */ }; |