diff options
Diffstat (limited to 'pflocal')
-rw-r--r-- | pflocal/ChangeLog | 378 | ||||
-rw-r--r-- | pflocal/io.c | 14 | ||||
-rw-r--r-- | pflocal/pf.c | 5 | ||||
-rw-r--r-- | pflocal/socket.c | 59 |
4 files changed, 62 insertions, 394 deletions
diff --git a/pflocal/ChangeLog b/pflocal/ChangeLog deleted file mode 100644 index f12686c0..00000000 --- a/pflocal/ChangeLog +++ /dev/null @@ -1,378 +0,0 @@ -2005-05-17 Neal H. Walfield <neal@gnu.org> - - * sock.c (sock_free): Don't destroy SOCK->CONNECT_QUEUE. - -2002-06-08 Roland McGrath <roland@frob.com> - - * io.c (S_io_identity): Use ino_t for FILENO. - -2002-05-08 Roland McGrath <roland@frob.com> - - * io.c (S_io_reauthenticate): unsigned -> size_t - (S_io_restrict_auth): Likewise. - -2002-04-24 Ognyan Kulev <ogi@fmi.uni-sofia.bg> - - * sock.c (sock_shutdown): When both SHUTDOWN_READ and - SHUTDOWN_WRITE are set in FLAGS unlock sock->lock after all - processing of `sock' is finished. - (sock_create): Replace bzero with memset. - -2001-12-22 Roland McGrath <roland@frob.com> - - * connq.c (connq_compress): #if 0 out unused function. - - * sock.h (sock_deref): Don't define this extern inline. - Instead, use static inline and __attribute__ ((unused)). - * mig-decls.h (begin_using_sock_user_port): Likewise. - (end_using_sock_user_port): Likewise. - (begin_using_addr_port): Likewise. - (end_using_addr_port): Likewise. - -2001-03-31 Roland McGrath <roland@frob.com> - - * sock.c: Include "connq.h" for connq_destroy decl. - -2001-02-20 Marcus Brinkmann <marcus@gnu.org> - - * connq.c: Include <assert.h>. Reported by Arkadi E. Shishlov - <arkadi@it.lv>. - -2001-02-11 Marcus Brinkmann <marcus@gnu.org> - - * connq.c (connq_destroy): New function. - * connq.h: Prototype connq_destroy. - * sock.c (sock_free): Call connq_destroy when listen or connect - queue exist. - -2000-08-09 Mark Kettenis <kettenis@gnu.org> - - * pf.c (S_socket_create): Only accept S_IFCHR, S_IFSOCK and - S_IFIFO as `magic' protocols. - -2000-08-02 Mark Kettenis <kettenis@gnu.org> - - Add `magic' protocols to specify the file type of a sockets. This - allows implementation of POSIX pipes by using a S_IFSOCK protocol. - * sock.h: Include <sys/types.h>. - (struct sock): Add new member `mode'. - (sock_create): Add new parameter `mode'. - * sock.c (sock_create): Initialize `mode' member of struct sock, - with new parameter. - * pf.c (S_socket_create): Pass file type/mode to sock_create based - on PROTOCOL. - * io.c (S_io_stat): Use new member of `struct sock' to set - ST->st_mode. - -2000-07-26 Mark Kettenis <kettenis@gnu.org> - - * Makefile (HURDLIBS): Reorder libs such that the threads lib - comes before the ports lib. This makes sure the functions in - libthreads properly override the stubs in libports with the new - dynamic linker semantics in glibc 2.2. - -1999-09-13 Roland McGrath <roland@baalperazim.frob.com> - - * io.c: Reverted changes related to io_map_segment. - -1999-09-07 Thomas Bushnell, BSG <tb@mit.edu> - - * io.c (S_io_map_segment): New function. - -1999-07-11 Roland McGrath <roland@baalperazim.frob.com> - - * sock.h: Add #include <sys/mman.h>. - -1999-07-10 Roland McGrath <roland@baalperazim.frob.com> - - * io.c: Add #include <sys/mman.h> for munmap decl. - -1999-07-09 Thomas Bushnell, BSG <tb@mit.edu> - - * pf.c (S_socket_whatis_address): Use mmap instead of vm_allocate. - -1999-07-03 Thomas Bushnell, BSG <tb@mit.edu> - - * io.c (TRASH_IDS): Use munmap instead of vm_deallocate. - -1999-03-01 Mark Kettenis <kettenis@gnu.org> - - * pf.c (S_socket_whatis_address): Implement. Since we cannot tell - what our adress is, return an empty string as the file name. - -Tue Feb 16 05:52:35 1999 Thomas Bushnell, BSG <tb@mit.edu> - - * io.c (S_io_revoke): New function. Don't attempt to implement. - (Other systems don't even permit non-file revokes.) - -1998-10-20 Roland McGrath <roland@baalperazim.frob.com> - - * io.c (S_io_select): Add braces to silence gcc warning. - -1998-07-20 Roland McGrath <roland@baalperazim.frob.com> - - * pflocal.c (main): Fix return type to int, and use return. - -Wed Aug 20 14:06:11 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> - - * pflocal.c (main): New args for - ports_manage_port_operations_multithread. - * sserver.c (handle_sock_requests): Likewise. - -Mon Oct 7 12:53:24 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * connq.c (connq_listen): Unlock CQ->lock when returning EWOULDBLOCK. - -Thu Sep 12 16:43:09 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> - - * Makefile (HURDLIBS): New variable. - (pflocal): Omit special dependency. - -Tue Jul 23 19:44:29 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * sock.c (sock_create): Remove NEXT_SOCK_ID. - -Sat Jul 13 20:20:55 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> - - * io.c (S_io_reauthenticate): Repeat sock_create_port and - auth_server_authenticate for as long as we get EINTR. - -Sun Jul 7 21:30:33 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> - - * io.c (S_io_reauthenticate): Don't use unsafe MOVE_SEND in call - to auth_server_authenticate. - -Mon Jul 1 18:45:35 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * sock.c (sock_create): Initialize ID field to MACH_PORT_NULL. - -Thu Jun 27 17:58:09 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> - - * Makefile (LCLHDRS): Add sserver.h. - -Thu Jun 20 16:33:06 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * Makefile (pflocal): Depend on ../libfshelp/libfshelp.a. - -Wed May 15 20:27:38 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * sock.c (sock_free): Destroy SOCK's id port if necessary. - -Tue May 14 14:05:33 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * io.c (S_io_identity): New function. - * sock.h (struct sock): Make the id field a receive right, not an int. - -Thu May 9 20:20:20 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> - - * io.c (S_io_reauthenticate): Use new auth_server_authenticate - protocol. - -Thu May 9 12:14:37 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * io.c (S_io_select): Remove TAG arg. - -Mon Apr 15 12:52:32 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> - - * Makefile (MIGSFLAGS): Look for mig-mutate.h in $(srcdir). - -Fri Jan 26 16:46:37 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * socket.c (S_socket_recv): Test for MSG_OOB in IN_FLAGS, not FLAGS. - Return EINVAL if we get MSG_OOB, not EOPNOTSUPP. - -Thu Jan 25 17:34:50 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * sock.c (sock_create_port, addr_create): Use ports_create_port - instead of ports_allocate_port. - * pflocal.c (trivfs_goaway): Handle errors from - ports_inhibit_bucket_rpcs. - (thread_cancel): Function deleted. - -Tue Jan 23 21:31:40 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * socket.c (S_socket_connect): Handle connectionless protocols - correctly. - - * socket.c (S_socket_send): Allow DEST_ADDR to be null if the - socket is connected. - - * sock.c (sock_bind): Don't change SOCK's ref count if we're - returning an error. - -Thu Jan 4 15:44:13 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * io.c (S_io_select): Reworked to avoid calling - ports_interrupt_self_on_port_death() if there's data immediately - available. Also, don't block if we can return EOF/EPIPE. - -Thu Dec 28 13:46:32 1995 Miles Bader <miles@gnu.ai.mit.edu> - - * io.c (S_io_select): Use handy macro to avoid unthinkable line break. - -Tue Dec 26 17:30:18 1995 Miles Bader <miles@gnu.ai.mit.edu> - - * io.c (S_io_select): Add reply port parameter, and request - notification if it dies. - * mig-mutate.h (IO_SELECT_REPLY_PORT): New def. - -Mon Nov 13 14:03:03 1995 Miles Bader <miles@gnu.ai.mit.edu> - - * socket.c (S_socket_bind, S_socket_connect): Drop ADDR's send right. - -Thu Nov 9 13:18:44 1995 Miles Bader <miles@gnu.ai.mit.edu> - - * socket.c (S_socket_connect): Drop our reference to ADDR. - -Sun Nov 5 10:01:15 1995 Miles Bader <miles@gnu.ai.mit.edu> - - * pf.c (S_socket_create_address): Removing BINDING argument. - - * pflocal.c (main): Add FLAGS argument to trivfs_startup call. - -Tue Sep 19 14:07:24 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * io.c (S_io_pathconf): New function. - (S_io_set_all_openmodes, S_io_set_some_openmodes, - S_io_clear_some_openmodes): The user specifies O_NONBLOCK, not - SOCK_NONBLOCK. - (S_io_get_openmodes): Always return O_APPEND. - -Wed Sep 6 11:53:48 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * sserver.c (sock_demuxer): Use ports_interrupt_server and - ports_notify_server instead of our own version. - (do_mach_notify_no_senders, do_mach_notify_port_deleted, - do_mach_notify_msg_accepted, do_mach_notify_port_destroyed, - do_mach_notify_port_deleted, do_mach_notify_send_once, - do_mach_notify_dead_name): Functions deleted. - * io.c (S_interrupt_operation): Function deleted. - * Makefile (MIGSTUBS): Remove notifyServer.o and interruptServer.o. - - * io.c (S_io_read, S_io_readable): Don't return EPIPE on EOF. - -Tue Sep 5 14:22:18 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * io.c (S_io_stat): Only attempt to use the read pipe if it exists. - -Thu Aug 31 16:31:18 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * io.c (S_io_select): Change the way selects are done, now that - writes can block. - (S_io_write): Pass in the new NOBLOCK parameter to pipe_write. - * socket.c (S_socket_send): Pass in the new NOBLOCK parameter to - pipe_send. - -Tue Aug 29 14:33:14 1995 Miles Bader <miles@geech.gnu.ai.mit.edu> - - * io.c (S_io_select): Use pipe_select instead of pipe_wait. - - * connq.c (struct connq): Remove interrupt_seq_num field. - (connq_listen): Use hurd_condition_wait to detect interrupts - instead of previous ad-hoc mechanism. - (connq_interrupt, connq_interrupt_sock): Functions deleted. - * connq.h (connq_interrupt, connq_interrupt_sock): Decls deleted. - * io.c (S_interrupt_operation): Use ports_interrupt_rpc to - interrupt waiting threads. - - * sock.c (sock_acquire_read_pipe, sock_acquire_write_pipe): - `aquire' -> `acquire'. - * socket.c (S_socket_send, S_socket_recv): Ditto. - * sock.h: Ditto. - -Tue Aug 29 14:30:59 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> - - * io.c (S_io_select): Fix typo in masking off SELECT_URG. - Don't check open modes and return EBADF. - -Thu Aug 24 10:35:58 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * Makefile (pflocal): Put all dependencies here. - (OBJS): Remove error.o. - (HURDLIBS): Removed. - Removed all rules dealing with error.o. - -Mon Aug 21 16:37:32 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * pflocal.c (trivfs_goaway, trivfs_modify_stat): Update arguments. - -Fri Aug 11 15:33:28 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * sock.h (struct sock): Store the pipe class in a separate field, - as READ_PIPE is no longer always defined. - * sock.c (sock_create, sock_connect): Set/use the PIPE_CLASS field. - (sock_connect, sock_aquire_write_pipe): Use pipe_aquire_writer - instead of pipe_aquire. - (sock_aquire_read_pipe): Use pipe_aquire_reader instead of - pipe_aquire. Handle the case where there is no read pipe (in - which case return EPIPE). - (sock_shutdown): Make shutting down the read half just like the - write half -- the pipe goes away... - (sock_create): Don't bump the read pipe ref count ourself. - (sock_free): Use sock_shutdown to trash the read pipe too. - - * socket.c - (S_socket_recv): Use pipe_release_reader instead of pipe_release. - (S_socket_send): Use pipe_release_writer instead of pipe_release. - (S_socket_recv): Reflect EPIPE as EOF. - - * io.c (S_io_read, S_interrupt_operation, S_io_readable, S_io_select): - Use pipe_release_reader instead of pipe_release. - (S_io_write): Use pipe_release_writer instead of pipe_release. - (S_io_readable, S_io_read): Reflect EPIPE as EOF. - -Mon Jul 31 13:59:15 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * connq.c (connq_compress): New function. - (connq_interrupt_sock): Use connq_compress to compress the queue. - -Sun Jul 30 10:30:24 1995 Miles Bader <miles@duality.gnu.ai.mit.edu> - - * connq.c (connq_interrupt_sock): Reset CQ's tail to the end of - the compressed queue. - -Sat Jul 29 00:00:57 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * socket.c (S_socket_send): Only free SOURCE_ADDR if the send - fails, as otherwise it's consumed; also free all the ports in - PORTS if the send fails. - - * io.c (S_interrupt_operation): Allow socket trying to connect to - be interrupted. - * connq.c (connq_interrupt_sock): New function. - * socket.c (S_socket_connect): Use the CONNECT_QUEUE field to - allow only a single connection attempt at once. - Check for already-connected sockets here instead of waiting for - the final rendezvous. - * connq.h (connq_interrupt_sock): New declaration. - - * connq.c (connq_listen, connq_connect, connq_interrupt, - connq_set_length): Reverse the roles of the HEAD and TAIL fields, - and make sure they're used correctly. - (qprev): Deleted function. - - * sock.h (struct sock, all uses changed): Add the CONNECT_QUEUE - field, and rename the CONNQ field to LISTEN_QUEUE. - * sock.c (sock_create): Initialize the CONNECT_QUEUE field and - rename CONNQ to LISTEN_QUEUE. - - * connq.c (connq_set_length): When shrinking the queue, actually - do so, and don't leak memory. - - * socket.c (S_socket_connect): Return ECONNREFUSED when trying to - connect to a non-existant address, instead of EADDRNOTAVAIL. - - * connq.c (struct connq): Add the INTERRUPT_SEQ_NUM field, used to - detect interupts. - (connq_listen): Detect when we get interrupted, and return EINTR. - (connq_interrupt): New function. - * connq.h (connq_interrupt): New declaration. - * io.c (S_interrupt_operation): Call connq_interrupt when appropiate. - - * connq.c (connq_connect): Initialize REQ before using it. - (connq_request_init): Swap the arguments. - (connq_listen): Don't lock the accepted request just to get its sock. - - * socket.c (S_socket_connect): Actually use the connq operations - to connect, like the listening socket is expecting, instead of - connecting directly to it. diff --git a/pflocal/io.c b/pflocal/io.c index bd9ecbdd..74c2f970 100644 --- a/pflocal/io.c +++ b/pflocal/io.c @@ -1,6 +1,8 @@ /* Socket I/O operations - Copyright (C) 1995,96,98,99,2000,02 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1998, 1999, 2000, 2002, 2007 + Free Software Foundation, Inc. + Written by Miles Bader <miles@gnu.org> This program is free software; you can redistribute it and/or @@ -272,10 +274,10 @@ S_io_stat (struct sock_user *user, struct stat *st) struct sock *sock; struct pipe *rpipe, *wpipe; - void copy_time (time_value_t *from, time_t *to_sec, unsigned long *to_usec) + void copy_time (time_value_t *from, time_t *to_sec, unsigned long *to_nsec) { *to_sec = from->seconds; - *to_usec = from->microseconds; + *to_nsec = from->microseconds * 1000; } if (!user) @@ -300,7 +302,7 @@ S_io_stat (struct sock_user *user, struct stat *st) if (rpipe) { mutex_lock (&rpipe->lock); - copy_time (&rpipe->read_time, &st->st_atime, &st->st_atime_usec); + copy_time (&rpipe->read_time, &st->st_atim.tv_sec, &st->st_atim.tv_nsec); /* This seems useful. */ st->st_size = pipe_readable (rpipe, 1); mutex_unlock (&rpipe->lock); @@ -309,11 +311,11 @@ S_io_stat (struct sock_user *user, struct stat *st) if (wpipe) { mutex_lock (&wpipe->lock); - copy_time (&wpipe->write_time, &st->st_mtime, &st->st_mtime_usec); + copy_time (&wpipe->write_time, &st->st_mtim.tv_sec, &st->st_mtim.tv_nsec); mutex_unlock (&wpipe->lock); } - copy_time (&sock->change_time, &st->st_ctime, &st->st_ctime_usec); + copy_time (&sock->change_time, &st->st_ctim.tv_sec, &st->st_ctim.tv_nsec); mutex_unlock (&sock->lock); diff --git a/pflocal/pf.c b/pflocal/pf.c index d72e01b5..32c12e17 100644 --- a/pflocal/pf.c +++ b/pflocal/pf.c @@ -1,6 +1,6 @@ /* Protocol family operations - Copyright (C) 1995, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995, 1999, 2000, 2008 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -108,12 +108,13 @@ S_socket_fabricate_address (mach_port_t pf, *addr_port = ports_get_right (addr); *addr_port_type = MACH_MSG_TYPE_MAKE_SEND; + ports_port_deref (addr); return 0; } /* Implement socket_whatis_address as described in <hurd/socket.defs>. - Since we cannot tell what our adress is, return an empty string as + Since we cannot tell what our address is, return an empty string as the file name. This is primarily for the implementation of accept and recvfrom. The functions getsockname and getpeername remain unsupported for the local namespace. */ diff --git a/pflocal/socket.c b/pflocal/socket.c index 0bc72066..faa9951d 100644 --- a/pflocal/socket.c +++ b/pflocal/socket.c @@ -1,6 +1,6 @@ /* Socket-specific operations - Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1995, 2008, 2010 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -245,6 +245,7 @@ S_socket_name (struct sock_user *user, *addr_port = ports_get_right (addr); *addr_port_type = MACH_MSG_TYPE_MAKE_SEND; + ports_port_deref (addr); return 0; } @@ -308,7 +309,7 @@ S_socket_send (struct sock_user *user, struct addr *dest_addr, int flags, if (dest_sock) /* Grab the destination socket's read pipe directly, and stuff data into it. This is not quite the usage sock_acquire_read_pipe was - intended for, but it will work, as the only inappropiate errors + intended for, but it will work, as the only inappropriate errors occur on a broken pipe, which shouldn't be possible with the sort of sockets with which we can use socket_send... XXXX */ err = sock_acquire_read_pipe (dest_sock, &pipe); @@ -322,7 +323,10 @@ S_socket_send (struct sock_user *user, struct addr *dest_addr, int flags, source_addr, data, data_len, control, control_len, ports, num_ports, amount); - pipe_release_writer (pipe); + if (dest_sock) + pipe_release_reader (pipe); + else + pipe_release_writer (pipe); } if (err) @@ -391,7 +395,7 @@ S_socket_recv (struct sock_user *user, /* Setup mach ports for return. */ { *addr_type = MACH_MSG_TYPE_MAKE_SEND; - *ports_type = MACH_MSG_TYPE_MAKE_SEND; + *ports_type = MACH_MSG_TYPE_COPY_SEND; if (source_addr) { *addr = ports_get_right (source_addr); @@ -407,19 +411,58 @@ S_socket_recv (struct sock_user *user, return err; } -/* Stubs for currently unsupported rpcs. */ - error_t S_socket_getopt (struct sock_user *user, int level, int opt, char **value, size_t *value_len) { - return EOPNOTSUPP; + int ret = 0; + + if (!user) + return EOPNOTSUPP; + + mutex_lock (&user->sock->lock); + switch (level) + { + case SOL_SOCKET: + switch (opt) + { + case SO_TYPE: + assert (*value_len >= sizeof (int)); + *(int *)*value = user->sock->pipe_class->sock_type; + *value_len = sizeof (int); + break; + default: + ret = ENOPROTOOPT; + break; + } + break; + default: + ret = ENOPROTOOPT; + break; + } + mutex_unlock (&user->sock->lock); + + return ret; } error_t S_socket_setopt (struct sock_user *user, int level, int opt, char *value, size_t value_len) { - return EOPNOTSUPP; + int ret = 0; + + if (!user) + return EOPNOTSUPP; + + mutex_lock (&user->sock->lock); + switch (level) + { + default: + ret = ENOPROTOOPT; + break; + } + mutex_unlock (&user->sock->lock); + + return ret; } |