ios->fd_out = -1;
void ios_shutdown(io_stream* ios, int how){	assert(ios != NULL);	if (how == SHUT_RDWR) {		/* close both the input and the output */		if (ios->fd_in >= 0) {			close(ios->fd_in);			/* record the read shutdown time */			gettimeofday(&(ios->read_closed), NULL);		}		/* if the same fd is input and output, don't close twice */		if (ios->fd_out >= 0 && ios->fd_out != ios->fd_in)			close(ios->fd_out);		ios->fd_in = ios->fd_out = -1;	} else if (how == SHUT_RD) {		/* close the input */		if (ios->fd_in >= 0) {			/* if the fd is duplex, use shutdown */			if (ios->fd_in == ios->fd_out) {				if (!ios->half_close_suppress)					shutdown(ios->fd_in, SHUT_RD);			} else {				close(ios->fd_in);			}			ios->fd_in = -1;			/* record the read shutdown time */			gettimeofday(&(ios->read_closed), NULL);		}	} else {		assert(how == SHUT_WR);				/* close the output */		if (ios->fd_out >= 0) {			/* if the fd is duplex, use shutdown */			if (ios->fd_in == ios->fd_out) {				if (!ios->half_close_suppress)					shutdown(ios->fd_out, SHUT_WR);			} else {				close(ios->fd_out);			}			ios->fd_out = -1;		}	}}