UNIX to Linux Porting: A Comprehensive Reference

B.3. I/O Services APIs: AIX to Linux Cross-Reference

Table B-3. AIX and Linux System API Comparison: I/O Services

AIX

Linux

ERRNO(s) in AIX Not Implemented in Linux

Description

access

accessx

faccessx

access

ESTALE

ETIMEDOUT

Checks user's permissions for a file.

fclear

fclear64

None

 

Clears space in a file.

fseek

fseek

EAGIN

Repositions a stream.

ftell

ftell

EFBIG

 

rewind

rewind

EINTR

 

fgetpos

fgetpos

EIO

 

fsetpos

fsetpos

ENOSPC

 

fputc

fputc

EPIPE

Outputs character and strings.

fputs

fputs

ENOMEM

 

putc

putc

EOVERFLOW

 

putchar

putchar

ESPIPE

 

puts

puts

  

scanf

scanf

EAGIN

Inputs format conversion.

fscanf

fscanf

EBADF

 

sscanf

sscanf

EINTR

 
  

EIO

 
  

EINVAL

 
  

EILSEQ

 
  

ENOMEM

 

fsync

fsync

EINVAL

EINTR

Synchronizes a file's complete in-core state with that on disk.

getutent

setutent

enutent

utmptname

getutid

getutid_r

getutline_r

pututline_r

setutent_r

endutent_r utmpname_r

getutent

getutent_r getutid

getutid_r gututline

gututline_r

putuline

setutent

endutent utmpname

 

Provides access user accounting database entries. Entries in the database are described by the definitions and data structures in <utmp.h>.

lseek

lseek64

llseek

lseek

llseek

lseek64

EOVERFLOW

Moves the read-write pointer to an open file.

lockfx

lockf

flock

lockf

flock

fcntl

 

Controls open files' descriptors.

open

openx

creat

open

creat

EAGAIN

EDQUOT

EFBIG EINTR EIO

ENOSR

EOVERFLOW

ESTALE

Returns a file descriptor and creates files.

pathconf fpathconf

pathconf

fpathconf

ESTALE

ETIMEDOUT

Retrieves file implementation characteristics.

read readx

readv readvx

read

readv,

EBADMSG EDEADLK EOVERFLOW

ENXIO ESPIPE

ETIMEDOUT

Reads from a file descriptor.

rename

rename

EDQUOT

ETIMEDOUT

ETXTBSY ESTALE

Changes the name or location of a file.

statx

stat

fstatx

fstat

fullstat

fullstat

stat fstat

lstat

ESTALE

ETIMEDOUT

EIO

Gets file status.

truncate

ftruncate

truncate64 ftruncate64

truncate

ftrunncate truncate64

ftruncate64

EAGAIN

EDQUOT

EFBIG EFBIG

EINTR

EMFILE

ENOSPC

ESTALE

ETIMEDOUT

Truncates a file to a specified length.

umask

umask

 

Sets file creation mask.

utimes utime

utimes

utime

EPERM EACCES EROFS

Changes access and/or modification times of an inode.

write writex

writev

writevx

write

writev,

EDQUOT

ENXIO

EFBIG

ERANGE

ESPIPE

Writes to a file descriptor.

chdir

chdir

ESTALE

ETIMEDOUT

Changes working directory.

chroot

chroot

ESTALE

ETIMEDOUT

Changes root directory.

getwd

getcwd

get_current_

dir_name

getwd

getcwd

ENOMEM

Gets current working directory.

glob globfree

glob

globfree

 

Finds path names matching a pattern, frees memory from glob().

link

link

EDQUOT

ENOSPC ESTALE

Makes a new name for a file.

mkdir

mkdir

EDQUOT

ETIMEOUT

ESTALE

Creates a directory.

readdir

readdir_r

readdir

_syscall3

 

Returns current location in directory stream.

printf

printf

EAGAIN

Formats output conversion.

fprintf

fprintf

EABDF

 

sprintf

sprintf

EFBIG

 

snprintf

snprintf

EINTR

 

vprintf

vprintf

EIO

 

vfprintf

vfprintf

ENOSPC

 

vsprintf

vsprintf

EPIPE

 

vsnprintf

vsnprintf

ELSEQ

 
  

EINVAL

 
  

ENOMEM

 
  

ENXIO

 

rmdir

rmdir

EEXIST

Removes a directory.

  

EINVAL

 
  

ETIMEDOUT

 
  

ESTALE

 

scandir alphasort,

scandir alphasor

versionsort

 

Scans a directory for matching entries.

readlink

readlink

ERANGE ETIMEDOUT

Reads value of a symbolic link.

remove

remove

EBUSY

ETIMEDOUT

ESTALE EEXIST

EINVAL

Deletes a name and possibly the file it refers to.

symlink

symlink

EDQUOT

ETIMEDOUT

ESTALE

Makes a new name for a a file.

unlink

unlink

EBUSY

ETIMEDOUT

ESTALE

Deletes a name an possibly the file it refers to.

fscntl

None

 

Manipulates filesystem control operations.

getfsent_r

getfsspec_r

getfsfile_r getfstype_r setfsent_r endfsent_r

getfsent

getfsspec

getfsfile

setfsent endfsent

 

Gets information about a filesystem.

In AIX, _r denotes REENTRANT, which means functions are threadsafe. In Linux, you must make your modules that are using the equivalent APIs thread safe.

getvfsent

None

 

Gets a (virtual file system) VFS file entry.

getvfsbytype

   

getvfsbyname

   

getvfsbyflag

   

setvfsent

   

endvfsent

   

mnctl

None

 

Returns mount status information.

quotacl

quotacl

ELOOP

Manipulates disk quotas.

  

ENAMETOOLONG

 
  

ENOENT

 
  

EOPNOTSUPP

 
  

EROFS

 
  

EUSERS

 

statfs

statfs

ESTALE

Gets filesystem statistics.

fstatfs

fstatfs

ETIMEDOUT

 
  

EIO

 

sysconf

sysconf

 

Provides a way for the application to determine values for system limits or options at runtime. Functions are compatible, but the information they return are specific to the platform they are running on.

sync

sync

 

Functions are not compatible. In Linux, sync returns an int; in AIX, this function returns void. Causes all information in memory that should be on disk to be written out. The information returned and its format differ.

umask

umask

 

Sets the umask to mask and 0777.

vmount

uvmount

None

 

AIX-specific. Creates what is known as a virtual file system (VFS). uvmount removes a VFS. umount can also be used as an alternative to uvmount.

umount

umount

In AIX, ENOBLK is returned. In Linux, ENOTBLK is returned.

Unmounts a previously mounted filesystem, directory, or file.

Категории