diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index 67ee96578593..f541c1f7d134 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -238,7 +238,7 @@ operating system kernel. %% Types that can be used from other modules -- alphabetically ordered. -export_type([date_time/0, fd/0, file_info/0, filename/0, filename_all/0, - io_device/0, location/0, mode/0, name/0, name_all/0, posix/0]). + io_device/0, io_server/0, location/0, mode/0, name/0, name_all/0, posix/0]). %%% Includes and defines -include("file_int.hrl"). @@ -264,8 +264,14 @@ See the documentation of the `t:name_all/0` type.". -type file_descriptor() :: #file_descriptor{}. -doc "A file descriptor representing a file opened in [`raw`](`m:file#raw`) mode.". -type fd() :: file_descriptor(). --doc "As returned by `open/2`; `t:pid/0` is a process handling I/O-protocols.". --type io_device() :: pid() | fd(). +-doc "A process handling the I/O protocol.". +-type io_server() :: pid(). +-doc """ +An IO device as returned by `open/2`. + +`t:io_server/0` is returned by default and `t:fd/0` is returned if the `raw` option is given. +""". +-type io_device() :: io_server() | fd(). -type location() :: integer() | {'bof', Offset :: integer()} | {'cur', Offset :: integer()} | {'eof', Offset :: integer()} | 'bof' | 'cur' | 'eof'. diff --git a/lib/stdlib/src/io.erl b/lib/stdlib/src/io.erl index 068c99e996a1..f7e959fcf5a2 100644 --- a/lib/stdlib/src/io.erl +++ b/lib/stdlib/src/io.erl @@ -142,10 +142,10 @@ handled by `user`. """. -type user() :: user. -doc """ -An I/O device, either `standard_io`, `standard_error`, `user`, a registered -name, or a pid handling I/O protocols (returned from `file:open/2`). +An I/O device, either `t:standard_io/0`, `t:standard_error/0`, `t:user/0`, a `t:file:io_server/0`, +a registered name, or any pid handling I/O protocols. """. --type device() :: atom() | pid() | standard_io() | standard_error() | user(). +-type device() :: atom() | pid() | file:io_server() | standard_io() | standard_error() | user(). -type prompt() :: atom() | unicode:chardata(). %% ErrorDescription is whatever the I/O-server sends. @@ -494,8 +494,8 @@ The options and values supported by the OTP I/O devices are as follows: functions can handle any of these modes and so should other, user-written, modules behaving as clients to I/O servers. - This option is supported by the standard shell (`group.erl`), the 'oldshell' - (`user.erl`), and the file I/O servers. + This option is supported by the `t:standard_io/0`, `t:user/0` and `t:file:io_server/0` + I/O servers. - **`{echo, boolean()}`** - Denotes if the terminal is to echo input. Only supported for the standard shell I/O server (`group.erl`)