This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tc[gs]etattr and PPC

Ulrich Drepper <> writes:

|> Thorsten Kukuk <> writes:
|> > Some programs like xterm makes TCSETS-ioctls (and don't call 
|> > tcsetattr), but we call tcsetattr which fails and return a wrong
|> > error code to the caller.
|> > 
|> > POSIX says:
|> > 
|> >     The tcsetattr() function shall return successfully if it was able to
|> >     perform any of the requested actions, even if some of the requested
|> >     actions could not be performed.
|> > 
|> > so the wrapper in the current implementation is not correct.
|> > 
|> > How can we fix this? One suggestion is to add an internal flag so
|> > that our tcsetattr does not perform the check, the other is to
|> > remove or fix the wrapper.
|> You haven't given an example why you think it's wrong.  Not calling
|> the kernel for unimplemented functionality and failing is correct.
|> What the text above means is that is any of the defined actions fail
|> (like changing the baud rate if supported) tcsetattr() still returns
|> successfully.  What exactly do you have in mind?

The tcsetattr wrapper checks if any of CSIZE, PARENB, CREAD have not been
performed.  But it does not take into account that there might be other
changes that do have been performed, and thus tcsetattr should return
sucessfully anyway.  The following program reports an error although
TOSTOP has been successfully modified:

#include <termios.h>
#include <stdio.h>

main (void)
  struct termios t;

  tcgetattr (0, &t);
  t.c_cflag ^= CREAD;
  t.c_lflag ^= TOSTOP;
  if (tcsetattr (0, TCSANOW, &t))
    perror ("tcsetattr");
  return 0;


Andreas Schwab, SuSE Labs,
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]