Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

read(2) [plan9 man page]

READ(2) 							System Calls Manual							   READ(2)

NAME
read, readn, write - read or write file SYNOPSIS
#include <u.h> #include <libc.h> long read(int fd, void *buf, long nbytes) long readn(int fd, void *buf, long nbytes) long write(int fd, void *buf, long nbytes) DESCRIPTION
Read reads nbytes bytes of data from the offset in the file associated with fd into memory at buf. The offset is advanced by the number of bytes read. It is not guaranteed that all nbytes bytes will be read; for example if the file refers to the console, at most one line will be returned. In any event the number of characters read is returned. A return value of 0 is conventionally interpreted as end of file. Readn is just like read, but does successive read calls until nbytes have been read, or a read system call returns a non-positive count. Write writes nbytes bytes of data starting at buf to the file associated with fd at the file offset. The offset is advanced by the number of bytes written. The number of characters actually written is returned. It should be regarded as an error if this is not the same as requested. SOURCE
/sys/src/libc/9syscall /sys/src/libc/port/readn.c SEE ALSO
intro(2), open(2), dup(2), pipe(2) DIAGNOSTICS
These functions set errstr. READ(2)

Check Out this Related Man Page

KVM_READ(3)						   BSD Library Functions Manual 					       KVM_READ(3)

NAME
kvm_read, kvm_write -- read or write kernel virtual memory LIBRARY
Kernel Data Access Library (libkvm, -lkvm) SYNOPSIS
#include <kvm.h> ssize_t kvm_read(kvm_t *kd, unsigned long addr, void *buf, size_t nbytes); ssize_t kvm_write(kvm_t *kd, unsigned long addr, const void *buf, size_t nbytes); DESCRIPTION
The kvm_read() and kvm_write() functions are used to read and write kernel virtual memory (or a crash dump file). See kvm_open(3) or kvm_openfiles(3) for information regarding opening kernel virtual memory and crash dumps. The kvm_read() function transfers nbytes bytes of data from the kernel space address addr to buf. Conversely, kvm_write() transfers data from buf to addr. Unlike their SunOS counterparts, these functions cannot be used to read or write process address spaces. RETURN VALUES
Upon success, the number of bytes actually transferred is returned. Otherwise, -1 is returned. SEE ALSO
kvm(3), kvm_close(3), kvm_getargv(3), kvm_getenvv(3), kvm_geterr(3), kvm_getprocs(3), kvm_nlist(3), kvm_open(3), kvm_openfiles(3) BSD
June 4, 1993 BSD
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

what can I get the posix standard?

I wanted study and write a unix like system. who can help me. ------------- Removed the garbled characters... not sure why they were there... (2 Replies)
Discussion started by: crashsky
2 Replies

2. UNIX for Advanced & Expert Users

smart question

eg. : there is a file - 322 bytes, how can I (or you) view just a half of file (161 bytes)? (3 Replies)
Discussion started by: zylwyz
3 Replies

3. UNIX for Advanced & Expert Users

EIF file

Hi, What is a EIF file ? Many thanks before. (2 Replies)
Discussion started by: big123456
2 Replies

4. UNIX for Advanced & Expert Users

please help

Dear friends, I am writing csh script to automate some process. for that , i have one bulk dat file containing hex data . i want to write perticular line by using idno into separate file. for this solution grep command is enough are any commands are there. my dat file has lihe... (9 Replies)
Discussion started by: rajan_ka1
9 Replies

5. UNIX for Advanced & Expert Users

how to read each letter from file and store it in variable.

Dear friends, i am writing csh script i have one dat file containing following data.like this. 08FD3 03A26 000FA0 FFFF0 BBA0F 00000 00000 from the above file i want to read each letter and store it in one variable. how it is possible. please help (7 Replies)
Discussion started by: rajan_ka1
7 Replies

6. UNIX for Advanced & Expert Users

if (( $# != 1 )) ---- what will this return

Hi this is an existing code written by somebody. Please help me in understanding the meaning of this if (( $# != 1 )) (3 Replies)
Discussion started by: satgur
3 Replies

7. UNIX for Advanced & Expert Users

Apache22 not starting

I am getting this error message once I added some lines to a directive in my httpd.conf file. I double checked and made sure their weren't any typos Snytax error line 468 Invlaid command PerlHandler perhaps misspelled or defined by a module not included in the server configuration. Here is what I... (10 Replies)
Discussion started by: rbizzell
10 Replies

8. UNIX for Advanced & Expert Users

how to read this

Dear All, I have some need, I want know how to read this file, and how to get IP from remote that connect to my system my is (10.178.10.xxx) and how can I see what they doing in my system. thank's before Regards, heru (5 Replies)
Discussion started by: heru_90
5 Replies

9. UNIX for Advanced & Expert Users

HELP! Need 2 Write a program which will read in a tax rate (as a percentage) and the

I need this ASAP...don't know where else to turn... Thanx in advance :) (2 Replies)
Discussion started by: 1TruLuv
2 Replies

10. UNIX for Advanced & Expert Users

Can anyone give more details about the system calls?

Hello, Please can any one explain about the parameters to the write systemcalls?? How are they passed?? and how is the address of the user buffer is handled by the kenel?? for ex: write(fd,buf,count); How does the kernel handles this user buffer address?? After write does the kernel write... (1 Reply)
Discussion started by: prakash.kudreka
1 Replies

11. UNIX for Advanced & Expert Users

foreign characters in flat file

Hey, Is there anyway I anks, Pocha (12 Replies)
Discussion started by: pochaman
12 Replies

12. Shell Programming and Scripting

PDKSH dual std input threads

Hi All, I'm trying to read from two files at the same time, but the second READ is failing, giving no value. Obvious STDIN is being used by the first "while read", so how can I retrieve a value from a second file within the loop ?? IFS=" ," cat $DATAFILE | while read curdate currentcksum... (3 Replies)
Discussion started by: adrianmarsh
3 Replies

13. UNIX for Advanced & Expert Users

read() wont allow me to read files larger than 2 gig (on a 64bit)

Hi the following c-code utilizing the 'read()' man 2 read method cant read in files larger that 2gig. Hi I've found a strange problem on ubuntu64bit, that limits the data you are allowed to allocate on a 64bit platform using the c function 'read()' The following program wont allow to allocate... (14 Replies)
Discussion started by: monkeyking
14 Replies

14. UNIX for Advanced & Expert Users

Tokenise every line read

Read a file line by line and extract the 3rd and 6th token of each line read. PLease note that each line read is to be tokensied based onto "/" "\" ":" Kindly help me with a script? (5 Replies)
Discussion started by: skyineyes
5 Replies

15. Programming

Error with compiling

Hi guys. I have a header file: unp.h like this: #ifndef _UNP_H_ #define _UNP_H_ extern ssize_t readn(int filedes, void *buff, size_t nbytes); extern ssize_t writen(int filedes, const void *buff, size_t nbytes); extern void err_quit(const char *msg); #define TRUE 1 #define FALSE 0 ... (2 Replies)
Discussion started by: majid.merkava
2 Replies