HPlogo Berkeley Sockets/iX Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 File System Intrinsics

FCNTL, SFCNTL

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

NOTE: Only sfcntl is currently available.

C Interface

        #include <sys/types.h>

        #include <unistd.h>

        #include <fcntl.h>



        int sfcntl (s, cmd, arg)

        int s, cmd, arg;

Description

The sfcntl routine provides control over open sockets. The s parameter is an open socket.

The following are possible values of the arg parameter. They are also referred to as file status flags.

O_NDELAY

Non-blocking I/O.

O_NONBLOCK

POSIX-style non-blocking I/O.

The following are possible values of the cmd argument:

F_GETFL

Get file status flags described above.

F_SETFL

Set O_NDELAY and O_NONBLOCK depending upon the value of arg. It is not possible to set both O_NDELAY and O_NONBLOCK. Note: To set a socket to use blocking I/O (after previously setting it to use non-blocking I/O), the arg parameter should be 0.

Return Value

Upon successful completion, the value returned depends on cmd as follows:

F_GETFL

Value of file status flags and access modes.

F_SETFL

Value other than -1.

Otherwise, a value of -1 is returned, and errno is set to indicate the error.

Errors

The following errors are returned by sfcntl:

[EBADF]

The s parameter is not a valid open file descriptor.

[EINVAL]

The cmd parameter is not a valid command.

[EINVAL]

The cmd parameter is F_SETFL, and both O_NONBLOCK and O_NDELAY are specified.

MPE/iX Specific

The sfcntl call is used instead of fcntl on MPE/iX.

Author

The fcntl intrinsic was developed by Hewlett-Packard, AT&T, and the University of California, Berkeley.

See Also

close, read, write

Feedback to webmaster