Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: pylib/gyp/flock_tool.py

Issue 738943004: Initialize struct flock for AIX with O_LARGEFILE used by Python. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 Google Inc. All rights reserved. 2 # Copyright (c) 2011 Google Inc. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """These functions are executed via gyp-flock-tool when using the Makefile 6 """These functions are executed via gyp-flock-tool when using the Makefile
7 generator. Used on systems that don't have a built-in flock.""" 7 generator. Used on systems that don't have a built-in flock."""
8 8
9 import fcntl 9 import fcntl
10 import os 10 import os
(...skipping 22 matching lines...) Expand all
33 return name_string.title().replace('-', '') 33 return name_string.title().replace('-', '')
34 34
35 def ExecFlock(self, lockfile, *cmd_list): 35 def ExecFlock(self, lockfile, *cmd_list):
36 """Emulates the most basic behavior of Linux's flock(1).""" 36 """Emulates the most basic behavior of Linux's flock(1)."""
37 # Rely on exception handling to report errors. 37 # Rely on exception handling to report errors.
38 # Note that the stock python on SunOS has a bug 38 # Note that the stock python on SunOS has a bug
39 # where fcntl.flock(fd, LOCK_EX) always fails 39 # where fcntl.flock(fd, LOCK_EX) always fails
40 # with EBADF, that's why we use this F_SETLK 40 # with EBADF, that's why we use this F_SETLK
41 # hack instead. 41 # hack instead.
42 fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666) 42 fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666)
43 op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) 43 if sys.platform.startswith('aix'):
Nico 2014/11/21 17:32:14 Please add a comment saying # Python on AIX is
44 op = struct.pack('hhIllqq', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
45 else:
46 op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
44 fcntl.fcntl(fd, fcntl.F_SETLK, op) 47 fcntl.fcntl(fd, fcntl.F_SETLK, op)
45 return subprocess.call(cmd_list) 48 return subprocess.call(cmd_list)
46 49
47 50
48 if __name__ == '__main__': 51 if __name__ == '__main__':
49 sys.exit(main(sys.argv[1:])) 52 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698