freebsd-skq/sys/compat/linux
Alfred Perlstein 426da3bcfb SMP Lock struct file, filedesc and the global file list.
Seigo Tanimura (tanimura) posted the initial delta.

I've polished it quite a bit reducing the need for locking and
adapting it for KSE.

Locks:

1 mutex in each filedesc
   protects all the fields.
   protects "struct file" initialization, while a struct file
     is being changed from &badfileops -> &pipeops or something
     the filedesc should be locked.

1 mutex in each struct file
   protects the refcount fields.
   doesn't protect anything else.
   the flags used for garbage collection have been moved to
     f_gcflag which was the FILLER short, this doesn't need
     locking because the garbage collection is a single threaded
     container.
  could likely be made to use a pool mutex.

1 sx lock for the global filelist.

struct file *	fhold(struct file *fp);
        /* increments reference count on a file */

struct file *	fhold_locked(struct file *fp);
        /* like fhold but expects file to locked */

struct file *	ffind_hold(struct thread *, int fd);
        /* finds the struct file in thread, adds one reference and
                returns it unlocked */

struct file *	ffind_lock(struct thread *, int fd);
        /* ffind_hold, but returns file locked */

I still have to smp-safe the fget cruft, I'll get to that asap.
2002-01-13 11:58:06 +00:00
..
linux_file.c SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
linux_getcwd.c Fix warning in debug printf. This is a long on alpha, and int on i386, 2001-11-17 01:16:10 +00:00
linux_ioctl.c SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
linux_ioctl.h Deal with a few issues that cropped up following the recent changes 2001-11-19 15:43:50 +00:00
linux_ipc.c Introduce [IPC|SHM]_[INFO|STAT] to shmctl to make 2001-10-28 09:29:10 +00:00
linux_ipc.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
linux_mib.c o Introduce pr_mtx into struct prison, providing protection for the 2001-12-03 16:12:27 +00:00
linux_mib.h o Introduce pr_mtx into struct prison, providing protection for the 2001-12-03 16:12:27 +00:00
linux_misc.c o Introduce pr_mtx into struct prison, providing protection for the 2001-12-03 16:12:27 +00:00
linux_signal.c KSE Milestone 2 2001-09-12 08:38:13 +00:00
linux_signal.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
linux_socket.c Fix missing holdsock()->fgetsock() 2001-11-17 18:43:13 +00:00
linux_socket.h translate the flags in recvfrom and recvmsg from linux to bsd ones 2000-12-19 00:24:25 +00:00
linux_stats.c SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
linux_sysctl.c KSE Milestone 2 2001-09-12 08:38:13 +00:00
linux_uid16.c When casting from uid16/gid16 to uid/gid respectively, make sure 2001-10-14 03:56:53 +00:00
linux_util.c Eliminate the prefix parameter to linux_emul_find(), which was always 2001-10-27 11:15:19 +00:00
linux_util.h Eliminate the prefix parameter to linux_emul_find(), which was always 2001-10-27 11:15:19 +00:00