about summary refs log tree commit diff
path: root/hurd
Commit message (Collapse)AuthorAgeFilesLines
* hurd: Fix exec usage of mach_setup_threadSamuel Thibault2018-08-011-0/+2
| | | | | | | | | | | | | | | | Exec needs that mach_setup_thread does *not* set up TLS since it works on another task, so we have to split this into mach_setup_tls. * mach/mach.h (__mach_setup_tls, mach_setup_tls): Add prototypes. * mach/setup-thread.c (__mach_setup_thread): Move TLS setup to... (__mach_setup_tls): ... new function. (mach_setup_tls): New alias. * hurd/hurdsig.c (_hurdsig_init): Call __mach_setup_tls after __mach_setup_thread. * sysdeps/mach/hurd/profil.c (update_waiter): Likewise. * sysdeps/mach/hurd/setitimer.c (setitimer_locked): Likewise. * mach/Versions [libc] (mach_setup_tls): Add symbol. * sysdeps/mach/hurd/i386/libc.abilist (mach_setup_tls): Likewise.
* hurd: Silence warningSamuel Thibault2018-04-041-0/+8
| | | | | * hurd/hurdsig.c (interrupted_reply_port_location): Use DIAG_IGNORE_NEEDS_COMMENT to silence warning with GCC 6 and before.
* Revert parts of "hurd: Avoid more libc.so local PLTs"Samuel Thibault2018-04-032-3/+3
| | | | This reverts parts of commit 82dbf555a4d41690f63b94ccb4db4bf43d873aa0.
* hurd: Avoid more libc.so local PLTsSamuel Thibault2018-04-032-3/+3
| | | | | | | | | | | | | | | * hurd/catch-signal.c (__hurd_catch_signal): Call __libc_siglongjmp instead if siglongjmp. (hurd_safe_memmove): Call __libc_longjmp instead of longjmp. * hurd/hurdfault.c (faulted): Call __libc_longjmp instead of longjmp. * include/setjmp.h (__libc_siglongjmp, __libc_longjmp): New hidden prototypes. * libio/iolibio.h (_IO_puts): New hidden prototype. * libio/ioputs.c (_IO_puts): New hidden def. * setjmp/longjmp.c (__libc_longjmp, __libc_siglongjmp): New hidden defs. * sysdeps/mach/hurd/sigwait.c (__sigwait): Call __libc_longjmp instead of longjmp.
* hurd: Avoid more libc.so PLTsSamuel Thibault2018-04-022-0/+2
| | | | | | | | | | | | * sysdeps/hurd/include/hurd/signal.h (_hurd_raise_signal): Add hidden prototype. * hurd/hurd-raise.c (_hurd_raise_signal): Add hidden def. * hurd/Makefile ($(inlines:%=$(objpfx)%.c): Define _HEADER_H_HIDDEN_DEF macro. * sysdeps/hurd/include/hurd/fd.h (_hurd_fd_error, _hurd_fd_error_signal): Add hidden prototype. [_HURD_FD_H_HIDDEN_DEF] (_hurd_fd_error, _hurd_fd_error_signal): Add hidden def.
* hurd: Avoid some libc.so PLTsSamuel Thibault2018-04-028-27/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * hurd/catch-signal.c (hurd_catch_signal): Rename to __hurd_catch_signal. (hurd_catch_signal): New strong alias. (hurd_safe_memset, hurd_safe_copyout, hurd_safe_copyin): Call __hurd_catch_signal instead of hurd_catch_signal. * hurd/exc2signal.c (_hurd_exception2signal): Add hidden def. * hurd/hurdexec.c (_hurd_init): Add hidden def. * hurd/hurdinit.c (_hurd_init): Add hidden def. * hurd/hurdsig.c: Include <mach/mig_support.h>. (_hurd_thread_sigstate): Add hidden def. (_hurd_internal_post_signal): Use __mutex_unlock instead of mutex_unlock. * hurd/intern-fd.c (_hurd_intern_fd): Add hidden def. * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Add hidden def. * hurd/path-lookup.c (hurd_file_name_path_lookup): Rename to __hurd_file_name_path_lookup. (hurd_file_name_path_lookup): New strong alias. (file_name_path_lookup): Call __hurd_file_name_path_lookup instead of hurd_file_name_path_lookup. * mach/errstring.c (mach_error_type): Add hidden def. * mach/msg-destroy.c (__mach_msg_destroy): Add hidden def. * mach/mutex-init.c (__mutex_init): Add hidden def. * mach/spin-lock.c (__spin_lock_locked, __spin_lock, __spin_unlock, __spin_try_lock, __mutex_lock, __mutex_trylock): Add hidden defs. * mach/spin-solid.c (__spin_lock_solid): Add hidden def. * sysdeps/mach/hurd/getcwd.c (_hurd_canonicalize_directory_name_internal): Rename to __hurd_canonicalize_directory_name_internal. (_hurd_canonicalize_directory_name_internal): New strong alias. (__canonicalize_directory_name_internal, __getcwd): Call __hurd_canonicalize_directory_name_internal instead of _hurd_canonicalize_directory_name_internal. * sysdeps/mach/hurd/mig-reply.c: Include <mach/mig_support.h>. (__mig_get_reply_port, __mig_dealloc_reply_port, __mig_init): Add hidden defs. * sysdeps/hurd/include/hurd.h: New file. * sysdeps/hurd/include/hurd/fd.h: New file. * sysdeps/hurd/include/hurd/signal.h: New file. * sysdeps/mach/include/lock-intern.h: New file. * sysdeps/mach/include/mach.h: New file. * sysdeps/mach/include/mach/mig_support.h: New file. * sysdeps/mach/include/mach_error.h: New file.
* hurd: Avoid some PLTs in libc and librtSamuel Thibault2018-04-026-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * hurd/hurdauth.c (_S_msg_add_auth): Call __vm_allocate and __vm_deallocate instead of vm_allocate and vm_deallocate. * hurd/hurdmsg.c (_S_msg_set_env_variable): Call __setenv instead of setenv. * hurd/hurdprio.c (_hurd_priority_which_map): Call __geteuid instead of geteuid. * hurd/path-lookup.c (file_name_path_scan): Call __strdup instead of strdup. * hurd/siginfo.c: Include <libioP.h>. (_hurd_siginfo_handler): Call _IO_puts instead of puts. * hurd/xattr.c (_hurd_xattr_get, _hurd_xattr_set): Call __munmap instead of munmap. * io/fts.c (fts_build): Call __dirfd instead of dirfd. * mach/devstream.c: Include <libioP.h>. (dealloc_ref): Call __mach_port_deallocate instead of mach_port_deallocate. (mach_open_devstream): Call _IO_fopencookie instead of fopencookie. Call __mach_port_deallocate instead of mach_port_deallocate. * stdlib/canonicalize.c (__realpath): Call __pathconf instead of pathconf. * sysdeps/mach/hurd/ifreq.c (__ifreq): Call __munmap instead of munmap. * sysdeps/mach/hurd/ifreq.h (__if_freereq): Likewise. * sysdeps/mach/hurd/ptrace.c (ptrace): Call __kill instead of kill. * sysdeps/mach/hurd/sendfile64.c (sendfile64): Call __munmap instead of munmap. * sysdeps/mach/hurd/socketpair.c (__socketpair): Call __close instead of close. * sysdeps/posix/clock_getres.c (realtime_getres): Call __sysconf instead of sysconf. * sysdeps/pthread/timer_gettime.c (timer_gettime): Call __clock_gettime instead of clock_gettime. * sysdeps/pthread/timer_routines.c (thread_func): Likewise. * sysdeps/pthread/timer_settime.c (timer_settime): Likewise. * sysdeps/unix/bsd/gtty.c (gtty): Call __ioctl instead of ioctl. * sysdeps/unix/bsd/stty.c (stty): Likewise. * sysdeps/unix/bsd/tcflow.c (tcflow): Call __tcgetattr instead of tcgetattr. * sysdeps/unix/clock_nanosleep.c (__clock_nanosleep): Call __clock_gettime and __nanosleep instead of clock_gettime and nanosleep.
* hurd: Code style fixesSamuel Thibault2018-03-201-37/+42
| | | | No code change.
* hurd: Fix build with latest htlSamuel Thibault2018-03-191-1/+1
| | | | * hurd/hurdsig.c: Include <pthreadP.h> instead of <pthread.h>.
* hurd: Fix O_DIRECTORY | O_NOFOLLOWSamuel Thibault2018-03-182-1/+3
| | | | | | | | | | | | | Appending / to the path to be looked up would make us always follow a final symlink, even with O_NOTRANS (since the final resolution is after the '/'). In the O_DIRECTORY | O_NOFOLLOW case, we thus have to really open the node and stat it, which we already do anyway, and check for directory type. * hurd/hurdlookup.c (__hurd_file_name_lookup): Do not append '/' to path when flags contains O_NOFOLLOW. * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ENOTDIR if flags contains O_DIRECTORY and the result is a directory.
* hurd: Fix O_NOFOLLOWSamuel Thibault2018-03-181-16/+20
| | | | | | | | | | | The error code documented by POSIX for opening a symlink with O_NOFOLLOW is ELOOP. Also, if the translator does not expose symlink as a symlink translator but as a S_IFLNK file, O_NOFOLLOW needs to return ELOOP too. * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ELOOP when opening a symlink with O_NOFOLLOW.
* hurd: Fix copyright yearsSamuel Thibault2018-03-182-2/+2
|
* hurd: Reimplement libc locks using mach's gsyncAgustina Arzille2018-03-187-6/+356
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * hurd/Makefile (routines): Add hurdlock. * hurd/Versions (GLIBC_PRIVATE): Added new entry to export the above interface. (HURD_CTHREADS_0.3): Remove __libc_getspecific. * hurd/hurdpid.c: Include <lowlevellock.h> (_S_msg_proc_newids): Use lll_wait to synchronize. * hurd/hurdsig.c: (reauth_proc): Use __mutex_lock and __mutex_unlock. * hurd/setauth.c: Include <hurdlock.h>, use integer for synchronization. * mach/Makefile (lock-headers): Remove machine-lock.h. * mach/lock-intern.h: Include <lowlevellock.h> instead of <machine-lock.h>. (__spin_lock_t): New type. (__SPIN_LOCK_INITIALIZER): New macro. (__spin_lock, __spin_unlock, __spin_try_lock, __spin_lock_locked, __mutex_init, __mutex_lock_solid, __mutex_unlock_solid, __mutex_lock, __mutex_unlock, __mutex_trylock): Use lll to implement locks. * mach/mutex-init.c: Include <lowlevellock.h> instead of <cthreads.h>. (__mutex_init): Initialize with lll. * manual/errno.texi (EOWNERDEAD, ENOTRECOVERABLE): New errno values. * sysdeps/mach/Makefile: Add libmachuser as dependencies for libs needing lll. * sysdeps/mach/hurd/bits/errno.h: Regenerate. * sysdeps/mach/hurd/cthreads.c (__libc_getspecific): Remove function. * sysdeps/mach/hurd/bits/libc-lock.h: Remove file. * sysdeps/mach/hurd/setpgid.c: Include <lowlevellock.h>. (__setpgid): Use lll for synchronization. * sysdeps/mach/hurd/setsid.c: Likewise with __setsid. * sysdeps/mach/bits/libc-lock.h: Include <tls.h> and <lowlevellock.h> instead of <cthreads.h>. (_IO_lock_inexpensive): New macro (__libc_lock_recursive_t, __rtld_lock_recursive_t): New structures. (__libc_lock_self0): New declaration. (__libc_lock_owner_self): New macro. (__libc_key_t): Remove type. (_LIBC_LOCK_INITIALIZER): New macro. (__libc_lock_define_initialized, __libc_lock_init, __libc_lock_fini, __libc_lock_fini_recursive, __rtld_lock_fini_recursive, __libc_lock_lock, __libc_lock_trylock, __libc_lock_unlock, __libc_lock_define_initialized_recursive, __rtld_lock_define_initialized_recursive, __libc_lock_init_recursive, __libc_lock_trylock_recursive, __libc_lock_lock_recursive, __libc_lock_unlock_recursive, __rtld_lock_initialize, __rtld_lock_trylock_recursive, __rtld_lock_lock_recursive, __rtld_lock_unlock_recursive __libc_once_define, __libc_mutex_unlock): Reimplement with lll. (__libc_lock_define_recursive, __rtld_lock_define_recursive, _LIBC_LOCK_RECURSIVE_INITIALIZER, _RTLD_LOCK_RECURSIVE_INITIALIZER): New macros. Include <libc-lockP.h> to reimplement libc_key* with pthread_key*. * hurd/hurdlock.c: New file. * hurd/hurdlock.h: New file. * mach/lowlevellock.h: New file
* hurd: Fix coding styleSamuel Thibault2018-03-182-2/+2
|
* hurd: Fix link cthread/pthread symbol exposition.Samuel Thibault2018-03-172-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | * hurd/Versions (HURD_CTHREADS_0.3): Rename weak refs cthread_fork, cthread_detach, pthread_getattr_np, pthread_attr_getstack, cthread_keycreate, cthread_getspecific, cthread_setspecific to __cthread_fork, __cthread_detach, __pthread_getattr_np, __pthread_attr_getstack, __cthread_keycreate, __cthread_getspecific, __cthread_setspecific. * hurd/hurdsig.c (_hurdsig_init): Use __cthread_fork, __cthread_detach, __pthread_getattr_np, __pthread_attr_getstack, __cthread_t instead of cthread_fork, cthread_detach, pthread_getattr_np, pthread_attr_getstack. * sysdeps/mach/hurd/cthreads.c (cthread_keycreate): Rename to __cthread_keycreate. (cthread_getspecific): Rename to __cthread_getspecific. (cthread_setspecific): Rename to __cthread_setspecific. (__libc_getspecific): Use __cthread_getspecific instead of cthread_getspecific. * sysdeps/mach/hurd/libc-lock.h (__libc_key_create): Use __cthread_keycreate instead of cthread_keycreate. (__libc_setspecific): Use __cthread_setspecific instead of cthread_setspecific. * sysdeps/mach/libc-lock.h (__libc_key_create, __libc_setspecific): Likewise.
* hurd: Replace threadvars with TLSSamuel Thibault2018-03-177-119/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of a lot of kludge and gets closer to other ports. * hurd/Makefile (headers): Remove threadvar.h. (inline-headers): Remove threadvar.h. * hurd/Versions (GLIBC_2.0: Remove __hurd_sigthread_stack_base, __hurd_sigthread_stack_end, __hurd_sigthread_variables, __hurd_threadvar_max, __hurd_errno_location. (HURD_CTHREADS_0.3): Add pthread_getattr_np, pthread_attr_getstack. * hurd/hurd/signal.h: Do not include <hurd/threadvar.h>. (_hurd_self_sigstate): Use THREAD_SELF to get _hurd_sigstate. (_HURD_SIGNAL_H_EXTERN_INLINE): Use THREAD_SELF to get _hurd_sigstate, unless TLS is not initialized yet, in which case we do not need a critical section yet anyway. * hurd/hurd/threadvar.h: Include <tls.h>, do not include <machine-sp.h>. (__hurd_sigthread_variables, __hurd_threadvar_max): Remove variables declarations. (__hurd_threadvar_index): Remove enum. (_HURD_THREADVAR_H_EXTERN_INLINE): Remove macro. (__hurd_threadvar_location_from_sp,__hurd_threadvar_location): Remove inlines. (__hurd_reply_port0): New variable declaration. (__hurd_local_reply_port): New macro. * hurd/hurdsig.c (__hurd_sigthread_variables): Remove variable. (interrupted_reply_port_location): Add thread_t parameter. Use it with THREAD_TCB to access thread-local variables. (_hurdsig_abort_rpcs): Pass ss->thread to interrupted_reply_port_location. (_hurd_internal_post_signal): Likewise. (_hurdsig_init): Use presence of cthread_fork instead of __hurd_threadvar_stack_mask to start signal thread by hand. Remove signal thread threadvar initialization. * hurd/hurdstartup.c: Do not include <hurd/threadvar.h> * hurd/sigunwind.c: Include <hurd/threadvar.h> (_hurdsig_longjmp_from_handler): Use __hurd_local_reply_port instead of threadvar. * sysdeps/mach/hurd/Versions (libc.GLIBC_PRIVATE): Add __libc_lock_self0. (ld.GLIBC_2.0): Remove __hurd_sigthread_stack_base, __hurd_sigthread_stack_end, __hurd_sigthread_variables. (ld.GLIBC_PRIVATE): Add __libc_lock_self0. * sysdeps/mach/hurd/cthreads.c: Add __libc_lock_self0. * sysdeps/mach/hurd/dl-sysdep.c (errno, __hurd_sigthread_stack_base, __hurd_sigthread_stack_end, __hurd_sigthread_variables, threadvars, __hurd_threadvar_stack_offset, __hurd_threadvar_stack_mask): Do not define variables. * sysdeps/mach/hurd/errno-loc.c: Do not include <errno.h> and <hurd/threadvar.h>. [IS_IN(rtld)] (rtld_errno): New variable. [IS_IN(rtld)] (__errno_location): New weak function. [!IS_IN(rtld)]: Include "../../../csu/errno-loc.c". * sysdeps/mach/hurd/errno.c: Remove file. * sysdeps/mach/hurd/fork.c: Include <hurd/threadvar.h> (__fork): Remove THREADVAR_SPACE macro and its use. * sysdeps/mach/hurd/i386/init-first.c (__hurd_threadvar_max): Remove variable. (init): Do not initialize threadvar. * sysdeps/mach/hurd/i386/libc.abilist (__hurd_threadvar_max): Remove symbol. * sysdeps/mach/hurd/i386/sigreturn.c (__sigreturn): Use __hurd_local_reply_port instead of threadvar. * sysdeps/mach/hurd/i386/tls.h (tcbhead_t): Add reply_port and _hurd_sigstate fields. (HURD_DESC_TLS, __LIBC_NO_TLS, THREAD_TCB): New macro. * sysdeps/mach/hurd/i386/trampoline.c: Remove outdated comment. * sysdeps/mach/hurd/libc-lock.h: Do not include <hurd/threadvar.h>. (__libc_lock_owner_self): Use &__libc_lock_self0 and THREAD_SELF instead of threadvar. * sysdeps/mach/hurd/libc-tsd.h: Remove file. * sysdeps/mach/hurd/mig-reply.c (GETPORT, reply_port): Remove macros. (use_threadvar, global_reply_port): Remove variables. (__hurd_reply_port0): New variable. (__mig_get_reply_port): Use __hurd_local_reply_port and __hurd_reply_port0 instead of threadvar. (__mig_dealloc_reply_port): Likewise. (__mig_init): Do not initialize threadvar. * sysdeps/mach/hurd/profil.c: Fix comment.
* hurd: Fix getting signal thread stack layout for forkSamuel Thibault2018-03-171-1/+19
| | | | | | * hurd/hurdsig.c: Include <pthread.h>. (_hurdsig_init): Call pthread_getattr_np and pthread_attr_getstack to get the signal thread stack layout.
* hurd: add TLS supportSamuel Thibault2018-03-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sysdeps/generic/thread_state.h (MACHINE_NEW_THREAD_STATE_FLAVOR): Define macro. * sysdeps/mach/thread_state.h (MACHINE_THREAD_STATE_FIX_NEW): New macro. * sysdeps/mach/i386/thread_state.h (MACHINE_NEW_THREAD_STATE_FLAVOR): New macro, defined to i386_THREAD_STATE. (MACHINE_THREAD_STATE_FLAVOR): Define to i386_REGS_SEGS_STATE instead of i386_THREAD_STATE. (MACHINE_THREAD_STATE_FIX_NEW): New macro, reads segments. * sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler): Use i386_REGS_SEGS_STATE instead of i386_THREAD_STATE. * sysdeps/mach/hurd/i386/tls.h (TCB_ALIGNMENT, HURD_SEL_LDT): New macros. (_hurd_tls_fork): Add original thread parameter, Duplicate existing LDT descriptor instead of creating a new one. (_hurd_tls_new): New function, creates a new descriptor and updates tcb. * mach/setup-thread.c: Include <ldsodefs.h>. (__mach_setup_thread): Call _dl_allocate_tls, pass MACHINE_NEW_THREAD_STATE_FLAVOR to __thread_set_state instead of MACHINE_THREAD_STATE_FLAVOR, before getting MACHINE_THREAD_STATE_FLAVOR, calling _hurd_tls_new, and setting MACHINE_THREAD_STATE_FLAVOR with the result. * hurd/hurdfault.c (_hurdsig_fault_init): Call MACHINE_THREAD_STATE_FIX_NEW. * sysdeps/mach/hurd/fork.c (__fork): Call _hurd_tls_fork for sigthread too. Add original thread parameter.
* hurd: Fix includability of <hurd/signal.h> in all standardsSamuel Thibault2018-03-051-0/+1
| | | | | | | | | | | | | * bits/sigaction.h: Add include guard. * sysdeps/unix/sysv/linux/alpha/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/s390/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/tile/bits/sigaction.h: Likewise. * hurd/hurd/signal.h: Include <bits/sigaction.h>.
* Separate out error_t definitionSamuel Thibault2018-03-047-0/+9
| | | | | | | | | | | | | | | | | | so interfaces needing it can get it. * stdlib/errno.h (error_t): Move definition to... * bits/types/error_t.h: ... new header. * stdlib/Makefile (headers): Add bits/types/error_t.h. * sysdeps/mach/hurd/bits/errno.h (error_t): Move definition to... * sysdeps/mach/hurd/bits/types/error_t.h: ... new header. * sysdeps/mach/hurd/errnos.awk (error_t): Likewise. * hurd/hurd.h: Include <bits/types/error_t.h> * hurd/hurd/fd.h: Include <bits/types/error_t.h> * hurd/hurd/id.h: Include <errno.h> and <bits/types/error_t.h> * hurd/hurd/lookup.h: Include <errno.h> and <bits/types/error_t.h> * hurd/hurd/resource.h: Include <bits/types/error_t.h> * hurd/hurd/signal.h: Include <bits/types/error_t.h> * hurd/hurd/sigpreempt.h: Include <bits/types/error_t.h>
* hurd: Make almost all hurd headers includable in all standardsSamuel Thibault2018-03-044-14/+18
| | | | | | | | | | | | | | * hurd/hurd.h: Include <bits/types/sigset_t.h> * hurd/hurd/fd.h: Include <sys/select.h> and <bits/types/sigset_t.h> (_hurd_fd_read, _hurd_fd_write): Use __loff_t instead of loff_t. * hurd/hurd/signal.h: Include <bits/types/stack_t.h> and <bits/types/sigset_t.h>. [!defined __USE_GNU]: Do not #error out. (struct hurd_sigstate): Use _NSIG instead of NSIG. * hurd/hurd/sigpreempt.h (__need_size_t): Define. Include <stddef.h> and <bits/types/sigset_t.h> (struct hurd_signal_preemptor, hurd_catch_signal): Use __sighandler_t instead of sighandler_t.
* hurd: Avoid using ino64_t and loff_t in headersSamuel Thibault2018-03-041-0/+2
| | | | | | * mach/Machrules ($(patsubst %,$(objpfx)%.h,$(user-interfaces)): Process mig output through $(migheaderpipe). * hurd/Makefile (migheaderpipe): Define variable.
* hurd: fix header conformitySamuel Thibault2018-03-041-1/+1
| | | | | * hurd/hurd/fd.h (_hurd_fd_error): Fix struct initializer to be trivial, for C++ conformity.
* hurd: avoid including hurd/signal.h when not neededSamuel Thibault2018-03-042-2/+5
| | | | | | | | | thus making <hurd/port.h> and <hurd/userlink.h> includable without _GNU_SOURCE. * hurd/hurd/port.h: Do not include <hurd/signal.h>. * hurd/hurd/userlink.h [!defined __USE_EXTERN_INLINES || !defined _LIBC || !IS_IN (libc)]: Do not include <hurd/signal.h>.
* hurd: Add missing includesSamuel Thibault2018-03-033-0/+4
| | | | | | * hurd/hurd/id.h: Include <hurd/hurd_types.h> * hurd/hurd/ioctl.h: Include <mach/port.h> * hurd/hurd/lookup.h: Include <hurd/hurd_types.h>
* Mechanically remove _IO_ name aliases for types and constants.Zack Weinberg2018-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch mechanically removes all remaining uses, and the definitions, of the following libio name aliases: name replaced with ---- ------------- _IO_FILE FILE _IO_fpos_t __fpos_t _IO_fpos64_t __fpos64_t _IO_size_t size_t _IO_ssize_t ssize_t or __ssize_t _IO_off_t off_t _IO_off64_t off64_t _IO_pid_t pid_t _IO_uid_t uid_t _IO_wint_t wint_t _IO_va_list va_list or __gnuc_va_list _IO_BUFSIZ BUFSIZ _IO_cookie_io_functions_t cookie_io_functions_t __io_read_fn cookie_read_function_t __io_write_fn cookie_write_function_t __io_seek_fn cookie_seek_function_t __io_close_fn cookie_close_function_t I used __fpos_t and __fpos64_t instead of fpos_t and fpos64_t because the definitions of fpos_t and fpos64_t depend on the largefile mode. I used __ssize_t and __gnuc_va_list in a handful of headers where namespace cleanliness might be relevant even though they're internal-use-only. In all other cases, I used the public-namespace name. There are a tiny handful of places where I left a use of 'struct _IO_FILE' alone, because it was being used together with 'struct _IO_FILE_plus' or 'struct _IO_FILE_complete' in the same arithmetic expression. Because this patch was almost entirely done with search and replace, I may have introduced indentation botches. I did proofread the diff, but I may have missed something. The ChangeLog below calls out all of the places where this was not a pure search-and-replace change. Installed stripped libraries and executables are unchanged by this patch, except that some assertions in vfscanf.c change line numbers. * libio/libio.h (_IO_FILE): Delete; all uses changed to FILE. (_IO_fpos_t): Delete; all uses changed to __fpos_t. (_IO_fpos64_t): Delete; all uses changed to __fpos64_t. (_IO_size_t): Delete; all uses changed to size_t. (_IO_ssize_t): Delete; all uses changed to ssize_t or __ssize_t. (_IO_off_t): Delete; all uses changed to off_t. (_IO_off64_t): Delete; all uses changed to off64_t. (_IO_pid_t): Delete; all uses changed to pid_t. (_IO_uid_t): Delete; all uses changed to uid_t. (_IO_wint_t): Delete; all uses changed to wint_t. (_IO_va_list): Delete; all uses changed to va_list or __gnuc_va_list. (_IO_BUFSIZ): Delete; all uses changed to BUFSIZ. (_IO_cookie_io_functions_t): Delete; all uses changed to cookie_io_functions_t. (__io_read_fn): Delete; all uses changed to cookie_read_function_t. (__io_write_fn): Delete; all uses changed to cookie_write_function_t. (__io_seek_fn): Delete; all uses changed to cookie_seek_function_t. (__io_close_fn): Delete: all uses changed to cookie_close_function_t. * libio/iofopncook.c: Remove unnecessary forward declarations. * libio/iolibio.h: Correct outdated commentary. * malloc/malloc.c (__malloc_stats): Remove unnecessary casts. * stdio-common/fxprintf.c (__fxprintf_nocancel): Remove unnecessary casts. * stdio-common/getline.c: Use _IO_getdelim directly. Don't redefine ssize_t. * stdio-common/printf_fp.c, stdio_common/printf_fphex.c * stdio-common/printf_size.c: Don't redefine size_t or FILE. Remove outdated comments. * stdio-common/vfscanf.c: Don't redefine va_list.
* hurd: Fix preprocessor indentationSamuel Thibault2018-01-295-35/+35
|
* hurd: Add expected ABI listsSamuel Thibault2018-01-291-3/+4
| | | | | | | | | | | | | | | | * hurd/Versions: Fix version when _hurd_exec_paths was added. * mach/Versions: Fix version when __mach_host_self_ was added. * sysdeps/mach/hurd/i386/ld.abilist: New file. * sysdeps/mach/hurd/i386/libBrokenLocale.abilist: New file. * sysdeps/mach/hurd/i386/libanl.abilist: New file. * sysdeps/mach/hurd/i386/libc.abilist: New file. * sysdeps/mach/hurd/i386/libcrypt.abilist: New file. * sysdeps/mach/hurd/i386/libdl.abilist: New file. * sysdeps/mach/hurd/i386/libm.abilist: New file. * sysdeps/mach/hurd/i386/libnsl.abilist: New file. * sysdeps/mach/hurd/i386/libresolv.abilist: New file. * sysdeps/mach/hurd/i386/librt.abilist: New file. * sysdeps/mach/hurd/i386/libutil.abilist: New file.
* hurd: Include <sigsetops.h> from hurd/hurd/signal.hSamuel Thibault2018-01-281-0/+5
| | | | | * hurd/hurd/signal.h [__USE_EXTERN_INLINES][_LIBC][IS_IN(libc) || IS_IN(libpthread)]: Include <sigsetops.h>.
* hurd: fix typoSamuel Thibault2018-01-281-1/+1
|
* hurd: take __USE_EXTERN_INLINES into account and restrict inlinesSamuel Thibault2018-01-287-0/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * hurd/hurd.h (__hurd_fail): Always declare function, and provide inline version only if __USE_EXTERN_INLINES is defined. * hurd/hurd/fd.h (_hurd_fd_error_signal, _hurd_fd_error, __hurd_dfail, __hurd_sockfail): Likewise. (_hurd_fd_get): Always declare functions, and provide inline versions only if __USE_EXTERN_INLINES and _LIBC are defined and IS_IN(libc). * hurd/hurd/port.h (_hurd_port_init, _hurd_port_locked_get, _hurd_port_get, _hurd_port_free, _hurd_port_locked_set, _hurd_port_set): Always declare functions, and provide inline versions only if __USE_EXTERN_INLINES and _LIBC are defined and IS_IN(libc). * hurd/hurd/signal.h (_hurd_self_sigstate, _hurd_critical_section_lock, _hurd_critical_section_unlock): Likewise. * hurd/hurd/threadvar.h (__hurd_threadvar_location_from_sp, * __hurd_threadvar_location): Likewise. * hurd/hurd/userlink.h (_hurd_userlink_link, _hurd_userlink_unlink, _hurd_userlink_clear): Likewise. * mach/lock-intern.h (__spin_lock_init, __spin_lock, __mutex_lock, __mutex_unlock, __mutex_trylock): Always declare functions, and provide inline versions only if __USE_EXTERN_INLINES and _LIBC are defined. * mach/mach/mig_support.h (__mig_strncpy): Likewise. * sysdeps/generic/machine-lock.h (__spin_unlock, __spin_try_lock, __spin_lock_locked): Likewise. * sysdeps/mach/i386/machine-lock.h (__spin_unlock, __spin_try_lock, __spin_lock_locked): Likewise. * mach/spin-lock.c (__USE_EXTERN_INLINES): Define to 1. * hurd/Versions (libc: GLIBC_2.27): Add _hurd_fd_error_signal, _hurd_fd_error, __hurd_dfail, __hurd_sockfail, _hurd_port_locked_set, __hurd_threadvar_location_from_sp, __hurd_threadvar_location, _hurd_userlink_link, _hurd_userlink_unlink, _hurd_userlink_clear.
* hurd: Add missing fcntl-internal.hThomas Schwinge2018-01-281-0/+62
| | | | * hurd/fcntl-internal.h: New file.
* hurd: Fix warningsSamuel Thibault2018-01-284-14/+14
| | | | | | | | | | | | | * hurd/hurd/lookup.h (__hurd_file_name_lookup, hurd_file_name_lookup, __hurd_file_name_split, hurd_file_name_split, __hurd_directory_name_split, hurd_directory_name_split, __hurd_file_name_lookup_retry, hurd_file_name_lookup_retry, hurd_file_name_path_lookup): Make lookup function parameter take a const char *name instead of char *name. * hurd/hurdlookup.c (__hurd_file_name_lookup, __hurd_file_name_split, __hurd_directory_name_split): Likewise. * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Likewise. * hurd/path-lookup.c (hurd_file_name_path_lookup): Likewise.
* hurd: Implement faccessat without AT_EACCESS flagSamuel Thibault2018-01-102-10/+24
| | | | | | | | | | | | | | | | | | | | | | * hurd/hurd/fd.h: Include <fcntl.h> (__hurd_at_flags): New function. * hurd/lookup-at.c (__file_name_lookup_at): Replace flag computation with call to __hurd_at_flags. * include/unistd.h (__faccessat, __faccessat_noerrno): Add declaration. * sysdeps/mach/hurd/access.c (access_common): Move implementation to __faccessat (hurd_fail_seterrno, hurd_fail_noerrno): Move to sysdeps/mach/hurd/faccessat.c. (__access_noerrno): Use __faccessat_common instead of access_common. (__access): Likewise. * sysdeps/mach/hurd/euidaccess.c (__euidaccess): Replace implementation with a call to __faccessat. * sysdeps/mach/hurd/faccessat.c (faccessat): Rename into... (__faccessat_common): ... this. Move implementation of __access into it when AT_FLAGS does not contain AT_EACCESS. Make it call __hurd_at_flags, add reauthenticate_cwdir_at helper to implement AT mechanism. (__faccessat_noerrno): New function, just calls __faccessat_common. (__faccessat): New function, just calls __faccessat_common. (faccessat): Define weak alias.
* hurd: Use the new file_exec_paths RPCSamuel Thibault2018-01-093-11/+58
| | | | | | | | | | | | | | | | | | | | | | From: Emilio Pozuelo Monfort <pochu27@gmail.com> From: Svante Signell <svante.signell@gmail.com> Pass the file paths of executable to the exec server, both relative and absolute, which exec needs to properly execute and avertise #!-scripts. Previously, the exec server tried to guess the name from argv[0] but argv[0] only contains the executable name by convention. * hurd/hurdexec.c (_hurd_exec): Deprecate function. (_hurd_exec_paths): New function. * hurd/hurd.h (_hurd_exec): Deprecate function. (_hurd_exec_paths): Declare function. * hurd/Versions: Export _hurd_exec_paths. * sysdeps/mach/hurd/execve.c: Include <stdlib.h> and <stdio.h> (__execve): Use __getcwd to build absolute path, and use _hurd_exec_paths instead of _hurd_exec. * sysdeps/mach/hurd/spawni.c: Likewise. * sysdeps/mach/hurd/fexecve.c: Use _hurd_exec_paths instead of _hurd_exec.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-0184-84/+84
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* hurd: fix gethostname(NULL, 0)Samuel Thibault2017-09-071-2/+2
| | | | | | * hurd/get-host.c (_hurd_get_host_config): Also check that more == 0 before assuming that the file is empty. Avoid testing buffer content when nread == 0.
* hurd: Remove duplicate symbol versionSamuel Thibault2017-08-281-4/+0
| | | | | * hurd/Versions (GLIBC_2.4): Remove __stack_chk_fail. * mach/Versions (GLIBC_2.4): Remove __stack_chk_fail.
* hurd: Fix typoSamuel Thibault2017-08-281-1/+1
| | | | | * hurd/Versions: Fix typo. * mach/Versions: Fix typo.
* hurd: Fix static initialization with -fstack-protector-strongSamuel Thibault2017-08-271-0/+4
| | | | | | | | | | | | | | When linked statically, TLS initialization is not achieved before mach_init and alike, so ssp accesses to tcbhead's stack_guard would crash. We can just avoid using ssp in the few functions needed before TLS is set up. * mach/Makefile (CFLAGS-mach_init.o, CFLAGS-RPC_vm_statistics.o, CFLAGS-RPC_vm_map.o, CFLAGS-RPC_vm_protect.o, CFLAGS-RPC_i386_set_gdt.o, CFLAGS-RPC_i386_set_ldt.o, CFLAGS-RPC_task_get_special_port.o): Add $(no-stack-protector). * hurd/Makefile (CFLAGS-hurdstartup.o, CFLAGS-RPC_exec_startup_get_info.o): Add $(no-stack-protector).
* hurd: fix build with -fstack-protector-strongSamuel Thibault2017-08-272-0/+5
| | | | | | | | | | | | libmachuser and libhurduser also need stack_chk_fail_local and they do not link against libc_nonshared. * mach/stack_chk_fail_local.c: New file. * hurd/stack_chk_fail_local.c: New file. * mach/Machrules ($(interface-library)-routines): Add stack_chk_fail_local. * mach/Versions (GLIBC_2.4): Add __stack_chk_fail. * hurd/Versions (GLIBC_2.4): Add __stack_chk_fail.
* Remove __need macros from stdio.h and wchar.h.Zack Weinberg2017-06-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wint_t is a little finicky because it might be defined by stddef.h, which belongs to the compiler. In addition to the _types_, a bunch of other declarations shared between wctype.h and wchar.h are factored out to their own header. * libio/bits/types/FILE.h, libio/bits/types/__FILE.h * wcsmbs/bits/types/mbstate_t.h, wcsmbs/bits/types/__mbstate_t.h * wcsmbs/bits/types/wint_t.h: New single-type definition files. * wctype/bits/wctype-wchar.h: New file holding declarations shared between wctype.h and wchar.h. * libio/Makefile, wcsmbs/Makefile, wctype/Makefile: Install them. * include/bits/types/FILE.h, include/bits/types/__FILE.h * include/bits/types/mbstate_t.h, include/bits/types/__mbstate_t.h * include/bits/types/wint_t.h, include/bits/wcsmbs-wchar.h: New wrappers. * include/stdio.h, include/wchar.h, include/wctype.h: No need to handle __need macros. * grp/grp.h, gshadow/gshadow.h, hurd/hurd.h, iconv/gconv.h * libio/stdio.h, mach/mach.h, misc/mntent.h, pwd/pwd.h * shadow/shadow.h, stdio-common/printf.h, wcsmbs/uchar.h * wcsmbs/wchar.h, wctype/wctype.h * sysdeps/generic/_G_config.h, sysdeps/unix/sysv/linux/_G_config.h Use the new files instead of __need macros.
* Fix struct sigaltstack namespace (bug 21517).Joseph Myers2017-06-052-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glibc defines the stack_t type with the tag struct sigaltstack. This is not permitted by POSIX; sigaltstack is only reserved with file scope in the namespace of ordinary identifiers, not the tag namespace, and in the case where stack_t is obtained from ucontext.h rather than signal.h, it's not reserved with file scope at all. This patch removes the tag accordingly and updates uses in glibc of struct sigaltstack. This is similar to the removal of the "struct siginfo" tag a few years ago: C++ name mangling changes are an unavoidable consequence. A NEWS item is added to note the changed mangling. There is inevitably some risk of breaking builds of anything that relies on the struct sigaltstack name (though the first few hits I looked at from codesearch.debian.net generally seemed to involve code that could use the stack_t name conditionally, so depending on how they determine the conditionals they may work with glibc not defining the struct tag anyway). Tested for x86_64 and x86, and with build-many-glibcs.py. [BZ #21517] * bits/types/stack_t.h (stack_t): Remove struct tag. * sysdeps/unix/sysv/linux/bits/types/stack_t.h (stack_t): Likewise. * sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h (stack_t): Likewise. * debug/segfault.c (install_handler): Use stack_t instead of struct sigaltstack. * hurd/hurd/signal.h (struct hurd_sigstate): Likewise. * hurd/trampoline.c (_hurd_setup_sighandler): Likewise. * include/signal.h (__sigaltstack): Likwise. * signal/sigaltstack.c (__sigaltstack): Likewise. * signal/signal.h (sigaltstack): Likewise. * sysdeps/mach/hurd/i386/signal-defines.sym (SIGALTSTACK__SS_SP__OFFSET): Likewise. (SIGALTSTACK__SS_SIZE__OFFSET): Likewise. (SIGALTSTACK__SS_FLAGS__OFFSET): Likewise. * sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise. * sysdeps/mach/hurd/sigstack.c (sigstack): Likewise. * sysdeps/unix/sysv/linux/alpha/sys/procfs.h (struct elf_prstatus): Likewise. * sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c (CHECK_SP): Likewise. * sysdeps/unix/sysv/linux/ia64/sys/procfs.h (struct elf_prstatus): Likewise. * sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c (CHECK_SP): Likewise. * sysdeps/unix/sysv/linux/powerpc/sys/procfs.h (struct elf_prstatus): Likewise. * sysdeps/unix/sysv/linux/sh/sys/procfs.h (struct elf_prstatus): Likewise. * sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prstatus): Likewise.
* As a minor cleanup remove the (r)index defines from include/string.h asWilco Dijkstra2017-02-061-2/+2
| | | | | | | | | | | | they are only used internally in a few places. Rename all uses that occur in GLIBC. * hurd/path-lookup.c (file_name_path_scan): Rename index to strchr. * include/string.h (index): Remove define. (rindex): Likewise. * misc/getttyent.c (__getttyent): Rename index to strchr. * misc/ttyslot.c (ttyslot): Rename rindex to strrchr. * sunrpc/rpc_main.c (mkfile_output): Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-0184-84/+84
|
* hurd: fix using hurd.h in C++ programsSamuel Thibault2016-12-041-3/+3
| | | | | * hurd/hurd.h: Cast errno constants to error_t to fix usage in C++ programs.
* hurd: fix using hurd/signal.h in C++ programsSamuel Thibault2016-11-271-3/+3
| | | | | * hurd/hurd/signal.h (HURD_MSGPORT_RPC): Cast expressions results to error_t to fix usage in C++ programs.
* Fix hurd __access_noerrno implementation.Adhemerval Zanella2016-11-181-29/+0
| | | | | | | | | | | | | | This patch fixes some hurd bits from commit afcf3cd8eb that added the __access_noerrno internal symbol. It basically removes the nonrequired __hurd_fail_noerrno (since the 'err' argument is ignored) and fixes a typo for EACCES. However, as stated on maillist [1] this __access_noerrno may still be unsafe to run during initialization of tunables on the Hurd. The access_common calls __hurd_file_name_lookup, which calls __hurd_file_name_lookup_retry, which can set errno. [1] https://sourceware.org/ml/libc-alpha/2016-11/msg00646.html
* New internal function __access_noerrnoAdhemerval Zanella2016-11-161-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | Implement an internal version of __access called __access_noerrno that avoids setting errno. This is useful to check accessibility of files very early on in process startup i.e. before TLS setup. This allows tunables to replace MALLOC_CHECK_ safely (i.e. check existence of /etc/suid-debug to enable/disable MALLOC_CHECK) and at the same time initialize very early so that it can override IFUNCs. Checked on x86_64. * hurd/hurd.h (__hurd_fail_noerrno): New function. * include/unistd.h [IS_IN (rtld) || !defined SHARED]: Declare __access_noerrno. * io/access.c (__access_noerrno): New function. * sysdeps/mach/hurd/access.c (hurd_fail_seterrno): New function. (hurd_fail_seterrno): Likewise. (access_common): Likewise. (__access_noerrno): Likewise. * sysdeps/nacl/access.c (__access_noerrno): Likewise. * sysdeps/unix/sysv/linux/access.c (__access_noerrno): Likewise. * sysdeps/nacl/nacl-interfaces.h (NACL_CALL_NOERRNO): New macro.
* hurdmalloc: Run fork handler as late as possible [BZ #19431]Samuel Thibault2016-09-222-9/+10
| | | | | | | | | | | | | | | | | | | | | This is the hurd-specific follow-up for 29d794863cd6e03115d3670707cc873a9965ba92 : hurdmalloc also needs the same fix * hurd/hurdmalloc.c (malloc_fork_prepare): Rename to _hurd_malloc_fork_prepare. (malloc_fork_parent): Rename to _hurd_malloc_fork_parent. (malloc_fork_child): Rename to _hurd_malloc_fork_child. (_hurd_fork_prepare_hook): Drop malloc_fork_prepare. (_hurd_fork_parent_hook): Drop malloc_fork_parent. (_hurd_fork_child_hook): Drop malloc_fork_child. * hurd/hurdmalloc.h (_hurd_malloc_fork_prepare, _hurd_malloc_fork_parent, _hurd_malloc_fork_child): Add declarations. * sysdeps/mach/hurd/fork.c (__fork): Call __malloc_fork_lock_parent after locking locks (notably hurd_dtable_lock). Call _hurd_malloc_fork_prepare after that. Call _hurd_malloc_fork_parent before __malloc_fork_unlock_parent and _hurd_malloc_fork_child before __malloc_fork_unlock_child.