Re: ldattach: struct termios

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 27 March 2008, Karel Zak wrote:
> +static int my_cfsetspeed(struct termios *ts, int speed)
> +{
> +	/* Standard speeds
> +	 * -- cfsetspeed() is able to translate number to Bxxx constants
> +	 */
> +	if (cfsetspeed(ts, speed) == 0)
> +		return 0;
> +
> +	/* Nonstandard speeds
> +	 * -- we have to bypass glibc and set the speed manually (because
> +	 *    glibc checks for speed and supports Bxxx bit rates only)...
> +	 */
> +#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
> +# define BOTHER 0010000               /* non standard rate */
> +	dbg("using non-standard speeds");
> +	ts->c_ospeed = ts->c_ispeed = speed;
> +	ts->c_cflag &= ~CBAUD;
> +	ts->c_cflag |= BOTHER;
> +	return 0;
> +#else
> +	return -1;
> +#endif
> +}

not sure there's much value here if termios2 is dropped.  
_HAVE_STRUCT_TERMIOS_C_ISPEED is defined even on arches where the userspace 
termios that has ispeed does not match the kernel termios which lacks ispeed.  
so the behavior on most systems is the same as if you only called 
cfsetspeed().
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux