I think I mailed this patch off quite some time ago,
but it seems to have been lost.
This patch adds support for getsid() and setsid() by
making these available as part of the 'id' command:
id process session ;# calls getsid()
id process session set ;# calls setsid()
The patch includes configure, doc, and code.
tclx.session.patch