Svante Signell, le Sat 28 Feb 2015 15:32:47 +0100, a écrit : > * how come? > - code calling fcntl() works. > - code calling the (RPC) file_record_lock() does not!
Which code? Without showing what you are doing, it's difficult for us to understand what you mean. > * the code below iterates over the file descriptor table entries. I > would like to iterate over open file descriptors in the chile. How to do > that? It looks almost right. > for (i = 0; i < _hurd_dtablesize; ++i) You should enter the critical section before that, by using HURD_CRITICAL_BEGIN and HURD_CRITICAL_END > { struct hurd_fd *d = _hurd_dtable[i]; > if (d == NULL) > /* Nothing to do for an unused descriptor cell. */ > continue; > > /* Check if the FD is open */ > // Not working?? > //if (d->flags == O_RDONLY ||d->flags == O_WRONLY) I don't think you need to test for that, d == NULL should be enough. > err = HURD_FD_PORT_USE (d, __file_record_lock (port, F_SETLK64, &fl64)); You can probably use _hurd_port_get directly instead, see ctty_new_pgrp for instance. > No difference when using _hurd_fork_child_hook or > _hurd_atfork_child_hook: > //text_set_element (_hurd_fork_child_hook,fork_child_rlock); > text_set_element (_hurd_atfork_child_hook, fork_child_rlock); As I told you, the difference is that the former is run inside the critical section (and various locks), while the latter is run outside of it. Samuel