Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c012547

Browse files
committed
Added plock() system call.
Changed test for Windows times() emulation.
1 parent cd6aab9 commit c012547

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

Modules/posixmodule.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,27 @@ posix_kill(self, args)
10601060
}
10611061
#endif
10621062

1063+
#ifdef HAVE_PLOCK
1064+
1065+
#ifdef HAVE_SYS_LOCK_H
1066+
#include <sys/lock.h>
1067+
#endif
1068+
1069+
static object *
1070+
posix_plock(self, args)
1071+
object *self;
1072+
object *args;
1073+
{
1074+
int op;
1075+
if (!getargs(args, "i", &op))
1076+
return NULL;
1077+
if (plock(op) == -1)
1078+
return posix_error();
1079+
INCREF(None);
1080+
return None;
1081+
}
1082+
#endif
1083+
10631084
#ifdef HAVE_POPEN
10641085
static object *
10651086
posix_popen(self, args)
@@ -1220,7 +1241,7 @@ posix_times(self, args)
12201241
(double)c / HZ);
12211242
}
12221243
#endif /* HAVE_TIMES */
1223-
#if defined(MS_WIN32) && !defined(HAVE_TIMES)
1244+
#if defined(_MSC_VER) && _MSC_VER > 850
12241245
#define HAVE_TIMES /* so the method table will pick it up */
12251246
static object *
12261247
posix_times(self, args)
@@ -1645,6 +1666,9 @@ static struct methodlist posix_methods[] = {
16451666
#ifdef HAVE_KILL
16461667
{"kill", posix_kill},
16471668
#endif /* HAVE_KILL */
1669+
#ifdef HAVE_PLOCK
1670+
{"plock", posix_plock},
1671+
#endif /* HAVE_PLOCK */
16481672
#ifdef HAVE_POPEN
16491673
{"popen", posix_popen, 1},
16501674
#endif /* HAVE_POPEN */

0 commit comments

Comments
 (0)