[PATCH] hurd: Run init_pids () before init_dtable ()

2023-04-15 Thread Sergey Bugaev
Much as the comment says, things on _hurd_subinit assume that _hurd_pid is already initialized by the time _hurd_subinit is run, so _hurd_proc_subinit has to run before it. Specifically, init_dtable () calls _hurd_port2fd (), which uses _hurd_pid and _hurd_pgrp to set up ctty handling. With _hurd_s

Re: [PATCH 0/1] Let's improve/fix ccty handling

2023-04-15 Thread Samuel Thibault
Sergey Bugaev, le sam. 15 avril 2023 19:17:17 +0300, a ecrit: > Do I understand it right that this hooks system is libc-internal? -- > or can user programs add their own functions to the hooks? I don't think it was meant to be used by user programs. Samuel

[PATCH 1/1] hurd: Avoid extra ctty RPCs in init_dtable ()

2023-04-15 Thread Sergey Bugaev
It is common to have (some of) stdin, stdout and stderr point to the very same port. We were making the ctty RPCs that _hurd_port2fd () does for each one of them separately: 1. term_getctty () 2. mach_port_deallocate () 3. term_open_ctty () Instead, let's detect this case and duplicate the ctty p

[PATCH 0/1] Let's improve/fix ccty handling

2023-04-15 Thread Sergey Bugaev
Hello! Here are some assorted thoughts on cttys (controlling terminals). Running rpctrace on any simple program, I see this: 13<--33(pid1354)->term_getctty () = 04<--39(pid1354) task16(pid1354)->mach_port_deallocate (pn{ 10}) = 0 13<--33(pid1354)->term_open_ctty (0 0) = 0x4016 (Inva

Re: [RFC PATCH glibc v2 26/34] hurd: Remove __hurd_local_reply_port

2023-04-15 Thread Samuel Thibault
Sergey Bugaev, le sam. 15 avril 2023 10:34:46 +0300, a ecrit: > If you really want to deallocate and reset the current reply port, you > need to do the dance like sigreturn does: > > mach_port_t reply_port = THREAD_GETMEM (THREAD_SELF, reply_port); > THREAD_SETMEM (THREAD_SELF, MACH_PORT_DEAD); >

Re: [RFC PATCH glibc v2 26/34] hurd: Remove __hurd_local_reply_port

2023-04-15 Thread Sergey Bugaev
On Sat, Apr 15, 2023 at 9:45 AM Samuel Thibault wrote: > Sergey Bugaev, le ven. 14 avril 2023 23:29:51 +0300, a ecrit: > > By the way: that __mig_dealloc_reply_port () inside > > _dl_sysdep_start_cleanup () is not doing what the author of that code > > wanted it to do. It deallocates the current r