Is it possible to get the path of a .blend file from within OSL?
OSL itself doesn't provide any facilities to access files relative to the .blend file.
However, when passing a 'string' into an OSL script node, Blender automatically assumes that the string represents a filename. As with other filenames in Blender, prefixing the filename with '//' will indicate a path relative to the saved .blend file.
Therefore, in order to get the filepath to the .blend in an OSL shader simply add a 'string' input and set its value (within the node field) to '//'.