I was just locking at the advisory locks under linux (I think I was looking at the advisory locks.) They appear to allow locking of a byte range, not just the whole file? It looks like it would make more sense to support this as a seperate request rather than as part of open?
Like Windows, UNIX provides both whole-file and byte-range locking interfaces. Both types are generally advisory; as Bill pointed out, the decision as to whether to use advisory or mandatory locking is made on a file-by-file basis, and is controlled by the file mode bits (attributes). The interface is exactly the same in either case.
I agree it would be appropriate to support byte-range locking, if it is desirable for sftp to be used as the back-end for something that looks like a filesystem. In particular, our experiences with AFS indicate that while relatively few UNIX programs use byte-range locking at all, some software, particularly on Windows, simply will not function correctly without it.
-- Jeff