Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

io_waitread(3) [debian man page]

io_waitread(3)						     Library Functions Manual						    io_waitread(3)

NAME
io_waitread - read from a descriptor SYNTAX
#include <io.h> int io_waitread(int64 fd,char* buf,int64 len); DESCRIPTION
io_waitread tries to read len bytes of data from descriptor fd into buf[0], buf[1], ..., buf[len-1]. (The effects are undefined if len is 0 or smaller.) There are several possible results: o o_waitread returns an integer between 1 and len: This number of bytes was available for immediate reading; the bytes were read into the beginning of buf. Note that this number can be, and often is, smaller than len; you must not assume that io_waitread always succeeds in reading exactly len bytes. o io_waitread returns 0: No bytes were read, because the descriptor is at end of file. For example, this descriptor has reached the end of a disk file, or is reading an empty pipe that has been closed by all writers. o io_waitread returns -3, setting errno to something other than EAGAIN: No bytes were read, because the read attempt encountered a persis- tent error, such as a serious disk failure (EIO), an unreachable network (ENETUNREACH), or an invalid descriptor number (EBADF). SEE ALSO
io_nonblock(3), io_waitread(3), io_waitreadtimeout(3) io_waitread(3)

Check Out this Related Man Page

io_trywrite(3)						     Library Functions Manual						    io_trywrite(3)

NAME
io_trywrite - write to a descriptor without blocking SYNTAX
#include <io.h> int io_trywrite(int64 fd,const char* buf,int64 len); DESCRIPTION
io_trywrite tries to write len bytes of data from buf[0], buf[1], ..., buf[len-1] to descriptor fd. (The effects are undefined if len is 0 or smaller.) There are several possible results: o o_trywrite returns an integer between 1 and len: This number of bytes was immediately written from the beginning of buf. Note that this number can be, and often is, smaller than len; you must not assume that io_trywrite always succeeds in writing exactly len bytes. o io_trywrite returns -1, setting errno to EAGAIN: No bytes were written, because the descriptor is not ready. For example, the descriptor is writing to a full pipe that could still be read. o io_trywrite returns -3, setting errno to something other than EAGAIN: No bytes were written, because the write attempt encountered a persistent error, such as a serious disk failure (EIO), an unreachable network (ENETUNREACH), or an invalid descriptor number (EBADF). io_trywrite does not pause waiting for a descriptor that is not ready. If you want to pause, use io_waitread or io_wait. You can make io_trywrite faster and more efficient by making the socket non-blocking with io_nonblock(). Once upon a time, many UNIX programs neglected to check the success of their writes. They would often encounter EPIPE, and would blithely continue writing, rather than exiting with an appropriate exit code. The UNIX kernel developers decided to send a SIGPIPE signal, which terminates the process by default, along with returning EPIPE. This papers over the problem without fixing it: the same programs ignore other errors such as EIO. One hopes that the programs have been fixed by now; kernels nevertheless continue to generate the SIGPIPE signal. The first time io_trywrite or io_waitwrite is called, it arranges for SIGPIPE to be ignored. (Technically, for SIGPIPE to be caught by an empty signal handler, so this doesn't affect child processes.) Do not use SIGPIPE elsewhere in the program. SEE ALSO
io_nonblock(3), io_waitread(3), io_trywritetimeout(3) io_trywrite(3)
Man Page

8 More Discussions You Might Find Interesting

1. Programming

problem in reading file using fread

Hi All, These are the two ways i tried to read file but i getting work with second one not with the first. char buf; // Defining space for buf ctrlfnum = fopen(filename_arr.control_fname,"r"); 1) n = fread(buf,sizeof(buf),1,ctrlfnum); ============== (not works) 2) n =... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

2. Shell Programming and Scripting

while read

I'm attempting to extract lines from a file where column lengths are fixed, e.g col1 len=5 col2 len=6... However if I do something like cat file |while read ans do ... The padding between each column is reduced to a space, is there an easy way to read the file with the original column... (3 Replies)
Discussion started by: gefa
3 Replies

3. UNIX for Dummies Questions & Answers

reading an already complied excutable file

Hi, I want ot read a executable file. Please let me know how to read it (4 Replies)
Discussion started by: richardsamuelk
4 Replies

4. UNIX for Dummies Questions & Answers

cp not executing in while read

Hello, I am a newbie to Unix! I am having a problem trying to read in multiple values and constructing a copy command. It will work when reading in only 1 value from a file (testdata1), but there's an error when attempting to code for multiple values per line. Below are my 2 examples. This... (2 Replies)
Discussion started by: andrewsc
2 Replies

5. Programming

How to use we use int64?

Recently my project needs int64 variables. However my os and computer are both 32bits. So how can i use int64 as a parameter in a function. and is int64 a structure as user-defined structures..... ??? thanx i am waiting for ur answer:rolleyes: (2 Replies)
Discussion started by: macroideal
2 Replies

6. Programming

Returning start/end indices

I have an array of distances and a len, for example len = 323 dist = I want to calculate the start and end index values around each distance in the array with a length of len from it. Values in dist are stored in ascending order. (4 Replies)
Discussion started by: kristinu
4 Replies

7. Shell Programming and Scripting

Extract sequences of bytes from binary for differents blocks

Hello to all, I would like to search sequences of bytes inside big binary file. The bin file contains blocks of information, each block begins is estructured as follow: 1- Each block begins with the hex 32 (1 byte) and ends with FF. After the FF of the last block, it follows 33. 2- Next... (59 Replies)
Discussion started by: Ophiuchus
59 Replies

8. Shell Programming and Scripting

Average score

awk '{if(len==0){last=$4;total=$6;len=1;getline}if($4!=last){printf("%s\t%f\n", last, total/len);last=$4;total=$6;len=1}else{total+=$6;len+=1}}END{printf("%s\t%f\n", last, total/len)}' exon.txt > output.txt In the attached file I am just trying to group all the same names in column $4 and then... (2 Replies)
Discussion started by: cmccabe
2 Replies