06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ead_dir pHILE+ <strong>System</strong> <strong>Calls</strong><br />

read_dir <strong>Read</strong>s directory entries in a file system independent format.<br />

#include <br />

unsigned long read_dir(<br />

XDIR *dir, /* a directory handle */<br />

struct dirent *buf /* user structure to hold returned contents */<br />

)<br />

Volume Types<br />

Description<br />

Arguments<br />

Return Value<br />

All volume types.<br />

read_dir() reads one directory entry at a time from a directory file in a file<br />

system-independent format. The directory handle is first obtained with<br />

open_dir().<br />

dir Points to the handle for the directory file, which has been returned by<br />

open_dir().<br />

buf Points to the memory area that receives the data. The data returned<br />

in *buf is a dirent structure defined in , as follows:<br />

struct dirent {<br />

unsigned long d_filno;<br />

char d_name [MAXNAMLEN+1];<br />

}<br />

This structure cannot be packed. d_fileno contains a number that<br />

is unique for each distinct file in the file system, and d_name<br />

contains a null-terminated filename, where the size is in the range of<br />

1 through MAXNAMLEN+1. MAXNAMLEN is set to 255.<br />

When the last entry has been read, an end-of-file error is returned.<br />

This system call returns 0 on success or an error code on failure.<br />

2-90 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!