/* -*-C-*-
-$Id: os2sock.c,v 1.2 1996/05/17 17:26:03 cph Exp $
+$Id: os2sock.c,v 1.3 1996/05/18 06:10:25 cph Exp $
Copyright (c) 1990-96 Massachusetts Institute of Technology
int s;
struct sockaddr_in address;
+ transaction_begin ();
VALUE_SOCKET_CALL (socket, (PF_INET, SOCK_STREAM, 0), s);
+ socket_close_on_abort (s);
memset ((&address), 0, (sizeof (address)));
(address . sin_family) = AF_INET;
memcpy ((& (address . sin_addr)), host, (sizeof (struct in_addr)));
int s;
struct sockaddr_un address;
+ transaction_begin ();
VALUE_SOCKET_CALL (socket, (PF_OS2, SOCK_STREAM, 0), s);
+ socket_close_on_abort (s);
memset ((&address), 0, (sizeof (address)));
(address . sun_family) = AF_OS2;
strncpy ((address . sun_path), filename, (sizeof (address . sun_path)));
&& (port >= (1 << (CHAR_BIT * nb_port))))
error_bad_range_arg (arg_number);
}
+ transaction_begin ();
VALUE_SOCKET_CALL (socket, (PF_INET, SOCK_STREAM, 0), s);
+ socket_close_on_abort (s);
memset ((&address), 0, (sizeof (address)));
(address . sin_family) = AF_INET;
(address . sin_addr . s_addr) = INADDR_ANY;
static struct sockaddr_in address;
int s;
+ transaction_begin ();
while (1)
{
int address_length = (sizeof (struct sockaddr_in));
OS2_error_system_call ((sock_errno ()), syscall_accept);
deliver_pending_interrupts ();
}
+ socket_close_on_abort (s);
if (peer_host != 0)
memcpy (peer_host, (& (address . sin_addr)), (sizeof (struct in_addr)));
if (peer_port != 0)
static Tchannel
initialize_stream_socket (int s, enum channel_type type)
{
- transaction_begin ();
- socket_close_on_abort (s);
- {
- Tchannel channel = (OS2_allocate_channel ());
- OS2_initialize_channel (channel, s, (CHANNEL_READ | CHANNEL_WRITE), type);
- OS2_start_channel_thread (channel,
- stream_socket_reader,
- stream_socket_operator);
- transaction_commit ();
- return (channel);
- }
+ Tchannel channel = (OS2_allocate_channel ());
+ OS2_initialize_channel (channel, s, (CHANNEL_READ | CHANNEL_WRITE), type);
+ OS2_start_channel_thread (channel,
+ stream_socket_reader,
+ stream_socket_operator);
+ transaction_commit ();
+ return (channel);
}
static msg_t *