Skip to Content
Programming Perl, 4th Edition
book

Programming Perl, 4th Edition

by Tom Christiansen, brian d foy, Larry Wall, Jon Orwant
February 2012
Intermediate to advanced
1184 pages
37h 17m
English
O'Reilly Media, Inc.
Content preview from Programming Perl, 4th Edition

ioctl

ioctl FILEHANDLE, FUNCTION, SCALAR

This function implements the ioctl(2) syscall, which controls I/O. To get the correct function definitions, first you’ll probably have to say:

require "sys/ioctl.ph";     # perhaps /usr/local/lib/perl/sys/ioctl.ph

If sys/ioctl.ph doesn’t exist or doesn’t have the correct definitions, you’ll have to roll your own based on your C header files such as sys/ioctl.h. (The Perl distribution includes a script called h2ph to help you do this, but running it is nontrivial.) SCALAR will be read or written (or both) depending on the FUNCTION—a pointer to the string value of SCALAR will be passed as the third argument of the actual ioctl(2) call. If SCALAR has no string value but does have a numeric value, that value will be passed directly rather than a pointer to the string value. The pack and unpack functions are useful for manipulating the values of structures used by ioctl. If the ioctl needs to write data into your SCALAR, it is up to you to ensure that the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Perl, 3rd Edition

Programming Perl, 3rd Edition

Larry Wall, Tom Christiansen, Jon Orwant
Programming the Perl DBI

Programming the Perl DBI

Tim Bunce, Alligator Descartes
Learning Perl, 8th Edition

Learning Perl, 8th Edition

Randal L. Schwartz, brian d foy, Tom Phoenix
Learning Perl, 7th Edition

Learning Perl, 7th Edition

Randal L. Schwartz, brian d foy, Tom Phoenix

Publisher Resources

ISBN: 9781449321451Supplemental ContentErrata Page