perl-5.34.0
fcntl FILEHANDLE,FUNCTION,SCALAR

Implements the fcntl(2) function. You'll probably have to say

fcntl(2) ��∽�違��絎�茖������障����� 罩c�����絎���医��臂í��緇������������˨����障��

    use Fcntl;

first to get the correct constant definitions. Argument processing and value returned work just like ioctl below. For example:

�����吾�����������綽�荀���с����������� 綣���違�勐�☎����◑�������ゃ�˨�ゃ����⓾�壔��筝�荐��� ioctl ������罕�������篏������障����� 箴�������:

    use Fcntl;
    my $flags = fcntl($filehandle, F_GETFL, 0)
        or die "Can't fcntl F_GETFL: $!";

You don't have to check for defined on the return from fcntl. Like ioctl, it maps a 0 return from the system call into "0 but true" in Perl. This string is true in boolean context and 0 in numeric context. It is also exempt from the normal Argument "..." isn't numeric warnings on improper numeric conversions.

fcntl ��������勤�������ゃ�勉����с����壔� defined ���篏帥��綽�荀���壔�������障�������� ioctl ��◒����c�⓾���������� ��激�鴻�������潟�若�˨�勛�������� 0 �����c����翫����� "0 ���������" ���菴������障����� �����勖��絖������夌����遵�ゃ�潟�潟����㏍�鴻����с�夌�������ŝ����� ��医�ゃ�潟�潟����㏍�鴻����с�� 0 ��˨�ŝ����障����� ��������壔�障�����筝���ï����ʋ�医�ゅ�������̹�≪��������絽吾� Argument "..." isn't numeric warnings ��������帥����障�����

Note that fcntl raises an exception if used on a machine that doesn't implement fcntl(2). See the Fcntl module or your fcntl(2) manpage to learn what functions are available on your system.

fcntl(2) ���絎�茖���������⓾����ŝ�������激�潟�с�壔�� fcntl ��壚��紊���� 綣����莎激��������������羈���������⓾�������������� ��激�鴻�������с�í�勰�∽�違����ñ���櫝�純����˨�ゃ����⓾�� Fcntl ��≪�吾�ャ�若�˨�� fcntl(2) man �����若�吾�������с����⓾��������������

Here's an example of setting a filehandle named $REMOTE to be non-blocking at the system level. You'll have to negotiate $| on your own, though.

��������� $REMOTE ��������������<�ゃ�˨����潟����˨����激�鴻�������㋘����˨� ��������㏍����壔�≪�若����˨�祉�����������箴���с����� ������������ $| �����ɱ����х�∞�������ŝ�������違�ŝ����障��������

    use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK);

    my $flags = fcntl($REMOTE, F_GETFL, 0)
        or die "Can't get flags for the socket: $!\n";

    fcntl($REMOTE, F_SETFL, $flags | O_NONBLOCK)
        or die "Can't set flags for the socket: $!\n";

Portability issues: "fcntl" in perlport.

腱紙����с�勐�馹�: "fcntl" in perlport���