lock() for Unix now sets the appropriate lock type (shareable or exclusive) based on how the file was initially opened.