+ u32 fd_index = fd - ldp->sid_bit_val;
+ ldp_fd_entry_t *fde;
+
+ fde = ldp_fd_entry_get_w_lock (fd_index);
+ if (!fde)
+ {
+ clib_rwlock_reader_unlock (&ldp->fd_table_lock);
+ errno = ENOTCONN;
+ return -1;
+ }
+
+ if (how == SHUT_RD)
+ fde->flags |= LDP_F_SHUT_RD;
+ else if (how == SHUT_WR)
+ fde->flags |= LDP_F_SHUT_WR;
+ else if (how == SHUT_RDWR)
+ fde->flags |= (LDP_F_SHUT_RD | LDP_F_SHUT_WR);
+
+ if ((fde->flags & LDP_F_SHUT_RD) && (fde->flags & LDP_F_SHUT_WR))
+ rv = close (fd);
+
+ clib_rwlock_reader_unlock (&ldp->fd_table_lock);
+ LDBG (0, "fd %d (0x%x): calling vcl shutdown: how %d", fd, fd, how);