diff options
Diffstat (limited to 'hurd')
88 files changed, 626 insertions, 399 deletions
diff --git a/hurd/Makefile b/hurd/Makefile index a41737f497..91d14660d9 100644 --- a/hurd/Makefile +++ b/hurd/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2018 Free Software Foundation, Inc. +# Copyright (C) 1991-2019 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ # You should have received a copy of the GNU Lesser General Public # License along with the GNU C Library; if not, see -# <http://www.gnu.org/licenses/>. +# <https://www.gnu.org/licenses/>. subdir := hurd @@ -33,8 +33,9 @@ user-interfaces := $(addprefix hurd/,\ process process_request \ msg msg_reply msg_request \ exec exec_startup crash interrupt \ - fs fsys io term tioctl socket ifsock \ - login password pfinet \ + fs fsys io io_reply io_request \ + term tioctl socket ifsock \ + login password pfinet pci \ ) server-interfaces := hurd/msg faultexc diff --git a/hurd/Versions b/hurd/Versions index af6a0e45de..b6508e03c6 100644 --- a/hurd/Versions +++ b/hurd/Versions @@ -136,6 +136,10 @@ libc { __hurd_threadvar_location; _hurd_userlink_link; _hurd_userlink_unlink; _hurd_userlink_clear; } + GLIBC_2.29 { + # "quasi-internal" functions + _hurd_port_move; + } HURD_CTHREADS_0.3 { # weak refs to libthreads functions that libc calls iff libthreads in use diff --git a/hurd/alloc-fd.c b/hurd/alloc-fd.c index 19775bf964..096946e9cf 100644 --- a/hurd/alloc-fd.c +++ b/hurd/alloc-fd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/fd.h> diff --git a/hurd/catch-exc.c b/hurd/catch-exc.c index 8d3cb7d798..82a81f8265 100644 --- a/hurd/catch-exc.c +++ b/hurd/catch-exc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <mach/exc_server.h> #include <hurd/signal.h> diff --git a/hurd/catch-signal.c b/hurd/catch-signal.c index 56ce86532d..3169604777 100644 --- a/hurd/catch-signal.c +++ b/hurd/catch-signal.c @@ -1,5 +1,5 @@ /* Convenience function to catch expected signals during an operation. - Copyright (C) 1996-2018 Free Software Foundation, Inc. + Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd/signal.h> #include <hurd/sigpreempt.h> diff --git a/hurd/compat-20.c b/hurd/compat-20.c index 86401819d1..f525c05197 100644 --- a/hurd/compat-20.c +++ b/hurd/compat-20.c @@ -1,5 +1,5 @@ /* Old-versioned functions for binary compatibility with glibc-2.0. - Copyright (C) 1998-2018 Free Software Foundation, Inc. + Copyright (C) 1998-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> diff --git a/hurd/ctty-input.c b/hurd/ctty-input.c index ec4092b855..95f067a16c 100644 --- a/hurd/ctty-input.c +++ b/hurd/ctty-input.c @@ -1,5 +1,5 @@ /* _hurd_ctty_input -- Do an input RPC and generate SIGTTIN if necessary. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/signal.h> @@ -44,8 +44,8 @@ _hurd_ctty_input (io_t port, io_t ctty, error_t (*rpc) (io_t)) { struct hurd_sigstate *ss = _hurd_self_sigstate (); __spin_lock (&ss->lock); - if (__sigismember (&ss->blocked, SIGTTIN) || - ss->actions[SIGTTIN].sa_handler == SIG_IGN) + if (__sigismember (&ss->blocked, SIGTTIN) + || ss->actions[SIGTTIN].sa_handler == SIG_IGN) /* We are blocking or ignoring SIGTTIN. Just fail. */ err = EIO; __spin_unlock (&ss->lock); diff --git a/hurd/ctty-output.c b/hurd/ctty-output.c index 12fdf78159..d77c35ad6f 100644 --- a/hurd/ctty-output.c +++ b/hurd/ctty-output.c @@ -1,5 +1,5 @@ /* _hurd_ctty_output -- Do an output RPC and generate SIGTTOU if necessary. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/signal.h> @@ -38,8 +38,8 @@ _hurd_ctty_output (io_t port, io_t ctty, error_t (*rpc) (io_t)) SIGTTOU. We redo this check at the top of the loop in case the signal handler changed the state. */ __spin_lock (&ss->lock); - if (__sigismember (&ss->blocked, SIGTTOU) || - ss->actions[SIGTTOU].sa_handler == SIG_IGN) + if (__sigismember (&ss->blocked, SIGTTOU) + || ss->actions[SIGTTOU].sa_handler == SIG_IGN) err = EIO; else err = 0; diff --git a/hurd/dtable.c b/hurd/dtable.c index 5c204676f8..44f8123a7c 100644 --- a/hurd/dtable.c +++ b/hurd/dtable.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/term.h> @@ -266,24 +266,24 @@ reauth_dtable (void) __spin_lock (&d->port.lock); /* Reauthenticate the descriptor's port. */ - if (d->port.port != MACH_PORT_NULL && - ! __io_reauthenticate (d->port.port, - ref, MACH_MSG_TYPE_MAKE_SEND) && - ! __USEPORT (AUTH, __auth_user_authenticate - (port, - ref, MACH_MSG_TYPE_MAKE_SEND, - &new))) + if (d->port.port != MACH_PORT_NULL + && ! __io_reauthenticate (d->port.port, + ref, MACH_MSG_TYPE_MAKE_SEND) + && ! __USEPORT (AUTH, __auth_user_authenticate + (port, + ref, MACH_MSG_TYPE_MAKE_SEND, + &new))) { /* Replace the port in the descriptor cell with the newly reauthenticated port. */ - if (d->ctty.port != MACH_PORT_NULL && - ! __io_reauthenticate (d->ctty.port, - ref, MACH_MSG_TYPE_MAKE_SEND) && - ! __USEPORT (AUTH, __auth_user_authenticate - (port, - ref, MACH_MSG_TYPE_MAKE_SEND, - &newctty))) + if (d->ctty.port != MACH_PORT_NULL + && ! __io_reauthenticate (d->ctty.port, + ref, MACH_MSG_TYPE_MAKE_SEND) + && ! __USEPORT (AUTH, __auth_user_authenticate + (port, + ref, MACH_MSG_TYPE_MAKE_SEND, + &newctty))) _hurd_port_set (&d->ctty, newctty); _hurd_port_locked_set (&d->port, new); diff --git a/hurd/exc2signal.c b/hurd/exc2signal.c index 10aa1ca4cf..59cd53a489 100644 --- a/hurd/exc2signal.c +++ b/hurd/exc2signal.c @@ -1,5 +1,5 @@ /* Translate Mach exception codes into signal numbers. Stub version. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/signal.h> diff --git a/hurd/fchroot.c b/hurd/fchroot.c index ea97a1b388..a4e0ce1dfa 100644 --- a/hurd/fchroot.c +++ b/hurd/fchroot.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2018 Free Software Foundation, Inc. +/* Copyright (C) 1999-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <unistd.h> diff --git a/hurd/fcntl-internal.h b/hurd/fcntl-internal.h index d795e4089c..aebc9e9c73 100644 --- a/hurd/fcntl-internal.h +++ b/hurd/fcntl-internal.h @@ -1,5 +1,5 @@ /* Helper functions for translating between O_* and SOCK_* flags. - Copyright (C) 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/hurd/fd-close.c b/hurd/fd-close.c index d5bd0ffbc2..d06e80a4b8 100644 --- a/hurd/fd-close.c +++ b/hurd/fd-close.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd/fd.h> diff --git a/hurd/fd-read.c b/hurd/fd-read.c index ba3fce818b..05dbe0620c 100644 --- a/hurd/fd-read.c +++ b/hurd/fd-read.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2018 Free Software Foundation, Inc. +/* Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <errno.h> #include <unistd.h> diff --git a/hurd/fd-write.c b/hurd/fd-write.c index 699f23d7e6..d86faab016 100644 --- a/hurd/fd-write.c +++ b/hurd/fd-write.c @@ -1,5 +1,5 @@ /* _hurd_fd_write -- write to a file descriptor; handles job control et al. - Copyright (C) 1993-2018 Free Software Foundation, Inc. + Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <errno.h> #include <unistd.h> diff --git a/hurd/fopenport.c b/hurd/fopenport.c index edb12b83f4..9701424aa9 100644 --- a/hurd/fopenport.c +++ b/hurd/fopenport.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <stdio.h> diff --git a/hurd/get-host.c b/hurd/get-host.c index 2001fc5a86..5b72bc9c0f 100644 --- a/hurd/get-host.c +++ b/hurd/get-host.c @@ -1,5 +1,5 @@ /* Get a host configuration item kept as the whole contents of a file. - Copyright (C) 1996-2018 Free Software Foundation, Inc. + Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <fcntl.h> #include <hurd.h> diff --git a/hurd/getdport.c b/hurd/getdport.c index 337c6a47ba..b626c34316 100644 --- a/hurd/getdport.c +++ b/hurd/getdport.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> @@ -41,8 +41,8 @@ __getdport (int fd) return MACH_PORT_NULL; } - if (fd < 0 || (unsigned int) fd > _hurd_init_dtablesize || - _hurd_init_dtable[fd] == MACH_PORT_NULL) + if (fd < 0 || (unsigned int) fd > _hurd_init_dtablesize + || _hurd_init_dtable[fd] == MACH_PORT_NULL) { errno = EBADF; return MACH_PORT_NULL; diff --git a/hurd/geteuids.c b/hurd/geteuids.c index bf8d576238..91ed592be3 100644 --- a/hurd/geteuids.c +++ b/hurd/geteuids.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2018 Free Software Foundation, Inc. +/* Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/id.h> diff --git a/hurd/getumask.c b/hurd/getumask.c index 5d68662e51..df68e63499 100644 --- a/hurd/getumask.c +++ b/hurd/getumask.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2018 Free Software Foundation, Inc. +/* Copyright (C) 1992-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> diff --git a/hurd/hurd-raise.c b/hurd/hurd-raise.c index 9fe5541311..75d997acb8 100644 --- a/hurd/hurd-raise.c +++ b/hurd/hurd-raise.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/signal.h> diff --git a/hurd/hurd.h b/hurd/hurd.h index d3c868928b..ff7700a6c7 100644 --- a/hurd/hurd.h +++ b/hurd/hurd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2018 Free Software Foundation, Inc. +/* Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_H diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h index af5fdcf759..d2983e751d 100644 --- a/hurd/hurd/fd.h +++ b/hurd/hurd/fd.h @@ -1,5 +1,5 @@ /* File descriptors. - Copyright (C) 1993-2018 Free Software Foundation, Inc. + Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_FD_H diff --git a/hurd/hurd/id.h b/hurd/hurd/id.h index 38988bfe72..8492a50357 100644 --- a/hurd/hurd/id.h +++ b/hurd/hurd/id.h @@ -1,5 +1,5 @@ /* User and group IDs. - Copyright (C) 1993-2018 Free Software Foundation, Inc. + Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_ID_H diff --git a/hurd/hurd/ioctl.h b/hurd/hurd/ioctl.h index ae74898255..c45a31cb17 100644 --- a/hurd/hurd/ioctl.h +++ b/hurd/hurd/ioctl.h @@ -1,5 +1,5 @@ /* User-registered handlers for specific `ioctl' requests. - Copyright (C) 1993-2018 Free Software Foundation, Inc. + Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_IOCTL_H #define _HURD_IOCTL_H 1 diff --git a/hurd/hurd/lookup.h b/hurd/hurd/lookup.h index d0fa87b3d6..7485dfe60b 100644 --- a/hurd/hurd/lookup.h +++ b/hurd/hurd/lookup.h @@ -1,5 +1,5 @@ /* Declarations of file name translation functions for the GNU Hurd. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_LOOKUP_H #define _HURD_LOOKUP_H 1 diff --git a/hurd/hurd/port.h b/hurd/hurd/port.h index 0779578d03..b656870724 100644 --- a/hurd/hurd/port.h +++ b/hurd/hurd/port.h @@ -1,5 +1,5 @@ /* Lightweight user references for ports. - Copyright (C) 1993-2018 Free Software Foundation, Inc. + Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_PORT_H @@ -127,6 +127,31 @@ _hurd_port_get (struct hurd_port *port, #endif +/* Relocate LINK to NEW_LINK. + To be used when e.g. reallocating a link array. */ + +extern void +_hurd_port_move (struct hurd_port *port, + struct hurd_userlink *new_link, + struct hurd_userlink *link); + +#if defined __USE_EXTERN_INLINES && defined _LIBC +# if IS_IN (libc) +_HURD_PORT_H_EXTERN_INLINE void +_hurd_port_move (struct hurd_port *port, + struct hurd_userlink *new_link, + struct hurd_userlink *link) +{ + HURD_CRITICAL_BEGIN; + __spin_lock (&port->lock); + _hurd_userlink_move (new_link, link); + __spin_unlock (&port->lock); + HURD_CRITICAL_END; +} +# endif +#endif + + /* Free a reference gotten with `USED_PORT = _hurd_port_get (PORT, LINK);' */ extern void diff --git a/hurd/hurd/resource.h b/hurd/hurd/resource.h index eb93110799..965043969b 100644 --- a/hurd/hurd/resource.h +++ b/hurd/hurd/resource.h @@ -1,5 +1,5 @@ /* Resource limits for the Hurd. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_RESOURCE_H #define _HURD_RESOURCE_H diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h index f84c4ef485..3670a91a00 100644 --- a/hurd/hurd/signal.h +++ b/hurd/hurd/signal.h @@ -1,5 +1,5 @@ /* Implementing POSIX.1 signals under the Hurd. - Copyright (C) 1993-2018 Free Software Foundation, Inc. + Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_SIGNAL_H @@ -168,7 +168,12 @@ extern int _hurd_core_limit; A critical section is a section of code which cannot safely be interrupted to run a signal handler; for example, code that holds any lock cannot be interrupted lest the signal handler try to take the same lock and - deadlock result. */ + deadlock result. + + As a consequence, a critical section will see its RPCs return EINTR, even if + SA_RESTART is set! In that case, the critical section should be left, so + that the handler can run, and the whole critical section be tried again, to + avoid unexpectingly exposing EINTR to the application. */ extern void *_hurd_critical_section_lock (void); @@ -379,8 +384,8 @@ extern mach_msg_timeout_t _hurd_interrupted_rpc_timeout; __mach_port_deallocate (__mach_task_self (), msgport); \ if ((dealloc_refport) && refport != MACH_PORT_NULL) \ __mach_port_deallocate (__mach_task_self (), refport); \ - } while (__err == MACH_SEND_INVALID_DEST || \ - __err == MIG_SERVER_DIED); \ + } while (__err == MACH_SEND_INVALID_DEST \ + || __err == MIG_SERVER_DIED); \ __err; \ }) diff --git a/hurd/hurd/sigpreempt.h b/hurd/hurd/sigpreempt.h index a1df82e2c6..f318ecbd18 100644 --- a/hurd/hurd/sigpreempt.h +++ b/hurd/hurd/sigpreempt.h @@ -1,5 +1,5 @@ /* Preemption of Hurd signals before POSIX.1 semantics take over. - Copyright (C) 1996-2018 Free Software Foundation, Inc. + Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_SIGPREEMPT_H @@ -51,8 +51,8 @@ struct hurd_signal_preemptor }; #define HURD_PREEMPT_SIGNAL_P(preemptor, signo, sigcode) \ - (((preemptor)->signals & sigmask (signo)) && \ - (sigcode) >= (preemptor)->first && (sigcode) <= (preemptor)->last) + (((preemptor)->signals & sigmask (signo)) \ + && (sigcode) >= (preemptor)->first && (sigcode) <= (preemptor)->last) /* Signal preemptors applying to all threads; locked by _hurd_siglock. */ diff --git a/hurd/hurd/threadvar.h b/hurd/hurd/threadvar.h index 414e452db5..e3bb8db0c1 100644 --- a/hurd/hurd/threadvar.h +++ b/hurd/hurd/threadvar.h @@ -1,5 +1,5 @@ /* Internal per-thread variables for the Hurd. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_THREADVAR_H #define _HURD_THREADVAR_H diff --git a/hurd/hurd/userlink.h b/hurd/hurd/userlink.h index f9362557cb..f466c7149b 100644 --- a/hurd/hurd/userlink.h +++ b/hurd/hurd/userlink.h @@ -1,5 +1,5 @@ /* Support for chains recording users of a resource; `struct hurd_userlink'. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_USERLINK_H @@ -142,6 +142,30 @@ _hurd_userlink_unlink (struct hurd_userlink *link) # endif #endif +/* Relocate LINK to NEW_LINK. + To be used when e.g. reallocating a link array. */ + +extern void _hurd_userlink_move (struct hurd_userlink *new_link, + struct hurd_userlink *link); + +#if defined __USE_EXTERN_INLINES && defined _LIBC +# if IS_IN (libc) +_HURD_USERLINK_H_EXTERN_INLINE void +_hurd_userlink_move (struct hurd_userlink *new_link, + struct hurd_userlink *link) +{ + *new_link = *link; + + if (new_link->resource.next != NULL) + new_link->resource.next->resource.prevp = &new_link->resource.next; + *new_link->resource.prevp = new_link; + + if (new_link->thread.next != NULL) + new_link->thread.next->thread.prevp = &new_link->thread.next; + *new_link->thread.prevp = new_link; +} +# endif +#endif /* Clear all users from *CHAINP. Call this when the resource *CHAINP protects is changing. If the return value is nonzero, no users are on diff --git a/hurd/hurd/xattr.h b/hurd/hurd/xattr.h index e9690831bb..18bc5d65bb 100644 --- a/hurd/hurd/xattr.h +++ b/hurd/hurd/xattr.h @@ -1,5 +1,5 @@ /* Access to extended attributes on files for GNU/Hurd. - Copyright (C) 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_XATTR_H #define _HURD_XATTR_H 1 diff --git a/hurd/hurdauth.c b/hurd/hurdauth.c index 1a7e67ea0e..6c9324a5c9 100644 --- a/hurd/hurdauth.c +++ b/hurd/hurdauth.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/msg_server.h> diff --git a/hurd/hurdchdir.c b/hurd/hurdchdir.c index 1adc9895e3..b35214c4ea 100644 --- a/hurd/hurdchdir.c +++ b/hurd/hurdchdir.c @@ -1,5 +1,5 @@ /* Change a port cell to a directory by looking up a name. - Copyright (C) 1999-2018 Free Software Foundation, Inc. + Copyright (C) 1999-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <errno.h> #include <unistd.h> diff --git a/hurd/hurdexec.c b/hurd/hurdexec.c index 732c9ec34b..4e36d92f2e 100644 --- a/hurd/hurdexec.c +++ b/hurd/hurdexec.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <errno.h> #include <unistd.h> diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c index 39a4522811..e9956a8d21 100644 --- a/hurd/hurdfault.c +++ b/hurd/hurdfault.c @@ -1,5 +1,5 @@ /* Handle faults in the signal thread. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/signal.h> @@ -52,8 +52,8 @@ _hurdsig_fault_catch_exception_raise (mach_port_t port, int signo; struct hurd_signal_detail d; - if (port != forward_sigexc || - thread != _hurd_msgport_thread || task != __mach_task_self ()) + if (port != forward_sigexc + || thread != _hurd_msgport_thread || task != __mach_task_self ()) return EPERM; /* Strange bogosity. */ d.exc = exception; diff --git a/hurd/hurdfault.h b/hurd/hurdfault.h index 04ae3903c3..b684243658 100644 --- a/hurd/hurdfault.h +++ b/hurd/hurdfault.h @@ -1,5 +1,5 @@ /* Declarations for handling faults in the signal thread. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_FAULT_H #define _HURD_FAULT_H diff --git a/hurd/hurdfchdir.c b/hurd/hurdfchdir.c index cde753cc68..35f155a6b0 100644 --- a/hurd/hurdfchdir.c +++ b/hurd/hurdfchdir.c @@ -1,5 +1,5 @@ /* Change a port cell to a directory in an open file descriptor. - Copyright (C) 1999-2018 Free Software Foundation, Inc. + Copyright (C) 1999-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <errno.h> #include <unistd.h> diff --git a/hurd/hurdhost.h b/hurd/hurdhost.h index f2b3e68331..1f576a3ef4 100644 --- a/hurd/hurdhost.h +++ b/hurd/hurdhost.h @@ -1,5 +1,5 @@ /* Host configuration items kept as the whole contents of a file. - Copyright (C) 1996-2018 Free Software Foundation, Inc. + Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ /* Fetch and atomically store the contents of the file ITEM. Returns the size read or written, or -1 for errors. diff --git a/hurd/hurdid.c b/hurd/hurdid.c index 71b50df1eb..6eba34c960 100644 --- a/hurd/hurdid.c +++ b/hurd/hurdid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2018 Free Software Foundation, Inc. +/* Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/id.h> diff --git a/hurd/hurdinit.c b/hurd/hurdinit.c index 6af1ddf610..93251197c7 100644 --- a/hurd/hurdinit.c +++ b/hurd/hurdinit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2018 Free Software Foundation, Inc. +/* Copyright (C) 1992-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <sys/stat.h> #include <stdlib.h> @@ -100,10 +100,12 @@ _hurd_init (int flags, char **argv, portarraysize * sizeof (mach_port_t)); if (flags & EXEC_SECURE) - /* XXX if secure exec, elide environment variables - which the library uses and could be security holes. - CORESERVER, COREFILE - */ ; + { + /* XXX if secure exec, elide environment variables + which the library uses and could be security holes. + CORESERVER, COREFILE + */ + } /* Call other things which want to do some initialization. These are not on the __libc_subinit hook because things there like to be able to @@ -198,10 +200,10 @@ _hurd_setproc (process_t procserver) /* Tell the proc server where our args and environment are. */ if (err = __proc_set_arg_locations (procserver, - _hide_arguments ? 0 : - (vm_address_t) __libc_argv, - _hide_environment ? 0 : - (vm_address_t) __environ)) + _hide_arguments ? 0 + : (vm_address_t) __libc_argv, + _hide_environment ? 0 + : (vm_address_t) __environ)) return err; /* Those calls worked, so the port looks good. */ diff --git a/hurd/hurdioctl.c b/hurd/hurdioctl.c index 5b05b3bfff..d706e49c27 100644 --- a/hurd/hurdioctl.c +++ b/hurd/hurdioctl.c @@ -1,5 +1,5 @@ /* ioctl commands which must be done in the C library. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/fd.h> @@ -78,16 +78,16 @@ fioctl (int fd, break; case FIONBIO: - err = HURD_DPORT_USE (fd, (*arg ? - __io_set_some_openmodes : - __io_clear_some_openmodes) + err = HURD_DPORT_USE (fd, (*arg + ? __io_set_some_openmodes + : __io_clear_some_openmodes) (port, O_NONBLOCK)); break; case FIOASYNC: - err = HURD_DPORT_USE (fd, (*arg ? - __io_set_some_openmodes : - __io_clear_some_openmodes) + err = HURD_DPORT_USE (fd, (*arg + ? __io_set_some_openmodes + : __io_clear_some_openmodes) (port, O_ASYNC)); break; diff --git a/hurd/hurdkill.c b/hurd/hurdkill.c index d1e28df5aa..157da3f6a9 100644 --- a/hurd/hurdkill.c +++ b/hurd/hurdkill.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <errno.h> #include <sys/types.h> @@ -40,8 +40,8 @@ _hurd_sig_post (pid_t pid, int sig, mach_port_t arg_refport) err = HURD_MSGPORT_RPC (__proc_getmsgport (proc, pid, &msgport), (refport = arg_refport, 0), 0, /* If no message port we cannot send signals. */ - msgport == MACH_PORT_NULL ? EPERM : - __msg_sig_post (msgport, sig, 0, refport)); + msgport == MACH_PORT_NULL ? EPERM + : __msg_sig_post (msgport, sig, 0, refport)); if (! err) delivered = 1; } diff --git a/hurd/hurdlock.c b/hurd/hurdlock.c index 382e9f2aa9..f8aa293e61 100644 --- a/hurd/hurdlock.c +++ b/hurd/hurdlock.c @@ -1,5 +1,5 @@ /* Hurd helpers for lowlevellocks. - Copyright (C) 1999-2018 Free Software Foundation, Inc. + Copyright (C) 1999-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include "hurdlock.h" #include <hurd.h> @@ -71,7 +71,7 @@ __lll_abstimed_lock (void *ptr, { if (atomic_exchange_acq ((int *)ptr, 2) == 0) return 0; - else if (tsp->tv_nsec < 0 || tsp->tv_nsec >= 1000000000) + else if (! valid_nanoseconds (tsp->tv_nsec)) return EINVAL; int mlsec = compute_reltime (tsp, clk); diff --git a/hurd/hurdlock.h b/hurd/hurdlock.h index 4a8f416a1a..0de76ea97b 100644 --- a/hurd/hurdlock.h +++ b/hurd/hurdlock.h @@ -1,5 +1,5 @@ /* Low-level lock implementation. High-level Hurd helpers. - Copyright (C) 1999-2018 Free Software Foundation, Inc. + Copyright (C) 1999-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_LOCK_H #define _HURD_LOCK_H 1 diff --git a/hurd/hurdlookup.c b/hurd/hurdlookup.c index a642c49002..0007aaad7b 100644 --- a/hurd/hurdlookup.c +++ b/hurd/hurdlookup.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2018 Free Software Foundation, Inc. +/* Copyright (C) 1992-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/lookup.h> @@ -268,8 +268,8 @@ __file_name_lookup_under (file_t startdir, error_t use_init_port (int which, error_t (*operate) (mach_port_t)) { - return (which == INIT_PORT_CWDIR ? (*operate) (startdir) : - _hurd_ports_use (which, operate)); + return (which == INIT_PORT_CWDIR ? (*operate) (startdir) + : _hurd_ports_use (which, operate)); } err = __hurd_file_name_lookup (&use_init_port, &__getdport, 0, diff --git a/hurd/hurdmsg.c b/hurd/hurdmsg.c index 63e5e81b87..02b04f28ab 100644 --- a/hurd/hurdmsg.c +++ b/hurd/hurdmsg.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2018 Free Software Foundation, Inc. +/* Copyright (C) 1992-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/msg_server.h> diff --git a/hurd/hurdpid.c b/hurd/hurdpid.c index 33659cc1ba..b8cc0b3c67 100644 --- a/hurd/hurdpid.c +++ b/hurd/hurdpid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <lowlevellock.h> diff --git a/hurd/hurdports.c b/hurd/hurdports.c index 410beab292..a7152a208c 100644 --- a/hurd/hurdports.c +++ b/hurd/hurdports.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/port.h> diff --git a/hurd/hurdprio.c b/hurd/hurdprio.c index 3783fe9397..67af350e92 100644 --- a/hurd/hurdprio.c +++ b/hurd/hurdprio.c @@ -1,5 +1,5 @@ /* Support code for dealing with priorities in the Hurd. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/resource.h> diff --git a/hurd/hurdrlimit.c b/hurd/hurdrlimit.c index 231a9a4f51..abfa4ed356 100644 --- a/hurd/hurdrlimit.c +++ b/hurd/hurdrlimit.c @@ -1,5 +1,5 @@ /* Resource limits. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <cthreads.h> diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c index 74f176d79d..6a174bc88a 100644 --- a/hurd/hurdselect.c +++ b/hurd/hurdselect.c @@ -1,5 +1,5 @@ /* Guts of both `select' and `poll' for Hurd. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,16 +14,20 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ +#include <sys/time.h> #include <sys/types.h> #include <sys/poll.h> #include <hurd.h> #include <hurd/fd.h> +#include <hurd/io_request.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <stdint.h> +#include <limits.h> +#include <time.h> /* All user select types. */ #define SELECT_ALL (SELECT_READ | SELECT_WRITE | SELECT_URG) @@ -31,6 +35,7 @@ /* Used to record that a particular select rpc returned. Must be distinct from SELECT_ALL (which better not have the high bit set). */ #define SELECT_RETURNED ((SELECT_ALL << 1) & ~SELECT_ALL) +#define SELECT_ERROR (SELECT_RETURNED << 1) /* Check the first NFDS descriptors either in POLLFDS (if nonnnull) or in each of READFDS, WRITEFDS, EXCEPTFDS that is nonnull. If TIMEOUT is not @@ -44,11 +49,13 @@ _hurd_select (int nfds, { int i; mach_port_t portset; - int got; + int got, ready; error_t err; fd_set rfds, wfds, xfds; int firstfd, lastfd; - mach_msg_timeout_t to = 0; + mach_msg_id_t reply_msgid; + mach_msg_timeout_t to; + struct timespec ts; struct { struct hurd_userlink ulink; @@ -56,6 +63,7 @@ _hurd_select (int nfds, mach_port_t io_port; int type; mach_port_t reply_port; + int error; } d[nfds]; sigset_t oset; @@ -73,16 +81,38 @@ _hurd_select (int nfds, return -1; } - if (timeout != NULL) +#define IO_SELECT_REPLY_MSGID (21012 + 100) /* XXX */ +#define IO_SELECT_TIMEOUT_REPLY_MSGID (21031 + 100) /* XXX */ + + if (timeout == NULL) + reply_msgid = IO_SELECT_REPLY_MSGID; + else { - if (timeout->tv_sec < 0 || timeout->tv_nsec < 0) + struct timespec now; + + if (timeout->tv_sec < 0 || ! valid_nanoseconds (timeout->tv_nsec)) { errno = EINVAL; return -1; } - to = (timeout->tv_sec * 1000 + - (timeout->tv_nsec + 999999) / 1000000); + err = __clock_gettime (CLOCK_REALTIME, &now); + if (err) + return -1; + + ts.tv_sec = now.tv_sec + timeout->tv_sec; + ts.tv_nsec = now.tv_nsec + timeout->tv_nsec; + + if (ts.tv_nsec >= 1000000000) + { + ts.tv_sec++; + ts.tv_nsec -= 1000000000; + } + + if (ts.tv_sec < 0) + ts.tv_sec = LONG_MAX; /* XXX */ + + reply_msgid = IO_SELECT_TIMEOUT_REPLY_MSGID; } if (sigmask && __sigprocmask (SIG_SETMASK, sigmask, &oset)) @@ -90,6 +120,7 @@ _hurd_select (int nfds, if (pollfds) { + int error = 0; /* Collect interesting descriptors from the user's `pollfd' array. We do a first pass that reads the user's array before taking any locks. The second pass then only touches our own stack, @@ -123,28 +154,44 @@ _hurd_select (int nfds, if (fd < _hurd_dtablesize) { d[i].cell = _hurd_dtable[fd]; - d[i].io_port = _hurd_port_get (&d[i].cell->port, &d[i].ulink); - if (d[i].io_port != MACH_PORT_NULL) - continue; + if (d[i].cell != NULL) + { + d[i].io_port = _hurd_port_get (&d[i].cell->port, + &d[i].ulink); + if (d[i].io_port != MACH_PORT_NULL) + continue; + } } - /* If one descriptor is bogus, we fail completely. */ - while (i-- > 0) - if (d[i].type != 0) - _hurd_port_free (&d[i].cell->port, - &d[i].ulink, d[i].io_port); - break; + /* Bogus descriptor, make it EBADF already. */ + d[i].error = EBADF; + d[i].type = SELECT_ERROR; + error = 1; } __mutex_unlock (&_hurd_dtable_lock); HURD_CRITICAL_END; - if (i < nfds) + if (error) { - if (sigmask) - __sigprocmask (SIG_SETMASK, &oset, NULL); - errno = EBADF; - return -1; + /* Set timeout to 0. */ + err = __clock_gettime (CLOCK_REALTIME, &ts); + if (err) + { + /* Really bad luck. */ + err = errno; + HURD_CRITICAL_BEGIN; + __mutex_lock (&_hurd_dtable_lock); + while (i-- > 0) + if (d[i].type & ~SELECT_ERROR != 0) + _hurd_port_free (&d[i].cell->port, &d[i].ulink, + d[i].io_port); + __mutex_unlock (&_hurd_dtable_lock); + HURD_CRITICAL_END; + errno = err; + return -1; + } + reply_msgid = IO_SELECT_TIMEOUT_REPLY_MSGID; } lastfd = i - 1; @@ -171,9 +218,6 @@ _hurd_select (int nfds, HURD_CRITICAL_BEGIN; __mutex_lock (&_hurd_dtable_lock); - if (nfds > _hurd_dtablesize) - nfds = _hurd_dtablesize; - /* Collect the ports for interesting FDs. */ firstfd = lastfd = -1; for (i = 0; i < nfds; ++i) @@ -188,9 +232,15 @@ _hurd_select (int nfds, d[i].type = type; if (type) { - d[i].cell = _hurd_dtable[i]; - d[i].io_port = _hurd_port_get (&d[i].cell->port, &d[i].ulink); - if (d[i].io_port == MACH_PORT_NULL) + if (i < _hurd_dtablesize) + { + d[i].cell = _hurd_dtable[i]; + if (d[i].cell != NULL) + d[i].io_port = _hurd_port_get (&d[i].cell->port, + &d[i].ulink); + } + if (i >= _hurd_dtablesize || d[i].cell == NULL || + d[i].io_port == MACH_PORT_NULL) { /* If one descriptor is bogus, we fail completely. */ while (i-- > 0) @@ -215,6 +265,9 @@ _hurd_select (int nfds, errno = EBADF; return -1; } + + if (nfds > _hurd_dtablesize) + nfds = _hurd_dtablesize; } @@ -232,19 +285,19 @@ _hurd_select (int nfds, portset = MACH_PORT_NULL; for (i = firstfd; i <= lastfd; ++i) - if (d[i].type) + if (!(d[i].type & ~SELECT_ERROR)) + d[i].reply_port = MACH_PORT_NULL; + else { int type = d[i].type; d[i].reply_port = __mach_reply_port (); - err = __io_select (d[i].io_port, d[i].reply_port, - /* Poll only if there's a single descriptor. */ - (firstfd == lastfd) ? to : 0, - &type); - switch (err) + if (timeout == NULL) + err = __io_select_request (d[i].io_port, d[i].reply_port, type); + else + err = __io_select_timeout_request (d[i].io_port, d[i].reply_port, + ts, type); + if (!err) { - case MACH_RCV_TIMED_OUT: - /* No immediate response. This is normal. */ - err = 0; if (firstfd == lastfd) /* When there's a single descriptor, we don't need a portset, so just pretend we have one, but really @@ -265,32 +318,23 @@ _hurd_select (int nfds, __mach_port_move_member (__mach_task_self (), d[i].reply_port, portset); } - break; - - default: - /* No other error should happen. Callers of select - don't expect to see errors, so we simulate - readiness of the erring object and the next call - hopefully will get the error again. */ - type = SELECT_ALL; - /* FALLTHROUGH */ - - case 0: - /* We got an answer. */ - if ((type & SELECT_ALL) == 0) - /* Bogus answer; treat like an error, as a fake positive. */ - type = SELECT_ALL; - - /* This port is already ready already. */ - d[i].type &= type; - d[i].type |= SELECT_RETURNED; + } + else + { + /* No error should happen, but record it for later + processing. */ + d[i].error = err; + d[i].type |= SELECT_ERROR; ++got; - break; } _hurd_port_free (&d[i].cell->port, &d[i].ulink, d[i].io_port); } } + /* GOT is the number of replies (or errors), while READY is the number of + replies with at least one type bit set. */ + ready = 0; + /* Now wait for reply messages. */ if (!err && got == 0) { @@ -332,49 +376,64 @@ _hurd_select (int nfds, } success; #endif } msg; - mach_msg_option_t options = (timeout == NULL ? 0 : MACH_RCV_TIMEOUT); + mach_msg_option_t options; error_t msgerr; + + /* We rely on servers to implement the timeout, but when there are none, + do it on the client side. */ + if (timeout != NULL && firstfd == -1) + { + options = MACH_RCV_TIMEOUT; + to = timeout->tv_sec * 1000 + (timeout->tv_nsec + 999999) / 1000000; + } + else + { + options = 0; + to = MACH_MSG_TIMEOUT_NONE; + } + while ((msgerr = __mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_INTERRUPT | options, 0, sizeof msg, portset, to, MACH_PORT_NULL)) == MACH_MSG_SUCCESS) { /* We got a message. Decode it. */ -#define IO_SELECT_REPLY_MSGID (21012 + 100) /* XXX */ #ifdef MACH_MSG_TYPE_BIT const union typeword inttype = { type: { MACH_MSG_TYPE_INTEGER_T, sizeof (integer_t) * 8, 1, 1, 0, 0 } }; #endif - if (msg.head.msgh_id == IO_SELECT_REPLY_MSGID && - msg.head.msgh_size >= sizeof msg.error && - !(msg.head.msgh_bits & MACH_MSGH_BITS_COMPLEX) && + if (msg.head.msgh_id == reply_msgid + && msg.head.msgh_size >= sizeof msg.error + && !(msg.head.msgh_bits & MACH_MSGH_BITS_COMPLEX) #ifdef MACH_MSG_TYPE_BIT - msg.error.err_type.word == inttype.word + && msg.error.err_type.word == inttype.word #endif ) { /* This is a properly formatted message so far. See if it is a success or a failure. */ - if (msg.error.err == EINTR && - msg.head.msgh_size == sizeof msg.error) + if (msg.error.err == EINTR + && msg.head.msgh_size == sizeof msg.error) { /* EINTR response; poll for further responses and then return quickly. */ err = EINTR; goto poll; } - if (msg.error.err || - msg.head.msgh_size != sizeof msg.success || + /* Keep in mind msg.success.result can be 0 if a timeout + occurred. */ + if (msg.error.err #ifdef MACH_MSG_TYPE_BIT - msg.success.result_type.word != inttype.word || + || msg.success.result_type.word != inttype.word #endif - (msg.success.result & SELECT_ALL) == 0) + || msg.head.msgh_size != sizeof msg.success) { - /* Error or bogus reply. Simulate readiness. */ + /* Error or bogus reply. */ + if (!msg.error.err) + msg.error.err = EIO; __mach_msg_destroy (&msg.head); - msg.success.result = SELECT_ALL; } /* Look up the respondent's reply port and record its @@ -386,7 +445,19 @@ _hurd_select (int nfds, if (d[i].type && d[i].reply_port == msg.head.msgh_local_port) { - d[i].type &= msg.success.result; + if (msg.error.err) + { + d[i].error = msg.error.err; + d[i].type = SELECT_ERROR; + ++ready; + } + else + { + d[i].type &= msg.success.result; + if (d[i].type) + ++ready; + } + d[i].type |= SELECT_RETURNED; ++got; } @@ -411,7 +482,7 @@ _hurd_select (int nfds, /* Interruption on our side (e.g. signal reception). */ err = EINTR; - if (got) + if (ready) /* At least one descriptor is known to be ready now, so we will return success. */ err = 0; @@ -419,7 +490,7 @@ _hurd_select (int nfds, if (firstfd != -1) for (i = firstfd; i <= lastfd; ++i) - if (d[i].type) + if (d[i].reply_port != MACH_PORT_NULL) __mach_port_destroy (__mach_task_self (), d[i].reply_port); if (firstfd == -1 || (firstfd != lastfd && portset != MACH_PORT_NULL)) /* Destroy PORTSET, but only if it's not actually the reply port for a @@ -441,23 +512,37 @@ _hurd_select (int nfds, int type = d[i].type; int_fast16_t revents = 0; - if (type & SELECT_RETURNED) - { - if (type & SELECT_READ) - revents |= POLLIN; - if (type & SELECT_WRITE) - revents |= POLLOUT; - if (type & SELECT_URG) - revents |= POLLPRI; - } + if (type & SELECT_ERROR) + switch (d[i].error) + { + case EPIPE: + revents = POLLHUP; + break; + case EBADF: + revents = POLLNVAL; + break; + default: + revents = POLLERR; + break; + } + else + if (type & SELECT_RETURNED) + { + if (type & SELECT_READ) + revents |= POLLIN; + if (type & SELECT_WRITE) + revents |= POLLOUT; + if (type & SELECT_URG) + revents |= POLLPRI; + } pollfds[i].revents = revents; } else { - /* Below we recalculate GOT to include an increment for each operation + /* Below we recalculate READY to include an increment for each operation allowed on each fd. */ - got = 0; + ready = 0; /* Set the user bitarrays. We only ever have to clear bits, as all desired ones are initially set. */ @@ -469,16 +554,30 @@ _hurd_select (int nfds, if ((type & SELECT_RETURNED) == 0) type = 0; + /* Callers of select don't expect to see errors, so we simulate + readiness of the erring object and the next call hopefully + will get the error again. */ + if (type & SELECT_ERROR) + { + type = 0; + if (readfds != NULL && FD_ISSET (i, readfds)) + type |= SELECT_READ; + if (writefds != NULL && FD_ISSET (i, writefds)) + type |= SELECT_WRITE; + if (exceptfds != NULL && FD_ISSET (i, exceptfds)) + type |= SELECT_URG; + } + if (type & SELECT_READ) - got++; + ready++; else if (readfds) FD_CLR (i, readfds); if (type & SELECT_WRITE) - got++; + ready++; else if (writefds) FD_CLR (i, writefds); if (type & SELECT_URG) - got++; + ready++; else if (exceptfds) FD_CLR (i, exceptfds); } @@ -487,5 +586,5 @@ _hurd_select (int nfds, if (sigmask && __sigprocmask (SIG_SETMASK, &oset, NULL)) return -1; - return got; + return ready; } diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index aa82f63413..ebe0308c74 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> @@ -57,7 +57,7 @@ unsigned long int __hurd_sigthread_stack_end; struct hurd_sigstate *_hurd_sigstates; /* Timeout for RPC's after interrupt_operation. */ -mach_msg_timeout_t _hurd_interrupted_rpc_timeout = 3000; +mach_msg_timeout_t _hurd_interrupted_rpc_timeout = 60000; static void default_sigaction (struct sigaction actions[NSIG]) @@ -92,6 +92,7 @@ _hurd_thread_sigstate (thread_t thread) __sigemptyset (&ss->blocked); __sigemptyset (&ss->pending); memset (&ss->sigaltstack, 0, sizeof (ss->sigaltstack)); + ss->sigaltstack.ss_flags |= SS_DISABLE; ss->preemptors = NULL; ss->suspended = MACH_PORT_NULL; ss->intr_port = MACH_PORT_NULL; @@ -292,6 +293,7 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread, struct machine_thread_all_state *state, int *state_change, void (*reply) (void)) { + extern const void _hurd_intr_rpc_msg_about_to; extern const void _hurd_intr_rpc_msg_in_trap; mach_port_t rcv_port = MACH_PORT_NULL; mach_port_t intr_port; @@ -307,7 +309,8 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread, receive completes immediately or aborts. */ abort_thread (ss, state, reply); - if (state->basic.PC < (natural_t) &_hurd_intr_rpc_msg_in_trap) + if (state->basic.PC >= (natural_t) &_hurd_intr_rpc_msg_about_to + && state->basic.PC < (natural_t) &_hurd_intr_rpc_msg_in_trap) { /* The thread is about to do the RPC, but hasn't yet entered mach_msg. Mutate the thread's state so it knows not to try @@ -318,11 +321,11 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread, state->basic.SYSRETURN = MACH_SEND_INTERRUPTED; *state_change = 1; } - else if (state->basic.PC == (natural_t) &_hurd_intr_rpc_msg_in_trap && + else if (state->basic.PC == (natural_t) &_hurd_intr_rpc_msg_in_trap /* The thread was blocked in the system call. After thread_abort, the return value register indicates what state the RPC was in when interrupted. */ - state->basic.SYSRETURN == MACH_RCV_INTERRUPTED) + && state->basic.SYSRETURN == MACH_RCV_INTERRUPTED) { /* The RPC request message was sent and the thread was waiting for the reply message; now the message receive has been aborted, so @@ -459,8 +462,8 @@ sigset_t _hurdsig_preempted_set; weak_alias (_hurdsig_preemptors, _hurdsig_preempters) /* Mask of stop signals. */ -#define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) | \ - sigmask (SIGSTOP) | sigmask (SIGTSTP)) +#define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) \ + | sigmask (SIGSTOP) | sigmask (SIGTSTP)) /* Deliver a signal. SS is not locked. */ void @@ -535,8 +538,8 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss, assert_perror (err); for (i = 0; i < nthreads; ++i) { - if (threads[i] != _hurd_msgport_thread && - (act != handle || threads[i] != ss->thread)) + if (threads[i] != _hurd_msgport_thread + && (act != handle || threads[i] != ss->thread)) { err = __thread_resume (threads[i]); assert_perror (err); @@ -712,9 +715,9 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss, } } - if (_hurd_orphaned && act == stop && - (__sigmask (signo) & (__sigmask (SIGTTIN) | __sigmask (SIGTTOU) | - __sigmask (SIGTSTP)))) + if (_hurd_orphaned && act == stop + && (__sigmask (signo) & (__sigmask (SIGTTIN) | __sigmask (SIGTTOU) + | __sigmask (SIGTSTP)))) { /* If we would ordinarily stop for a job control signal, but we are orphaned so noone would ever notice and continue us again, we just @@ -725,9 +728,9 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss, } /* Handle receipt of a blocked signal, or any signal while stopped. */ - if (act != ignore && /* Signals ignored now are forgotten now. */ - __sigismember (&ss->blocked, signo) || - (signo != SIGKILL && _hurd_stopped)) + if (act != ignore /* Signals ignored now are forgotten now. */ + && __sigismember (&ss->blocked, signo) + || (signo != SIGKILL && _hurd_stopped)) { mark_pending (); act = ignore; @@ -1365,10 +1368,10 @@ reauth_proc (mach_port_t new) ref = __mach_reply_port (); if (! HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC], __proc_reauthenticate (port, ref, - MACH_MSG_TYPE_MAKE_SEND) || - __auth_user_authenticate (new, ref, - MACH_MSG_TYPE_MAKE_SEND, - &ignore)) + MACH_MSG_TYPE_MAKE_SEND) + || __auth_user_authenticate (new, ref, + MACH_MSG_TYPE_MAKE_SEND, + &ignore)) && ignore != MACH_PORT_NULL) __mach_port_deallocate (__mach_task_self (), ignore); __mach_port_destroy (__mach_task_self (), ref); diff --git a/hurd/hurdsock.c b/hurd/hurdsock.c index bb98a6b745..9efd89316c 100644 --- a/hurd/hurdsock.c +++ b/hurd/hurdsock.c @@ -1,5 +1,5 @@ /* _hurd_socket_server - Find the server for a socket domain. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <sys/socket.h> diff --git a/hurd/hurdsocket.h b/hurd/hurdsocket.h index dab74febce..277f512785 100644 --- a/hurd/hurdsocket.h +++ b/hurd/hurdsocket.h @@ -1,5 +1,5 @@ /* Hurd-specific socket functions - Copyright (C) 2013-2018 Free Software Foundation, Inc. + Copyright (C) 2013-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURD_HURDSOCKET_H #define _HURD_HURDSOCKET_H diff --git a/hurd/hurdstartup.c b/hurd/hurdstartup.c index b148125c96..c0a78b3a82 100644 --- a/hurd/hurdstartup.c +++ b/hurd/hurdstartup.c @@ -1,5 +1,5 @@ /* Initial program startup for running under the GNU Hurd. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <errno.h> #include <stdlib.h> @@ -127,9 +127,9 @@ _hurd_startup (void **argptr, void (*main) (intptr_t *data)) pointers and fill them in. We allocate the space for the environment pointers immediately after the argv pointers because the ELF ABI will expect it. */ - argcptr = __alloca (sizeof (intptr_t) + - (argc + 1 + envc + 1) * sizeof (char *) + - sizeof (struct hurd_startup_data)); + argcptr = __alloca (sizeof (intptr_t) + + (argc + 1 + envc + 1) * sizeof (char *) + + sizeof (struct hurd_startup_data)); *argcptr = argc; argv = (void *) (argcptr + 1); __argz_extract (args, argslen, argv); diff --git a/hurd/hurdstartup.h b/hurd/hurdstartup.h index 64d12e19ba..9001e5660b 100644 --- a/hurd/hurdstartup.h +++ b/hurd/hurdstartup.h @@ -1,5 +1,5 @@ /* Data from initial program startup for running under the GNU Hurd. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _HURDSTARTUP_H #define _HURDSTARTUP_H 1 diff --git a/hurd/intern-fd.c b/hurd/intern-fd.c index 3b00824cc1..48a9821c87 100644 --- a/hurd/intern-fd.c +++ b/hurd/intern-fd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/fd.h> diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c index 2f83ac6ce7..ee53d3a1de 100644 --- a/hurd/intr-msg.c +++ b/hurd/intr-msg.c @@ -1,5 +1,5 @@ /* Replacement for mach_msg used in interruptible Hurd RPCs. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <mach.h> #include <mach/mig_errors.h> @@ -114,23 +114,10 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, message: - /* XXX - At all points here (once SS->intr_port is set), the signal thread - thinks we are "about to enter the syscall", and might mutate our - return-value register. This is bogus. - */ - - if (ss->cancel) - { - /* We have been cancelled. Don't do an RPC at all. */ - ss->intr_port = MACH_PORT_NULL; - ss->cancel = 0; - return EINTR; - } - /* Note that the signal trampoline code might modify our OPTION! */ err = INTR_MSG_TRAP (msg, option, send_size, - rcv_size, rcv_name, timeout, notify); + rcv_size, rcv_name, timeout, notify, + &ss->cancel, &ss->intr_port); switch (err) { @@ -141,7 +128,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, else /* The operation was supposedly interrupted, but still has not returned. Declare it interrupted. */ - goto interrupted; + goto dead; case MACH_SEND_INTERRUPTED: /* RPC didn't get out. */ if (!(option & MACH_SEND_MSG)) @@ -324,17 +311,21 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, timeout = user_timeout; goto message; } - /* FALLTHROUGH */ + err = EINTR; + + /* The EINTR return indicates cancellation, so clear the flag. */ + ss->cancel = 0; + break; case MACH_RCV_PORT_DIED: /* Server didn't respond to interrupt_operation, so the signal thread destroyed the reply port. */ /* FALLTHROUGH */ - interrupted: - err = EINTR; + dead: + err = EIEIO; - /* The EINTR return indicates cancellation, so clear the flag. */ + /* The EIEIO return indicates cancellation, so clear the flag. */ ss->cancel = 0; break; @@ -371,12 +362,12 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, 1, TRUE, FALSE, FALSE, 0 } }; #endif - if (m->reply.RetCode == EINTR && - m->header.msgh_size == sizeof m->reply && + if (m->reply.RetCode == EINTR + && m->header.msgh_size == sizeof m->reply #ifdef MACH_MSG_TYPE_BIT - m->check.type == check.i && + && m->check.type == check.i #endif - !(m->header.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + && !(m->header.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { /* It is indeed EINTR. Is the interrupt for us? */ if (ss->intr_port != MACH_PORT_NULL) diff --git a/hurd/intr-rpc.defs b/hurd/intr-rpc.defs index c48443dd6f..eb3586b7b6 100644 --- a/hurd/intr-rpc.defs +++ b/hurd/intr-rpc.defs @@ -1,5 +1,5 @@ /* Special MiG definitions for interruptible RPC stubs. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ /* Cause user stubs for interruptible RPCs to import a special header to modify their behavior. */ diff --git a/hurd/intr-rpc.h b/hurd/intr-rpc.h index 5e7937b7cb..dfc51af008 100644 --- a/hurd/intr-rpc.h +++ b/hurd/intr-rpc.h @@ -1,5 +1,5 @@ /* Special MiG definitions for interruptible RPC stubs. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ /* This file is imported by the MiG-generated user stubs for interruptible RPCs. We modify them to use our own function in place of mach_msg. */ diff --git a/hurd/longjmp-ts.c b/hurd/longjmp-ts.c index 5a8bf6fe06..a520eab75d 100644 --- a/hurd/longjmp-ts.c +++ b/hurd/longjmp-ts.c @@ -1,5 +1,5 @@ /* Perform a `longjmp' on a Mach thread_state. Stub version. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <setjmp.h> #include <mach/thread_status.h> diff --git a/hurd/lookup-at.c b/hurd/lookup-at.c index deddc2264c..1dd64cc350 100644 --- a/hurd/lookup-at.c +++ b/hurd/lookup-at.c @@ -1,5 +1,5 @@ /* Lookup helper function for Hurd implementation of *at functions. - Copyright (C) 2006-2018 Free Software Foundation, Inc. + Copyright (C) 2006-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/lookup.h> @@ -28,6 +28,9 @@ __file_name_lookup_at (int fd, int at_flags, { error_t err; file_t result; + int empty = at_flags & AT_EMPTY_PATH; + + at_flags &= ~AT_EMPTY_PATH; err = __hurd_at_flags (&at_flags, &flags); if (err) @@ -36,11 +39,28 @@ __file_name_lookup_at (int fd, int at_flags, if (fd == AT_FDCWD || file_name[0] == '/') return __file_name_lookup (file_name, flags, mode); + if (empty != 0 && file_name[0] == '\0') + { + enum retry_type doretry; + char retryname[1024]; /* XXX string_t LOSES! */ + + err = HURD_DPORT_USE (fd, __dir_lookup (port, "", flags, mode, + &doretry, retryname, + &result)); + + if (! err) + err = __hurd_file_name_lookup_retry (&_hurd_ports_use, &__getdport, + NULL, doretry, retryname, + flags, mode, &result); + + return err ? (__hurd_dfail (fd, err), MACH_PORT_NULL) : result; + } + file_t startdir; error_t use_init_port (int which, error_t (*operate) (mach_port_t)) { - return (which == INIT_PORT_CWDIR ? (*operate) (startdir) : - _hurd_ports_use (which, operate)); + return (which == INIT_PORT_CWDIR ? (*operate) (startdir) + : _hurd_ports_use (which, operate)); } err = HURD_DPORT_USE (fd, (startdir = port, @@ -69,8 +89,8 @@ __file_name_split_at (int fd, const char *file_name, char **name) file_t startdir; error_t use_init_port (int which, error_t (*operate) (mach_port_t)) { - return (which == INIT_PORT_CWDIR ? (*operate) (startdir) : - _hurd_ports_use (which, operate)); + return (which == INIT_PORT_CWDIR ? (*operate) (startdir) + : _hurd_ports_use (which, operate)); } err = HURD_DPORT_USE (fd, (startdir = port, @@ -94,8 +114,8 @@ __directory_name_split_at (int fd, const char *directory_name, char **name) file_t startdir; error_t use_init_port (int which, error_t (*operate) (mach_port_t)) { - return (which == INIT_PORT_CWDIR ? (*operate) (startdir) : - _hurd_ports_use (which, operate)); + return (which == INIT_PORT_CWDIR ? (*operate) (startdir) + : _hurd_ports_use (which, operate)); } err = HURD_DPORT_USE (fd, (startdir = port, diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c index b596848624..6a21f2ef12 100644 --- a/hurd/lookup-retry.c +++ b/hurd/lookup-retry.c @@ -1,5 +1,5 @@ /* hairy bits of Hurd file name lookup - Copyright (C) 1992-2018 Free Software Foundation, Inc. + Copyright (C) 1992-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/lookup.h> @@ -25,6 +25,7 @@ #include <string.h> #include <_itoa.h> #include <eloop-threshold.h> +#include <unistd.h> /* Translate the error from dir_lookup into the error the user sees. */ static inline error_t @@ -59,6 +60,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) error_t err; char *file_name; int nloops; + file_t lastdir = MACH_PORT_NULL; error_t lookup_op (file_t startdir) { @@ -107,21 +109,22 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) { case FS_RETRY_REAUTH: if (err = reauthenticate (*result)) - return err; + goto out; /* Fall through. */ case FS_RETRY_NORMAL: if (nloops++ >= __eloop_threshold ()) { __mach_port_deallocate (__mach_task_self (), *result); - return ELOOP; + err = ELOOP; + goto out; } /* An empty RETRYNAME indicates we have the final port. */ - if (retryname[0] == '\0' && + if (retryname[0] == '\0' /* If reauth'd, we must do one more retry on "" to give the new translator a chance to make a new port for us. */ - doretry == FS_RETRY_NORMAL) + && doretry == FS_RETRY_NORMAL) { if (flags & O_NOFOLLOW) { @@ -180,7 +183,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) if (err) __mach_port_deallocate (__mach_task_self (), *result); - return err; + goto out; } startdir = *result; @@ -195,7 +198,10 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) if (*result != MACH_PORT_NULL) __mach_port_deallocate (__mach_task_self (), *result); if (nloops++ >= __eloop_threshold ()) - return ELOOP; + { + err = ELOOP; + goto out; + } file_name = &retryname[1]; break; @@ -207,14 +213,15 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) int save = errno; errno = 0; fd = (int) __strtoul_internal (&retryname[3], &end, 10, 0); - if (end == NULL || errno || /* Malformed number. */ + if (end == NULL || errno /* Malformed number. */ /* Check for excess text after the number. A slash is valid; it ends the component. Anything else does not name a numeric file descriptor. */ - (*end != '/' && *end != '\0')) + || (*end != '/' && *end != '\0')) { errno = save; - return ENOENT; + err = ENOENT; + goto out; } if (! get_dtable_port) err = EGRATUITOUS; @@ -232,9 +239,12 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) } errno = save; if (err) - return err; + goto out; if (*end == '\0') - return 0; + { + err = 0; + goto out; + } else { /* Do a normal retry on the remaining components. */ @@ -248,10 +258,10 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) break; case 'm': - if (retryname[1] == 'a' && retryname[2] == 'c' && - retryname[3] == 'h' && retryname[4] == 't' && - retryname[5] == 'y' && retryname[6] == 'p' && - retryname[7] == 'e') + if (retryname[1] == 'a' && retryname[2] == 'c' + && retryname[3] == 'h' && retryname[4] == 't' + && retryname[5] == 'y' && retryname[6] == 'p' + && retryname[7] == 'e') { error_t err; struct host_basic_info hostinfo; @@ -261,9 +271,12 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) if (err = __host_info (__mach_host_self (), HOST_BASIC_INFO, (integer_t *) &hostinfo, &hostinfocnt)) - return err; + goto out; if (hostinfocnt != HOST_BASIC_INFO_COUNT) - return EGRATUITOUS; + { + err = EGRATUITOUS; + goto out; + } p = _itoa (hostinfo.cpu_subtype, &retryname[8], 10, 0); *--p = '/'; p = _itoa (hostinfo.cpu_type, &retryname[8], 10, 0); @@ -299,10 +312,11 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) } case '\0': - return opentty (result); + err = opentty (result); + goto out; case '/': if (err = opentty (&startdir)) - return err; + goto out; strcpy (retryname, &retryname[4]); break; default: @@ -312,14 +326,48 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) goto bad_magic; break; + case 'p': + if (retryname[1] == 'i' && retryname[2] == 'd' + && (retryname[3] == '/' || retryname[3] == 0)) + { + char *p, buf[1024]; /* XXX */ + size_t len; + p = _itoa (__getpid (), &buf[sizeof buf], 10, 0); + len = &buf[sizeof buf] - p; + memcpy (buf, p, len); + strcpy (buf + len, &retryname[3]); + strcpy (retryname, buf); + + /* Do a normal retry on the remaining components. */ + __mach_port_mod_refs (__mach_task_self (), lastdir, + MACH_PORT_RIGHT_SEND, 1); + startdir = lastdir; + file_name = retryname; + } + else + goto bad_magic; + break; + default: bad_magic: - return EGRATUITOUS; + err = EGRATUITOUS; + goto out; } break; default: - return EGRATUITOUS; + err = EGRATUITOUS; + goto out; + } + + if (MACH_PORT_VALID (*result) && *result != lastdir) + { + if (MACH_PORT_VALID (lastdir)) + __mach_port_deallocate (__mach_task_self (), lastdir); + + lastdir = *result; + __mach_port_mod_refs (__mach_task_self (), lastdir, + MACH_PORT_RIGHT_SEND, 1); } if (startdir != MACH_PORT_NULL) @@ -332,6 +380,10 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) err = (*use_init_port) (dirport, &lookup_op); } while (! err); +out: + if (MACH_PORT_VALID (lastdir)) + __mach_port_deallocate (__mach_task_self (), lastdir); + return err; } weak_alias (__hurd_file_name_lookup_retry, hurd_file_name_lookup_retry) diff --git a/hurd/msgportdemux.c b/hurd/msgportdemux.c index 370cf4fb81..b57a97c36a 100644 --- a/hurd/msgportdemux.c +++ b/hurd/msgportdemux.c @@ -1,5 +1,5 @@ /* Demux messages sent on the signal port. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/signal.h> @@ -46,8 +46,8 @@ msgport_server (mach_msg_header_t *inp, if ((*d->demux) (inp, outp)) return 1; - return (_S_exc_server (inp, outp) || - _S_msg_server (inp, outp)); + return (_S_exc_server (inp, outp) + || _S_msg_server (inp, outp)); } /* This is the code that the signal thread runs. */ diff --git a/hurd/new-fd.c b/hurd/new-fd.c index eab03471bf..868fb291a9 100644 --- a/hurd/new-fd.c +++ b/hurd/new-fd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd/fd.h> #include <stdlib.h> diff --git a/hurd/openport.c b/hurd/openport.c index 308e19a4ad..344f361430 100644 --- a/hurd/openport.c +++ b/hurd/openport.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2018 Free Software Foundation, Inc. +/* Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/fd.h> diff --git a/hurd/path-lookup.c b/hurd/path-lookup.c index 5607d5809c..0a44ec4f24 100644 --- a/hurd/path-lookup.c +++ b/hurd/path-lookup.c @@ -1,5 +1,5 @@ /* Filename lookup using a search path - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <string.h> #include <hurd.h> diff --git a/hurd/pid2task.c b/hurd/pid2task.c index fd3ca02f3f..4e72fbc86f 100644 --- a/hurd/pid2task.c +++ b/hurd/pid2task.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> diff --git a/hurd/port-cleanup.c b/hurd/port-cleanup.c index fe22b458cc..b43b79383d 100644 --- a/hurd/port-cleanup.c +++ b/hurd/port-cleanup.c @@ -1,5 +1,5 @@ /* Cleanup function for `struct hurd_port' users who longjmp. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <mach.h> #include <hurd/port.h> diff --git a/hurd/port2fd.c b/hurd/port2fd.c index 858a409f4a..ab825bebd3 100644 --- a/hurd/port2fd.c +++ b/hurd/port2fd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/fd.h> @@ -34,8 +34,9 @@ _hurd_port2fd (struct hurd_fd *d, io_t dport, int flags) if (!(flags & O_IGNORE_CTTY)) __USEPORT (CTTYID, ({ - if (port != MACH_PORT_NULL && /* Do we have a ctty? */ - ! __term_getctty (dport, &cttyid)) /* Could this be it? */ + if (port != MACH_PORT_NULL /* Do we have a ctty? */ + && ! __term_getctty (dport, &cttyid)) + /* Could this be it? */ { __mach_port_deallocate (__mach_task_self (), cttyid); /* This port is capable of being a controlling tty. diff --git a/hurd/ports-get.c b/hurd/ports-get.c index 648f029ed8..25ce29bfc8 100644 --- a/hurd/ports-get.c +++ b/hurd/ports-get.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> diff --git a/hurd/ports-set.c b/hurd/ports-set.c index 9ecd69cc39..f05bcd4cba 100644 --- a/hurd/ports-set.c +++ b/hurd/ports-set.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> diff --git a/hurd/preempt-sig.c b/hurd/preempt-sig.c index c31e85e53d..84a2870f46 100644 --- a/hurd/preempt-sig.c +++ b/hurd/preempt-sig.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd/sigpreempt.h> #include <hurd/signal.h> diff --git a/hurd/privports.c b/hurd/privports.c index 68121e77f0..4bebb4e8ee 100644 --- a/hurd/privports.c +++ b/hurd/privports.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2018 Free Software Foundation, Inc. +/* Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> diff --git a/hurd/report-wait.c b/hurd/report-wait.c index db63fbe844..9fe2a29075 100644 --- a/hurd/report-wait.c +++ b/hurd/report-wait.c @@ -1,5 +1,5 @@ /* Report on what a thread in our task is waiting for. - Copyright (C) 1996-2018 Free Software Foundation, Inc. + Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/signal.h> diff --git a/hurd/set-host.c b/hurd/set-host.c index 6e20d15d4b..d3b62c616a 100644 --- a/hurd/set-host.c +++ b/hurd/set-host.c @@ -1,5 +1,5 @@ /* Set a host configuration item kept as the whole contents of a file. - Copyright (C) 1996-2018 Free Software Foundation, Inc. + Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <fcntl.h> #include <hurd.h> diff --git a/hurd/setauth.c b/hurd/setauth.c index 025be580e1..2e78660516 100644 --- a/hurd/setauth.c +++ b/hurd/setauth.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/port.h> @@ -67,12 +67,12 @@ _hurd_setauth (auth_t new) mach_port_t new; ref = __mach_reply_port (); if (! __io_reauthenticate (_hurd_init_dtable[d], - ref, MACH_MSG_TYPE_MAKE_SEND) && - ! HURD_PORT_USE (&_hurd_ports[INIT_PORT_AUTH], - __auth_user_authenticate - (port, - ref, MACH_MSG_TYPE_MAKE_SEND, - &new))) + ref, MACH_MSG_TYPE_MAKE_SEND) + && ! HURD_PORT_USE (&_hurd_ports[INIT_PORT_AUTH], + __auth_user_authenticate + (port, + ref, MACH_MSG_TYPE_MAKE_SEND, + &new))) { __mach_port_deallocate (__mach_task_self (), _hurd_init_dtable[d]); @@ -84,20 +84,20 @@ _hurd_setauth (auth_t new) ref = __mach_reply_port (); if (__USEPORT (CRDIR, ! __io_reauthenticate (port, - ref, MACH_MSG_TYPE_MAKE_SEND) && - ! __auth_user_authenticate (new, - ref, MACH_MSG_TYPE_MAKE_SEND, - &newport))) + ref, MACH_MSG_TYPE_MAKE_SEND) + && ! __auth_user_authenticate (new, + ref, MACH_MSG_TYPE_MAKE_SEND, + &newport))) _hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], newport); __mach_port_destroy (__mach_task_self (), ref); ref = __mach_reply_port (); if (__USEPORT (CWDIR, ! __io_reauthenticate (port, - ref, MACH_MSG_TYPE_MAKE_SEND) && - ! __auth_user_authenticate (new, - ref, MACH_MSG_TYPE_MAKE_SEND, - &newport))) + ref, MACH_MSG_TYPE_MAKE_SEND) + && ! __auth_user_authenticate (new, + ref, MACH_MSG_TYPE_MAKE_SEND, + &newport))) _hurd_port_set (&_hurd_ports[INIT_PORT_CWDIR], newport); __mach_port_destroy (__mach_task_self (), ref); diff --git a/hurd/seteuids.c b/hurd/seteuids.c index edfa4c2195..1afd3a7db7 100644 --- a/hurd/seteuids.c +++ b/hurd/seteuids.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2018 Free Software Foundation, Inc. +/* Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/id.h> diff --git a/hurd/siginfo.c b/hurd/siginfo.c index 75e02d5282..7b080e1449 100644 --- a/hurd/siginfo.c +++ b/hurd/siginfo.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2018 Free Software Foundation, Inc. +/* Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd/signal.h> #include <stdio.h> diff --git a/hurd/sigunwind.c b/hurd/sigunwind.c index 40e0f679f7..80626eeffe 100644 --- a/hurd/sigunwind.c +++ b/hurd/sigunwind.c @@ -1,5 +1,5 @@ /* longjmp cleanup function for unwinding past signal handlers. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <thread_state.h> diff --git a/hurd/task2pid.c b/hurd/task2pid.c index 265cb88326..da9fd6a148 100644 --- a/hurd/task2pid.c +++ b/hurd/task2pid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> diff --git a/hurd/thread-cancel.c b/hurd/thread-cancel.c index c70b814dda..b137f0e4d3 100644 --- a/hurd/thread-cancel.c +++ b/hurd/thread-cancel.c @@ -1,5 +1,5 @@ /* Thread cancellation support. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd/signal.h> #include <hurd/interrupt.h> diff --git a/hurd/thread-self.c b/hurd/thread-self.c index d6d96617f1..39950bc366 100644 --- a/hurd/thread-self.c +++ b/hurd/thread-self.c @@ -1,5 +1,5 @@ /* Cheap function to get current thread from sigstate without a syscall. - Copyright (C) 1995-2018 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd/signal.h> diff --git a/hurd/trampoline.c b/hurd/trampoline.c index 9bc278215a..ee8906bc5b 100644 --- a/hurd/trampoline.c +++ b/hurd/trampoline.c @@ -1,5 +1,5 @@ /* Set thread_state for sighandler, and sigcontext to recover. Stub version. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <mach/thread_status.h> diff --git a/hurd/vpprintf.c b/hurd/vpprintf.c index 76cd31f922..09e4df11a3 100644 --- a/hurd/vpprintf.c +++ b/hurd/vpprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2018 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <stdarg.h> #include <stdio.h> @@ -53,7 +53,7 @@ vpprintf (io_t port, const char *format, va_list arg) _IO_cookie_init (&temp_f.cfile, _IO_NO_READS, (void *) port, (cookie_io_functions_t) { write: do_write }); - done = _IO_vfprintf (&temp_f.cfile.__fp.file, format, arg); + done = __vfprintf_internal (&temp_f.cfile.__fp.file, format, arg, 0); return done; } diff --git a/hurd/xattr.c b/hurd/xattr.c index 23d9fcb691..7f7c6ed6d0 100644 --- a/hurd/xattr.c +++ b/hurd/xattr.c @@ -1,5 +1,5 @@ /* Support for *xattr interfaces on GNU/Hurd. - Copyright (C) 2006-2018 Free Software Foundation, Inc. + Copyright (C) 2006-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <hurd.h> #include <hurd/xattr.h> |