[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] fd / fcntl / ioctl mm



Hej, igen.

Jag tar problemet en gång till. 

Jag har två processer, parent och child. Innan fork, så skapades två
pipe's en för att läsa och en för att skriva. Sedan gjorde jag
fork. Parent och child "pratar" således med varrandra genom dessas två
pipes. Det fungerar bra. Men jag vill ändra inläsnings sättet på pipen,
från NONBLOCKING till ICANON där VEOL = 3. Jag provade med följande
funktion:

int SetIos(int fd)
{
  struct termios ios;
  int temp;

  temp = tcgetattr(fd, &ios);
  if(temp == -1 && DEBUG == 10) printf("SetIos: %s\n", strerror(errno));
  ios.c_iflag = IGNPAR;
  ios.c_oflag = 0;
  ios.c_lflag = ICANON;
  ios.c_cc[VEOL] = 3;
  temp = tcflush(fd, TCIFLUSH);
  if(temp == -1 && DEBUG == 10) printf("SetIos: %s\n", strerror(errno));
  temp = tcsetattr(fd, TCSANOW, &ios);
  if(temp == -1 && DEBUG == 10) printf("SetIos: %s\n", strerror(errno));

  return TRUE;
}

Denna funktionen skapar följande output:

SetIos: Invalid argument
SetIos: Invalid argument
SetIos: Invalid argument

Jag antar att detta beror på att termios-funktionerna måste ha
"hårdvara" under sig. Jag misstänker att detta skall göras med fcntl, men
jag vet inte hur. 

Någon som har något tips? Var kan man hitta info om detta?

mvh

 Martin Bertilsson Haagen
 sslug@sslug



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *