/* * The default fd array needs to be at least BITS_PER_LONG, * as this is the granularity returned by copy_fdset().
*/ #define NR_OPEN_DEFAULT BITS_PER_LONG
/* * The caller must ensure that fd table isn't shared or hold rcu or file lock
*/ staticinlinestruct file *files_lookup_fd_raw(struct files_struct *files, unsignedint fd)
{ struct fdtable *fdt = rcu_dereference_raw(files->fdt); unsignedlong mask = array_index_mask_nospec(fd, fdt->max_fds); struct file *needs_masking;
/* * 'mask' is zero for an out-of-bounds fd, all ones for ok. * 'fd&mask' is 'fd' for ok, or 0 for out of bounds. * * Accessing fdt->fd[0] is ok, but needs masking of the result.
*/
needs_masking = rcu_dereference_raw(fdt->fd[fd&mask]); return (struct file *)(mask & (unsignedlong)needs_masking);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.