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
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)
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)
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)
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)
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)
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)
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)
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)
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)