52#define PCALL_LOGERR(where, callfn, fd, args...) \
55 int ret = callfn(fd, args); \
59 strerror_r(errno, buf, sizeof(buf)); \
60 LOG_ERROR("fd %d %s: %s", fd, where, buf); \
70 const int rcvbuf = config_gridconnect_tcp_rcv_buffer_size();
76 const int sndbuf = config_gridconnect_tcp_snd_buffer_size();
80 SO_SNDBUF, &sndbuf,
sizeof(sndbuf));
86 const int lowat = config_gridconnect_tcp_notsent_lowat_buffer_size();
90 IPPROTO_TCP, TCP_NOTSENT_LOWAT, &lowat,
sizeof(lowat));
108 HASSERT(!tcflush(fd, TCIOFLUSH));
109 struct termios settings;
110 HASSERT(!tcgetattr(fd, &settings));
111 cfmakeraw(&settings);
112 cfsetspeed(&settings, B115200);
113 HASSERT(!tcsetattr(fd, TCSANOW, &settings));
125 if (S_ISSOCK(statbuf.st_mode))
#define PCALL_LOGERR(where, callfn, fd, args...)
Performs a system call on an fd.
int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len)
Set the socket options.
int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
Get the socket options.
#define IPPROTO_TCP
TCP Raw Socket.
#define LOG(level, message...)
Conditionally write a message to the logging output.
static const int ALWAYS
Loglevel that is always printed.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.
#define SO_RCVBUF
socket option for receive buffer size
uint32_t socklen_t
type of sockaddr lenth
#define SOL_SOCKET
socket option category
static void optimize_socket_fd(int fd)
Optimizes the kernel settings like socket and TCP options for an fd that is an outgoing TCP socket.
static void optimize_tty_fd(int fd)
Sets the kernel settings like queuing and terminal settings for an fd that is an outgoing tty.
static void optimize_fd(int fd)
For an fd that is an outgoing link, detects what kind of file descriptor this is and calls the approp...