History log of /openbsd-current/bin/ksh/tty.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.19 24-Oct-2021 deraadt

For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef.
ok millert


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.18 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.17 15-Mar-2018 anton

Favor usage of __func__ in warning/error messages. Some of them referred to the
wrong function and fix the rest for consistency.
Diff from Michael W. Bombardieri with some cosmetic cleanup applied.

ok benno@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.16 14-Dec-2015 tb

Move system headers from sh.h to those files that actually need them.

ok mmcc@ a while ago


# 1.15 02-Dec-2015 mmcc

comment typo


# 1.14 19-Oct-2015 mmcc

Move string.h include from sh.h to the files that use it.

ok nicm@


# 1.13 15-Oct-2015 mmcc

Remove an unused included header (sys/stat.h).


# 1.12 25-Sep-2015 nicm

Remove EXTERN from tty.[ch], from Michael McConville. No binary change.


# 1.11 13-Sep-2015 tedu

move tty_close up a bit so we can use it.
combine two equiv if blocks.
from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.10 10-Aug-2014 guenther

Replace F_DUPFD followed by setting FD_CLOEXEC with just F_DUPFD_CLOEXEC

ok matthew@ millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.9 14-Mar-2006 deraadt

only santa checks things twice; from adobriyan@gmail; ok tedu


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.8 30-Mar-2005 deraadt

lots of indentation cleanup, now ksh is readable like our other code.
double checked to make sure no binaries change, and eyed by niallo


Revision tags: OPENBSD_3_7_BASE
# 1.7 22-Dec-2004 millert

Use stdbool.h instead of rolling our own bools.


# 1.6 20-Dec-2004 otto

Ansification plus some minor knf. No binary change on i386 and
sparc64, binary change in lex.o on macppc due to introduction of
dopprompt() prototype. ok millert@


# 1.5 18-Dec-2004 millert

Replace fd_clexec() with calls to fcntl(fd, F_SETFD, FD_CLOEXEC)


# 1.4 18-Dec-2004 millert

Use struct termios instead of TTY_state typedef
Use tc[gs]etattr() instead of [gs]et_tty() abstraction


# 1.3 18-Dec-2004 millert

Remove unused OS dependent #ifdef blocks, #defines and macro abstraction.
First step in making the ksh code easier to read. From Matthias Kilian


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.2 01-Oct-1996 downsj

Integrate pdksh 5.2.9.


# 1.1 14-Aug-1996 downsj

branches: 1.1.1;
Initial revision


# 1.18 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.17 15-Mar-2018 anton

Favor usage of __func__ in warning/error messages. Some of them referred to the
wrong function and fix the rest for consistency.
Diff from Michael W. Bombardieri with some cosmetic cleanup applied.

ok benno@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.16 14-Dec-2015 tb

Move system headers from sh.h to those files that actually need them.

ok mmcc@ a while ago


# 1.15 02-Dec-2015 mmcc

comment typo


# 1.14 19-Oct-2015 mmcc

Move string.h include from sh.h to the files that use it.

ok nicm@


# 1.13 15-Oct-2015 mmcc

Remove an unused included header (sys/stat.h).


# 1.12 25-Sep-2015 nicm

Remove EXTERN from tty.[ch], from Michael McConville. No binary change.


# 1.11 13-Sep-2015 tedu

move tty_close up a bit so we can use it.
combine two equiv if blocks.
from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.10 10-Aug-2014 guenther

Replace F_DUPFD followed by setting FD_CLOEXEC with just F_DUPFD_CLOEXEC

ok matthew@ millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.9 14-Mar-2006 deraadt

only santa checks things twice; from adobriyan@gmail; ok tedu


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.8 30-Mar-2005 deraadt

lots of indentation cleanup, now ksh is readable like our other code.
double checked to make sure no binaries change, and eyed by niallo


Revision tags: OPENBSD_3_7_BASE
# 1.7 22-Dec-2004 millert

Use stdbool.h instead of rolling our own bools.


# 1.6 20-Dec-2004 otto

Ansification plus some minor knf. No binary change on i386 and
sparc64, binary change in lex.o on macppc due to introduction of
dopprompt() prototype. ok millert@


# 1.5 18-Dec-2004 millert

Replace fd_clexec() with calls to fcntl(fd, F_SETFD, FD_CLOEXEC)


# 1.4 18-Dec-2004 millert

Use struct termios instead of TTY_state typedef
Use tc[gs]etattr() instead of [gs]et_tty() abstraction


# 1.3 18-Dec-2004 millert

Remove unused OS dependent #ifdef blocks, #defines and macro abstraction.
First step in making the ksh code easier to read. From Matthias Kilian


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.2 01-Oct-1996 downsj

Integrate pdksh 5.2.9.


# 1.1 14-Aug-1996 downsj

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_3_BASE
# 1.17 15-Mar-2018 anton

Favor usage of __func__ in warning/error messages. Some of them referred to the
wrong function and fix the rest for consistency.
Diff from Michael W. Bombardieri with some cosmetic cleanup applied.

ok benno@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.16 14-Dec-2015 tb

Move system headers from sh.h to those files that actually need them.

ok mmcc@ a while ago


# 1.15 02-Dec-2015 mmcc

comment typo


# 1.14 19-Oct-2015 mmcc

Move string.h include from sh.h to the files that use it.

ok nicm@


# 1.13 15-Oct-2015 mmcc

Remove an unused included header (sys/stat.h).


# 1.12 25-Sep-2015 nicm

Remove EXTERN from tty.[ch], from Michael McConville. No binary change.


# 1.11 13-Sep-2015 tedu

move tty_close up a bit so we can use it.
combine two equiv if blocks.
from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.10 10-Aug-2014 guenther

Replace F_DUPFD followed by setting FD_CLOEXEC with just F_DUPFD_CLOEXEC

ok matthew@ millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.9 14-Mar-2006 deraadt

only santa checks things twice; from adobriyan@gmail; ok tedu


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.8 30-Mar-2005 deraadt

lots of indentation cleanup, now ksh is readable like our other code.
double checked to make sure no binaries change, and eyed by niallo


Revision tags: OPENBSD_3_7_BASE
# 1.7 22-Dec-2004 millert

Use stdbool.h instead of rolling our own bools.


# 1.6 20-Dec-2004 otto

Ansification plus some minor knf. No binary change on i386 and
sparc64, binary change in lex.o on macppc due to introduction of
dopprompt() prototype. ok millert@


# 1.5 18-Dec-2004 millert

Replace fd_clexec() with calls to fcntl(fd, F_SETFD, FD_CLOEXEC)


# 1.4 18-Dec-2004 millert

Use struct termios instead of TTY_state typedef
Use tc[gs]etattr() instead of [gs]et_tty() abstraction


# 1.3 18-Dec-2004 millert

Remove unused OS dependent #ifdef blocks, #defines and macro abstraction.
First step in making the ksh code easier to read. From Matthias Kilian


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.2 01-Oct-1996 downsj

Integrate pdksh 5.2.9.


# 1.1 14-Aug-1996 downsj

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.16 14-Dec-2015 tb

Move system headers from sh.h to those files that actually need them.

ok mmcc@ a while ago


# 1.15 02-Dec-2015 mmcc

comment typo


# 1.14 19-Oct-2015 mmcc

Move string.h include from sh.h to the files that use it.

ok nicm@


# 1.13 15-Oct-2015 mmcc

Remove an unused included header (sys/stat.h).


# 1.12 25-Sep-2015 nicm

Remove EXTERN from tty.[ch], from Michael McConville. No binary change.


# 1.11 13-Sep-2015 tedu

move tty_close up a bit so we can use it.
combine two equiv if blocks.
from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.10 10-Aug-2014 guenther

Replace F_DUPFD followed by setting FD_CLOEXEC with just F_DUPFD_CLOEXEC

ok matthew@ millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.9 14-Mar-2006 deraadt

only santa checks things twice; from adobriyan@gmail; ok tedu


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.8 30-Mar-2005 deraadt

lots of indentation cleanup, now ksh is readable like our other code.
double checked to make sure no binaries change, and eyed by niallo


Revision tags: OPENBSD_3_7_BASE
# 1.7 22-Dec-2004 millert

Use stdbool.h instead of rolling our own bools.


# 1.6 20-Dec-2004 otto

Ansification plus some minor knf. No binary change on i386 and
sparc64, binary change in lex.o on macppc due to introduction of
dopprompt() prototype. ok millert@


# 1.5 18-Dec-2004 millert

Replace fd_clexec() with calls to fcntl(fd, F_SETFD, FD_CLOEXEC)


# 1.4 18-Dec-2004 millert

Use struct termios instead of TTY_state typedef
Use tc[gs]etattr() instead of [gs]et_tty() abstraction


# 1.3 18-Dec-2004 millert

Remove unused OS dependent #ifdef blocks, #defines and macro abstraction.
First step in making the ksh code easier to read. From Matthias Kilian


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.2 01-Oct-1996 downsj

Integrate pdksh 5.2.9.


# 1.1 14-Aug-1996 downsj

branches: 1.1.1;
Initial revision