parameters: (self, lockfile, *cmd_list)
return_statement: return subprocess.call(cmd_list)
docstring: Emulates the most basic behavior of Linux's flock(1).
docstring_summary: Emulates the most basic behavior of Linux's flock(1).
docstring_tokens: Emulates the most basic behavior of Linux s flock ( 1 ) .
function: def ExecFlock(self, lockfile, *cmd_list):
      """Emulates the most basic behavior of Linux's flock(1)."""
      # Rely on exception handling to report errors.
      # Note that the stock python on SunOS has a bug
      # where fcntl.flock(fd, LOCK_EX) always fails
      # with EBADF, that's why we use this F_SETLK
      # hack instead.
      fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666)
      if sys.platform.startswith('aix'):
        # Python on AIX is compiled with LARGEFILE support, which changes the
        # struct size.
        op = struct.pack('hhIllqq', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
      else:
        op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
      fcntl.fcntl(fd, fcntl.F_SETLK, op)
      return subprocess.call(cmd_list)
function_tokens: def ExecFlock ( self , lockfile , * cmd_list ) : # Rely on exception handling to report errors. # Note that the stock python on SunOS has a bug # where fcntl.flock(fd, LOCK_EX) always fails # with EBADF, that's why we use this F_SETLK # hack instead. fd = os . open ( lockfile , os . O_WRONLY | os . O_NOCTTY | os . O_CREAT , 0666 ) if sys . platform . startswith ( 'aix' ) : # Python on AIX is compiled with LARGEFILE support, which changes the # struct size. op = struct . pack ( 'hhIllqq' , fcntl . F_WRLCK , 0 , 0 , 0 , 0 , 0 , 0 ) else : op = struct . pack ( 'hhllhhl' , fcntl . F_WRLCK , 0 , 0 , 0 , 0 , 0 , 0 ) fcntl . fcntl ( fd , fcntl . F_SETLK , op ) return subprocess . call ( cmd_list )