This command is part of the TclX package.
This command places a lock on all or part of the file specified by fileId. The lock is either advisory or mandatory, depending on the mode bits of the file. The lock is placed beginning at relative byte offset start for length bytes. If start or length is omitted or empty, zero is assumed. If length is zero, then the lock always extents to end of file, even if the file grows. If origin is “start”, then the offset is relative to the beginning of the file. If it is “current”, it is relative to the current access position in the file. If it is “end”, then it is relative to the end-of-file (a negative is before the EOF, positive is after). If origin is omitted, start is assumed.
The following options are recognized:
See your system's fcntl system call documentation for full details of the behavior of file locking. If locking is being done on ranges of a file, it is best to use unbuffered file access (see the fcntl command).
... there is a proposal tclx file commands for core