See the  *  GNU General Public License for more details

Useful functions for enabling and disabling the non-blocking I/O mode of file descriptors

Filed under:.

— Leave a comment October 18

2014 In this article I will present to you two useful functions that can be used whenever you want to enable or disable the non-blocking I/O mode of a file descriptor.
By using the enable_io_blocking_for_file_descriptor and disable_io_blocking_for_file_descriptor functions you can enable and disable the I/O blocking of a file descriptor.
Here is the header of the source code unit providing the functions: /*  *  Copyright (C) 2014  Efstathios Chatzikyriakidis ([email protected]).
*  *  This program is free software : you can redistribute it and/or modify  *  it under the terms of the GNU General Public License as published by  *  the Free Software Foundation, either version 3 of the License, or  *  (at your option) any later version.
*  *  This program is distributed in the hope that it will be useful,  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  *  GNU General Public License for more details.
*  *  You should have received a copy of the GNU General Public License  *  along with this program.
If not, see .
*/ #ifndef _FILE_DESCRIPTOR_UTILITY_H_ #define _FILE_DESCRIPTOR_UTILITY_H_ #include “shared-types.h” /*  * function prototypes.
*/ bool_t enable_io_blocking_for_file_descriptor (const int file_descriptor); bool_t disable_io_blocking_for_file_descriptor (const int file_descriptor); #endif // _FILE_DESCRIPTOR_UTILITY_H_ Here is the implementation of the source code unit providing the functions: /*  *  Copyright (C) 2014  Efstathios Chatzikyriakidis ([email protected]).
*  *  This program is free software: you can redistribute it and/or modify  *  it under the terms of the GNU General Public License as published by  *  the Free Software Foundation, either version 3 of the License, or  *  (at your option) any later version.
*  *  This program is distributed in the hope that it will be useful,  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  *  GNU General Public License for more details.
*  *  You should have received a copy of the GNU General Public License  *  along with this program.
If not, see .
*/ #include #include “file-descriptor-utility.h” /*  * functions.
*/ bool_t enable_io_blocking_for_file_descriptor (const int file_descriptor) {   int file_descriptor_flags;   if ((file_descriptor_flags = fcntl (file_descriptor, F_GETFL, 0)) Click to share on Facebook (Opens in new window)

Click to share on LinkedIn (Opens in new window)

Click to share on Twitter (Opens in new window)

Click to print (Opens in new window)

Click to email this to a friend (Opens in new window)

Like this:.
Like Loading.
Related.
Tags: file descriptor, , , I/O, non-blocking, , .

Comments RSS feed Leave a Reply Cancel reply

Enter your comment here.
Fill in your details below or click an icon to log in:.
Email (Address never made public) Name Website You are commenting using your WordPress.com account.
( Log Out /   ) You are commenting using your Google account.
( Log Out /   ) You are commenting using your Twitter account.
( Log Out /   ) You are commenting using your Facebook account.
( Log Out /   ) Cancel Connecting to %s Notify me of new comments via email.
Notify me of new posts via email.
« A safe wrapper implemented in C for freeing dynamic allocated memory.

Helper functions for handling the PID file of a background daemon

».
(79).
(21).
(15).
(26).
(4).
(7).
(55).
(24).
(4).
(16).
(14).
(4).
(7).
(10).
(78).
(11).
(9).
(1).
October 2014 M T W T F S S  12345 6789101112 13141516171819 20212223242526 2728293031   « Sep Mar ».
(2).
(4).
(1).
(1).
(2).
(1).
(1).
(1).
(2).
(1).
(9).
(1).
(8).
(1).
(1).
(2).
(4).
(7).
(1).
(1).
(1).
(8).
(12).
(1).
(2).
(1).
(2).
(1).
(2).
(1).
(1).
(4).
(20).
(13).
(5).
(2).
(10).
(13).
(10).
(10).
(20).
287,005 hits.
Send to Email Address Your Name Your Email Address Cancel Post was not sent – check your email addresses.
Email check failed.

Please try again Sorry

your blog cannot share posts by email.
%d bloggers like this:.

Leave a Reply

Your email address will not be published. Required fields are marked *