diff options
Diffstat (limited to 'usr/src/uts/common/sys/user.h')
-rw-r--r-- | usr/src/uts/common/sys/user.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/usr/src/uts/common/sys/user.h b/usr/src/uts/common/sys/user.h index 0b997c518c..15b4d0b247 100644 --- a/usr/src/uts/common/sys/user.h +++ b/usr/src/uts/common/sys/user.h @@ -82,6 +82,21 @@ extern "C" { #endif /* + * File Descriptor assignment generation. + * + * Certain file descriptor consumers (namely epoll) need to be able to detect + * when the resource underlying an fd change due to (re)assignment. Checks + * comparing old and new file_t pointers work OK, but could easily be fooled by + * an entry freed-to and reused-from the cache. To better detect such + * assingments, a generation number is kept in the uf_entry. Whenever a + * non-NULL file_t is assigned to the entry, the generation is incremented, + * indicating the change. There is a minute possibility that a rollover of the + * value could cause assigments to evade detection by consumers, but it is + * considered acceptably small. + */ +typedef uint_t uf_entry_gen_t; + +/* * Entry in the per-process list of open files. * Note: only certain fields are copied in flist_grow() and flist_fork(). * This is indicated in brackets in the structure member comments. @@ -96,11 +111,13 @@ typedef struct uf_entry { short uf_busy; /* file is allocated [grow, fork] */ kcondvar_t uf_wanted_cv; /* waiting for setf() [never copied] */ kcondvar_t uf_closing_cv; /* waiting for close() [never copied] */ - struct portfd *uf_portfd; /* associated with port [grow] */ + struct portfd *uf_portfd; /* associated with port [grow] */ + uf_entry_gen_t uf_gen; /* assigned fd generation [grow,fork] */ /* Avoid false sharing - pad to coherency granularity (64 bytes) */ char uf_pad[64 - sizeof (kmutex_t) - 2 * sizeof (void*) - 2 * sizeof (int) - 2 * sizeof (short) - - 2 * sizeof (kcondvar_t) - sizeof (struct portfd *)]; + 2 * sizeof (kcondvar_t) - sizeof (struct portfd *) - + sizeof (uf_entry_gen_t)]; } uf_entry_t; /* @@ -185,9 +202,9 @@ typedef struct { /* kernel syscall set type */ * This value should not be changed in a patch. */ #if defined(__sparc) -#define __KERN_NAUXV_IMPL 20 +#define __KERN_NAUXV_IMPL 24 #elif defined(__i386) || defined(__amd64) -#define __KERN_NAUXV_IMPL 25 +#define __KERN_NAUXV_IMPL 28 #endif struct execsw; |