mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 20:28:30 +00:00
Polish recent changes and make improvements
- Simulate SIGPIPE on Windows NT - Fix commandv() regression on Windows NT - Fix sigprocmask() strace bug on OpenBSD - Add many more system calls to --strace logging - Make errno state more pristine in redbean strace
This commit is contained in:
parent
10a766ebd0
commit
39688a73e4
69 changed files with 460 additions and 1976 deletions
|
@ -16,12 +16,16 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/strace.internal.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/nt/console.h"
|
||||
#include "libc/nt/enum/consolemodeflags.h"
|
||||
|
@ -75,17 +79,20 @@ static int ttyname_linux(int fd, char *buf, size_t size) {
|
|||
* Returns name of terminal, reentrantly.
|
||||
*/
|
||||
int ttyname_r(int fd, char *buf, size_t size) {
|
||||
int rc;
|
||||
if (IsLinux()) {
|
||||
return ttyname_linux(fd, buf, size);
|
||||
rc = ttyname_linux(fd, buf, size);
|
||||
} else if (IsFreebsd()) {
|
||||
return ttyname_freebsd(fd, buf, size);
|
||||
rc = ttyname_freebsd(fd, buf, size);
|
||||
} else if (IsWindows()) {
|
||||
if (__isfdkind(fd, kFdFile)) {
|
||||
return sys_ttyname_nt(fd, buf, size);
|
||||
rc = sys_ttyname_nt(fd, buf, size);
|
||||
} else {
|
||||
return ebadf();
|
||||
rc = ebadf();
|
||||
}
|
||||
} else {
|
||||
return enosys();
|
||||
rc = enosys();
|
||||
}
|
||||
STRACE("ttyname_r(%d, %s) → %d% m", fd, buf, rc);
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue