Bug 264971 - tcsetpgrp(3) manpage should mention the relation with SIGTTOU
Summary: tcsetpgrp(3) manpage should mention the relation with SIGTTOU
Status: New
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-01 08:37 UTC by Bertrand Petit
Modified: 2022-07-01 08:39 UTC (History)
2 users (show)

See Also:


Attachments
tcsetpgrp(3) test program (1.25 KB, text/plain)
2022-07-01 08:39 UTC, Bertrand Petit
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Petit 2022-07-01 08:37:21 UTC
I recently had some difficulties when trying to use tcsetpgrp(3) from a process trying to bring itself as the foreground process group leader of its controlling terminal. The process got a SIGTTOU sent, that was unexpected as this signal is not mentioned at all in the tcsetpgrp(3) manpage. I eventually found an enlightening mention of this signal and how to handle it in an unanticipated location, the manual of an old release of the SAS/C compiler.

"If tcsetpgrp is called from a background process, the signal SIGTTOU is generated, unless the signal is ignored or blocked. If the signal is defaulted, this will cause the calling process to stop. If the signal is handled, tcsetpgrp will set errno to EINTR and fail. For this reason, you should ignore or block SIGTTOU if you call tcsetpgrp from a background process."

See https://support.sas.com/documentation/onlinedoc/ccompiler/doc750/html/lr2/zid-9675.htm

I think an explanation of the role of SIGTTOU and its usage relative to tcsetpgrp(3) should be added to the manual page as it plays an important role in the correct application of this library function.
Comment 1 Bertrand Petit 2022-07-01 08:39:07 UTC
Created attachment 235014 [details]
tcsetpgrp(3) test program

A test program that may help explore the behavior of tcsetpgrp(3).