Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

IO#fcntl

(::Integer integer_cmd, ::String | ::Integer argument) -> ::Integer
fcntl(integer_cmd, argument) → integer

Invokes Posix system call fcntl(2), which provides a mechanism for issuing low-level commands to control or query a file-oriented I/O stream. Arguments and results are platform dependent.

If argument is a number, its value is passed directly; if it is a string, it is interpreted as a binary sequence of bytes. (Array#pack might be a useful way to build this string.)

Not implemented on all platforms.

See also #external_encoding #fdatasync #expect #fileno also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0