akr / fsij.org wrote:
> We should consider other *at functions, as well as openat.
> 
> renameat and linkat takes two file descriptors to specify directories.
> Also, they may be a special value, AT_FDCWD.
> 
> How do we map
> renameat(AT_FDCWD, "foo", newfd, "bar") and
> renameat(oldfd, "foo", AT_FDCWD, "bar") ?
> 
> They are difficult to map Dir methods.

IO.copy_stream is similar, I think:

	d1 = Dir.open("d1")
	d2 = Dir.open("d2")

	# allow d1/d2 to be Fixnum for fileno, too
	Dir.renameat(d1, "foo", d2, "bar")
	Dir.renameat(Dir::AT_FDCWD, "foo", d2.fileno, "bar")

However, the following defeats the purpose of renameat, so I am somewhat
against the following (both string args where FDs should be):

	Dir.renameat("d1/", "foo", "d2/", "bar")

Maybe allowing string path for one (not both) FD arg is not too bad:

	Dir.renameat(Dir::AT_FDCWD, "foo", "d2/", "bar")
	Dir.renameat("d1/", "foo", d2.fileno, "bar")