Source-Changes archive

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

re: CVS commit: src/sys/kern



On Jul 2,  5:37am, mrg%eterna.com.au@localhost (matthew green) wrote:
-- Subject: re: CVS commit: src/sys/kern

| 
|    > Module Name:     src
|    > Committed By:    christos
|    > Date:            Sat Jul  1 15:38:28 UTC 2006
|    > 
|    > Modified Files:
|    >  src/sys/kern: uipc_socket2.c
|    > 
|    > Log Message:
|    > Revert previous change to bump the socket low watermark to 
sock_loan_thresh.
|    > With sock_loan_thresh=4096, sb_lowat==sb_hiwat, and sowritable will never
|    > be true (even if only a single byte is pending). Some programs (like 
screen)
|    > expect select() to return that a socket is writable on a socket when 
there
|    > is space to write to it. XXX: What is the right thing to do here?
|    
|    i guess the right thing is fixing the configure script...
| 
| 
| why is it wrong?

This is the script; it writes 4 bytes to the socket, and expects that
the second select will return 2, one for the socket being readable,
and one for being writable. The socket "sowritable" test will always
fail if sb_hiwat == sb_lowat and there are bytes in the queue.

Another way to "fix" the problem is to increase the high watermark
if not set to be lowat + MCLBYTES.

christos

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

char *nam = "/tmp/conftest20904";

main()
{
  fd_set f;
  int rv = 0;

  (void)alarm(5);
  unlink(nam);
  if (mkfifo(nam, 0777))
    exit(1);
  close(0);
  if (open(nam, O_RDWR | O_NONBLOCK))
    exit(1);
  if (write(0, "TEST", 4) == -1)
    exit(1);

  FD_SET(0, &f);
  if (select(1, &f, 0, 0, 0) == -1)
    rv = 1;
  if (select(1, &f, &f, 0, 0) != 2)
    rv = 1;
  return 0;
}




Home | Main Index | Thread Index | Old Index