Hello Ian, I dont see why the program would need any more than to block the signal with sigprocmask before calling tcsetpgrp. I am currently testing a patch to do exactly that.
So far ive added the sigset_t data type to syscall/types_linux and regenerated ztypes_linux_amd64, and added calls to sigprocmask via RawSyscall to access the current signal set. Next, I need to use sigaddset to add SIGTTOU to the signal mask before calling sigprocmask again to set the mask. My understanding is that the sigset type is different depending on the architecture, so I should use the sigaddset function declared in the runtime package. I tried forward declaring the sigaddset and sigprocmask from the runtime package in the syscall package (as is done for runtime_BeforeFork), but when I compile I get "relocation target not defined" for these functions. By the way, I appreciate the help you have given me. It's been a learning experience tackling this issue. Thanks, Aidan On Monday, December 28, 2020 9:37:35 AM PST you wrote: > On Mon, Dec 28, 2020 at 12:15 AM Aidan Hahn <aidan@aidanis.online> wrote: > > What I am trying to do is use signal.Notify to intercept SIGTTOU while > > starting a process with the foreground attribute (see github issue > > 37217). > > > > Perhaps instead I can instead call it in the forkAndExecInChild function > > (syscall/exec_linux.go) before calling forkAndExecInChild1, that way > > there would not be a circular import at least. > Please reply to the mailing list, not just to me. Thanks. > > For issue 37217, can the child just block and then unblock the signal > by calling sigprocmask? Is anything else required to make the program > work? > > Ian > > > On Dec 27, 2020 9:29 PM, Ian Lance Taylor wrote: > > On Sun, Dec 27, 2020 > > at 6:42 PM Aidan Hahn wrote: > > > > I am writing a modification to the > > os package in which I would like to take advantage of code from the > > os/signal package. Ive written the patch (modified os/exec_posix.go) and > > as I expected none of the symbols from os/signal are defined in the os > > package. My question is how I can import them? > > > > I have tried the > > following: > > - import "os/signal": caused the build to hang, presumably > > due to circular imports > > - import "./signal": the import path included > > the vendor folder > > - no import: none of the symbols were defined > > (Notify, Reset, and SIGTTOU) > > > > Sorry if I have overlooked something > > obvious here, but I do not see a solution to importing code from a > > subpackage into the parent package. > > I don't think you've overlooked > > anything obvious. Go doesn't have > subpackages. The packages os and > > os/signal are two different > packages, not a package and a subpackage. > > Go also doesn't permit > circular imports. Since the os/signal package > > imports the os package, > the os package can't import the os/signal > > package. So I don't know > what you're trying to do, but there is no > > easy way for the os package > to call functions like os/signal.Notify. > > > > Ian > > -- > You received this message because you are subscribed to a > > topic in the Google Groups "golang-nuts" group. > To unsubscribe from > > this topic, visit > > https://groups.google.com/d/topic/golang-nuts/gzXwC3ygnRI/unsubscribe. > > > To unsubscribe from this group and all its topics, send an email to > > golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on > > the web visit > > https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXu-Kq8CUAY_gF6B2UkzP > > npFxF%3DwioHXgXaeY6OuPaKhA%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8630440.EvYhyI6sBW%40vespucci.