 |
Index for Section 3 |
|
 |
Alphabetical listing for G |
|
 |
Bottom of page |
|
getfsent(3)
NAME
getfsent, getfsent_r, getfsspec, getfsspec_r, getfsfile, getfsfile_r,
setfsent, setfsent_r, endfsent, endfsent_r - Get information about a file
system
SYNOPSIS
#include <fstab.h>
struct fstab *getfsent(
void );
struct fstab *getfsspec(
const char *spec_file );
struct fstab *getfsfile(
const char *fs_file );
int setfsent(
void );
void endfsent(
void );
The following obsolete functions are supported in order to maintain
backward compatibility with previous versions of the operating system. You
should not use them in new designs.
int getfsspec_r(
const char *spec_file,
struct fstab *fsent,
char *buf,
int len,
FILE **fs_fp );
int getfsent_r(
struct fstab *fsent,
char *buf,
int len,
FILE **fs_fp );
int getfsfile_r(
const char *fs_file,
struct fstab *fsent,
char *buf,
int len,
FILE **fs_fp );
int setfsent_r(
FILE **fs_fp );
int endfsent_r(
FILE **fs_fp );
LIBRARY
Standard C Library (libc)
PARAMETERS
spec_file
Specifies the block special device name to look for.
fs_file
Specifies the file system filename to look for.
fsent
Specifies the file system table entry found.
buf Specifies a working buffer that can hold the longest fstab file line
for the reentrant functions.
len Specifies the length of buf. This length should be sufficient for buf
to hold the longest /etc/fstab line.
fs_fp
Specifies the file that contains the next file system entry
(initialized by the user).
DESCRIPTION
For the following functions, entries are read from the /etc/fstab file.
The getfsent() function reads the next line of the file, opening the file
if necessary.
The setfsent() function opens the file or rewinds to the first record.
The endfsent() function closes the file. If there is no file to close, the
endfsent() function returns.
The getfsspec() function sequentially searches from the beginning of the
file until a matching spec_file name is found, or the end of the file is
encountered.
The getfsfile() function sequentially searches from the beginning of the
file until a matching file system filename is found, or the end of the file
is encountered.
NOTES
The getfsent(), getfsspec(), getfsfile(), setfsent(), and endfsent()
functions store the information in a thread-specific buffer. Subsequent
calls to these functions from the same thread overwrite the contents of the
internal buffer.
The getfsent_r(), getfsspec_r(), getfsfile_r(), setfsent_r(), and
endfsent_r() functions are obsolete reentrant versions of the getfsent(),
getfsspec(), getfsfile(), setfsent(), and endfsent() functions. They are
supported in order to maintain backward compatibility with previous
versions of the operating system and should not be used in new designs.
Note that the caller is expected to initialize *fs_fp to NULL before
calling the setfsent_r() function for the first time.
RETURN VALUES
Upon successful completion, the getfsent() and getfsspec() functions return
a pointer to a file system table entry, defined in the fstab.h file. The
setfsent() function returns a value of 1.
Upon failure or EOF (End-of-File), the getfsent(), getfsfile(), and
getfsspec() functions return a NULL pointer, and the setfsent() function
returns a value of 0 (zero).
Upon successful completion, the getfsent_r(), getfsspec_r(), and
getfsfile_r() functions store the file system table structure in the area
pointed at by fsent, and, along with setfsent_r(), return a value of 0
(zero).
Upon failure, the getfsent_r(), getfsspec_r(), getfsfile_r(), and
setfsent() functions return a value of -1.
ERRORS
If any of the following conditions occurs, the getfsent_r(), getfsspec_r(),
getfsfile_r(), and setfsent_r() functions set errno to the corresponding
value:
[EINVAL]
fsent, line, or fs_fp are invalid, or len is too small.
If any of the following conditions occurs, the getfsent_r(), getfsspec_r(),
and getfsfile_r(), functions set errno to the corresponding value:
[ESRCH]
The search failed.
In addition upon failure, the setfsent() and endfsent() functions return
other errnos.
SEE ALSO
Files: fstab(4)
 |
Index for Section 3 |
|
 |
Alphabetical listing for G |
|
 |
Top of page |
|