Perform operations using APIs

Many of the application program interfaces (APIs) that perform operations on integrated file system objects are in the form of C language functions.

You have a choice of two sets of functions, either of which you can use in programs that are created using Integrated Language Environment® (ILE) C/400®:

For information about the exit programs that the integrated file system supports, see Table 2.

The integrated file system functions operate only through the integrated file system stream I/O support. The following APIs are supported:

Table 1. Integrated file system APIs
Function Description
access() Determine file accessibility
accessx() Determine file accessibility for a class of users
chdir() Change current directory
chmod() Change file authorizations
chown() Change owner and group of file
close() Close file descriptor
closedir() Close directory
creat() Create new file or rewrite existing file
creat64() Create new file or rewrite existing file (large file enabled)
DosSetFileLocks() Lock and unlock byte range of a file
DosSetFileLocks64() Lock and unlock byte range of a file (large file enabled)
DosSetRelMaxFH() Change the maximum number of file descriptors
dup() Duplicate open file descriptor
dup2() Duplicate open file descriptor to another descriptor
faccessx() Determine file accessibility for a class of users by descriptor
fchdir() Change current directory by descriptor
fchmod() Change file authorizations by descriptor
fchown() Change owner and group of file by descriptor
fclear() Clear a file
fclear64() Clear a file (large file enabled)
fcntl() Perform file control action
fpathconf() Get configurable path name variables by descriptor
fstat() Get file information by descriptor
fstat64() Get file information by descriptor (large file enabled)
fstatvfs() Get information by descriptor
fstatvfs64() Get information by descriptor (64-bit enabled)
fsync() Synchronize changes to file
ftruncate() Truncate file
ftruncate64() Truncate file (large file enabled)
getcwd() Get path name of current directory
getegid() Get effective group ID
geteuid() Get effective user ID
getgid() Get real group ID
getgrgid() Get group information using group ID
getgrnam() Get group information using group name
getgroups() Get group IDs
getpwnam() Get user information for user name
getpwuid() Get user information for user ID
getuid() Get real user ID
givedescriptor() Give file access to another job
ioctl() Perform file I/O control action
link() Create link to file
lseek() Set file read/write offset
lseek64() Set file read/write offset (large file enabled)
lstat() Get file or link information
lstat64() Get file or link information (large file enabled)
mmap() Create a memory map
mmap64() Create a memory map (large file enabled)
mprotect() Change a memory map protection
msync() Synchronize a memory map
munmap() Remove a memory map
mkdir() Make directory
mkfifo() Make FIFO special file
open() Open file
open64() Open file (large file enabled)
opendir() Open directory
pathconf() Get configurable path name variables
pipe() Create interprocess channel with sockets
pread() Read from descriptor with offset
pread64() Read from descriptor with offset (large file enabled)
pwrite() Write to descriptor with offset
pwrite64() Write to descriptor with offset (large file enabled)
QjoEndJournal() End journaling
Start of changeQjoRetrieveJournalEntries()End of change Start of changeRetrieve Journal EntriesEnd of change
QjoRetrieveJournal Information() Retrieve journal information
QJORJIDI() Retrieve journal identifier information
QJOSJRNE() Send journal entry
QjoStartJournal() Start journaling
QlgAccess() Determine file accessibility (using NLS-enabled path name)
QlgAccessx() Determine file accessibility for a class of users (using NLS-enabled path name)
QlgChdir() Change current directory (using NLS-enabled path name)
QlgChmod() Change file authorizations (using NLS-enabled path name)
QlgChown() Change owner and group of file (using NLS-enabled path name)
QlgCreat() Create new file or rewrite existing file (using NLS-enabled path name)
QlgCreat64() Create new file or rewrite existing file (large file enabled and using NLS-enabled path name)
QlgCvtPathToQSYSObjName() Resolve Integrated File System path name into QSYS Object Name (using NLS-enabled path name)
QlgGetAttr() Get system attributes for an object (using NLS-enabled path name)
QlgGetcwd() Get path name of current directory (using NLS-enabled path name)
QlgGetPathFromFileID() Get path name of object from its file ID (using NLS-enabled path name)
QlgGetpwnam() Get user information for user name (using NLS-enabled path name)
QlgGetpwnam_r() Get user information for user name (using NLS-enabled path name)
QlgGetpwuid() Get user information for user ID (using NLS-enabled path name)
QlgGetpwuid_r() Get user information for user ID (using NLS-enabled path name)
QlgLchown() Change owner and group of symbolic link (using NLS-enabled path name)
QlgLink() Create link to file (using NLS-enabled path name)
QlgLstat() Get file or link information (using NLS-enabled path name)
QlgLstat64() Get file or link information (large file enabled and using NLS-enabled path name)
QlgMkdir() Make directory (using NLS-enabled path name)
QlgMkfifo() Make FIFO special file (using NLS-enabled path name)
QlgOpen() Open file (using NLS-enabled path name)
QlgOpen64() Open file (large file enabled and using NLS-enabled path name)
QlgOpendir() Open directory (using NLS-enabled path name)
QlgPathconf() Get configurable path name variables (using NLS-enabled path name)
QlgProcessSubtree() Process directories or objects within a directory tree (using NLS-enabled path name)
QlgReaddir() Read directory entry (using NLS-enabled path name)
QlgReaddir_r() Read directory entry (threadsafe and using NLS-enabled path name)
QlgReadlink() Read value of symbolic link (using NLS-enabled path name)
QlgRenameKeep() Rename file or directory, keep new if it exists (using NLS-enabled path name)
QlgRenameUnlink() Rename file or directory, unlink new if it exists (using NLS-enabled path name)
QlgRmdir() Remove directory (using NLS-enabled path name)
QlgSaveStgFree() Save objects data and free its storage (using NLS-enabled path name)
QlgSetAttr() Set system attributes for an object (using NLS-enabled path name)
QlgStat() Get file information (using NLS-enabled path name)
QlgStat64() Get file information (large file enabled and using NLS-enabled path name)
QlgStatvfs() Get file system information (using NLS-enabled path name)
QlgStatvfs64() Get file system information (large file enabled and using NLS-enabled path name)
QlgSymlink() Make symbolic link (using NLS-enabled path name)
QlgUnlink() Unlink file (using NLS-enabled path name)
QlgUtime() Set file access and modification times (using NLS-enabled path name)
QP0FPTOS() Perform miscellaneous file system functions
QP0LCHSG() Change scan signature
Qp0lCvtPathToSYSObjName() Resolve integrated file system path name into QSYS Object Name
QP0LFLOP() Perform miscellaneous operations on objects
Qp0lGetAttr() Get system attributes for an object
Qp0lGetPathFromFileID() Get path name of object from its file ID
Qp0lOpen() Open file with NLS-enabled path name
Qp0lProcessSubtree() Process directories or objects within a directory tree
Qp0lRenameKeep() Rename file or directory, keep new if it exists
Qp0lRenameUnlink() Rename file or directory, unlink new if it exists
QP0LROR() Retrieve object references
QP0LRRO() Retrieve referenced objects
QP0LRTSG() Retrieve scan signature
Qp0lSaveStgFree() Save objects data and free its storage
Qp0lSetAttr() Set system attributes for an object
Qp0lUnlink() Unlink file with NLS-enabled path name
qsysetegid() Set effective group ID
qsyseteuid() Set effective user ID
qsysetgid() Set group ID
qsysetregid() Set real and effective group IDs
qsysetreuid() Set real and effective user IDs
qsysetuid() Set user ID
QZNFRTVE() Retrieve NFS export information
read() Read from file
readdir() Read directory entry
readdir_r() Read directory entry (threadsafe)
readlink() Read value of symbolic link
readv() Read from file (vector)
rename() Rename file or directory. Can be defined to have the semantics of Qp0lRenameKeep() or Qp0lRenameUnlink().
rewinddir() Reset directory stream
rmdir() Remove directory
select() Check I/O status of multiple file descriptors
stat() Get file information
stat64() Get file information (large file enabled)
statvfs() Get file system information
statvfs64() Get file system information (large file enabled)
symlink() Make symbolic link
sysconf() Get system configuration variables
takedescriptor() Take file access from another job
umask() Set authorization mask for job
unlink() Remove link to file
utime() Set file access and modification times
write() Write to file
writev() Write to file (vector)
Note: Some of these functions are also used for i5/OS sockets.
Table 2. Integrated file system exit programs
Function Description
Integrated File System Scan on Close API Called during close processing such as with the close() API. This exit program must be provided by the user.
Integrated File System Scan on Open API Called during open processing such as with the open() API. This exit program must be provided by the user.
Process a Path Name Called by the Qp0lProcessSubtree() API for each object in the API's search that meets the caller's selection criteria. This exit program must be provided by the user.
Save Storage Free Called by the Qp0lSaveStgFree() API to save a *STMF iSeries™ object type. This exit program must be provided by the user.
Related concepts
Work with file systems
Related reference
Use integrated file system APIs in the "root" (/) file system
Use integrated file system APIs in a user-defined file system
Access using APIs
Example: Integrated file system C functions
Copy data using APIs
Related information
Application programming interfaces (APIs)