Posix locks (F_SETLK etc) are associated with a process, so after a `dup2()` you still only have one lock on a file. You can list your locks with `lslocks`. If you close one of the 2 fds you will drop the lock. If you change the lock with one of the fds, the other will change too. After a `fork()` the child has no locks. See the `fcntl` man page for details. This Posix spec says `dup2()` will _share any locks_.
You can do simple tests in Python using `lockf()` for ease of use, as it is implemented via `fcntl()`, eg:
#!/usr/bin/python
import os, fcntl
pid = os.getpid()
fd = open("/tmp/try","rw")
fcntl.lockf(fd,fcntl.LOCK_SH,10)
fd2 = os.dup(fd.fileno())
os.system("lslocks -p %d" % pid) # one lock
fd.close()
os.system("lslocks -p %d" % pid) # no output