History log of /openbsd-current/sys/dev/wscons/wsevent.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.28 25-Mar-2024 mvs

Add 'ws_' prefix to 'wseventvar' structure members. No functional
changes.

ok miod


Revision tags: OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.27 06-Jul-2023 visa

Clear knotes when finishing wseventvar

When finishing a wseventvar in wsevent_fini(), clear the klist.
Otherwise knotes can be left dangling, which can crash the kernel.

In general, klist_invalidate() should happen after vdevgone() in order
to avoid a race with kevent registration. However, the current wscons
drivers clear the wsevent pointer (sc->sc_base.me_evp) before calling
wsevent_fini(). This prevents the drivers from registering new kevents.

Prompted by a report by Peter J. Philipp on bugs@

OK mvs@ miod@


Revision tags: OPENBSD_7_2_BASE OPENBSD_7_3_BASE
# 1.26 02-Jul-2022 visa

Remove unused device poll functions.

Also remove unneeded includes of <sys/poll.h> and <sys/select.h>.

Some addenda from jsg@.

OK miod@ mpi@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.25 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.24 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.23 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.22 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_6_BASE
# 1.21 08-Aug-2019 cheloha

wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@


# 1.20 22-May-2019 anton

A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in
wsevent_init() opening up for a potential race where more than one
thread may be able open the device. Prevent this by checking if the race
was won after calling malloc().

While here, switch to mallocarray as proposed by both cheloha@ and mpi@

ok mpi@


Revision tags: OPENBSD_6_5_BASE
# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.27 06-Jul-2023 visa

Clear knotes when finishing wseventvar

When finishing a wseventvar in wsevent_fini(), clear the klist.
Otherwise knotes can be left dangling, which can crash the kernel.

In general, klist_invalidate() should happen after vdevgone() in order
to avoid a race with kevent registration. However, the current wscons
drivers clear the wsevent pointer (sc->sc_base.me_evp) before calling
wsevent_fini(). This prevents the drivers from registering new kevents.

Prompted by a report by Peter J. Philipp on bugs@

OK mvs@ miod@


Revision tags: OPENBSD_7_2_BASE OPENBSD_7_3_BASE
# 1.26 02-Jul-2022 visa

Remove unused device poll functions.

Also remove unneeded includes of <sys/poll.h> and <sys/select.h>.

Some addenda from jsg@.

OK miod@ mpi@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.25 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.24 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.23 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.22 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_6_BASE
# 1.21 08-Aug-2019 cheloha

wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@


# 1.20 22-May-2019 anton

A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in
wsevent_init() opening up for a potential race where more than one
thread may be able open the device. Prevent this by checking if the race
was won after calling malloc().

While here, switch to mallocarray as proposed by both cheloha@ and mpi@

ok mpi@


Revision tags: OPENBSD_6_5_BASE
# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.26 02-Jul-2022 visa

Remove unused device poll functions.

Also remove unneeded includes of <sys/poll.h> and <sys/select.h>.

Some addenda from jsg@.

OK miod@ mpi@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.25 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.24 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.23 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.22 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_6_BASE
# 1.21 08-Aug-2019 cheloha

wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@


# 1.20 22-May-2019 anton

A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in
wsevent_init() opening up for a potential race where more than one
thread may be able open the device. Prevent this by checking if the race
was won after calling malloc().

While here, switch to mallocarray as proposed by both cheloha@ and mpi@

ok mpi@


Revision tags: OPENBSD_6_5_BASE
# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.25 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.24 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.23 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.22 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_6_BASE
# 1.21 08-Aug-2019 cheloha

wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@


# 1.20 22-May-2019 anton

A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in
wsevent_init() opening up for a potential race where more than one
thread may be able open the device. Prevent this by checking if the race
was won after calling malloc().

While here, switch to mallocarray as proposed by both cheloha@ and mpi@

ok mpi@


Revision tags: OPENBSD_6_5_BASE
# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.24 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.23 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.22 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_6_BASE
# 1.21 08-Aug-2019 cheloha

wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@


# 1.20 22-May-2019 anton

A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in
wsevent_init() opening up for a potential race where more than one
thread may be able open the device. Prevent this by checking if the race
was won after calling malloc().

While here, switch to mallocarray as proposed by both cheloha@ and mpi@

ok mpi@


Revision tags: OPENBSD_6_5_BASE
# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.23 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.22 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_6_BASE
# 1.21 08-Aug-2019 cheloha

wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@


# 1.20 22-May-2019 anton

A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in
wsevent_init() opening up for a potential race where more than one
thread may be able open the device. Prevent this by checking if the race
was won after calling malloc().

While here, switch to mallocarray as proposed by both cheloha@ and mpi@

ok mpi@


Revision tags: OPENBSD_6_5_BASE
# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.22 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_6_BASE
# 1.21 08-Aug-2019 cheloha

wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@


# 1.20 22-May-2019 anton

A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in
wsevent_init() opening up for a potential race where more than one
thread may be able open the device. Prevent this by checking if the race
was won after calling malloc().

While here, switch to mallocarray as proposed by both cheloha@ and mpi@

ok mpi@


Revision tags: OPENBSD_6_5_BASE
# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.21 08-Aug-2019 cheloha

wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@


# 1.20 22-May-2019 anton

A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in
wsevent_init() opening up for a potential race where more than one
thread may be able open the device. Prevent this by checking if the race
was won after calling malloc().

While here, switch to mallocarray as proposed by both cheloha@ and mpi@

ok mpi@


Revision tags: OPENBSD_6_5_BASE
# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.20 22-May-2019 anton

A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in
wsevent_init() opening up for a potential race where more than one
thread may be able open the device. Prevent this by checking if the race
was won after calling malloc().

While here, switch to mallocarray as proposed by both cheloha@ and mpi@

ok mpi@


Revision tags: OPENBSD_6_5_BASE
# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.19 01-Feb-2019 anton

free size for wscons_event; ok deraadt@ visa@


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.18 19-Nov-2018 anton

Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.

This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.

ok mpi@ visa@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


Revision tags: OPENBSD_6_2_BASE
# 1.17 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.16 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 12-Jan-2016 stefan

Use uiomove() instead of uiomovei(); from Martin Natano

ok deraadt@


# 1.14 10-Sep-2015 mpi

kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).

Needed for libinput port.

ok guenther@, miod@


Revision tags: OPENBSD_5_8_BASE
# 1.13 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.12 10-Feb-2015 miod

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@


# 1.11 11-Jan-2015 deraadt

unnecessary cast


# 1.10 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_6_BASE
# 1.9 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.8 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: 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
# 1.7 11-Sep-2007 gilles

KNF

prompted and "much better" by marco@, ok pyr@


# 1.6 10-Sep-2007 gilles

more MALLOC/FREE -> malloc/free and M_ZERO changes

ok pyr@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.5 21-Nov-2005 millert

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h. Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.


Revision tags: OPENBSD_3_8_BASE
# 1.4 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.3 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_BASE UBC_SYNC_A UBC_SYNC_B
# 1.2 01-Aug-2000 mickey

branches: 1.2.6;
update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster