Section B.4. IPC Reference: AIX-Linux


B.4. IPC Reference: AIX-Linux

Table B-4. AIX and Linux IPC API Comparison: Semaphores

AIX

LINUX

AIX ERRNO(s)

LINUX ERRNO(s)

Description

sem_init

sem_init

EFAULT

EINVAL

Initializes the semaphore object.

  

EINVAL

ENOSYS

 
  

ENFILE

  
  

ENOMEM

  
  

ENOSPC

  
  

ENOTSUP

  

sem_wait

sem_wait

EACCES

Does not set Errno. Always returns 0.

Suspends the calling thread until the semaphore pointed to by sem has nonzero count.

  

EAGAIN

  
  

(semwait only)

 
  

EFAULT

  
  

EIDRM

  
  

EINTR

  

sem_trywait

sem_trywait

EINVAL

EAGAIN

 
  

ENOMEM

  
  

ENOTSUP

  

sem_post

sem_post

EACCES

ERANGE

Unlocks a semaphore.

  

EFAULT

  
  

EIDRM

  
  

EINVAL

  
  

ENOMEM

  
  

ENOTSUP

  

sem_getvalue

sem_getvalue

EACCES

Does not set errno. Always returns 0.

Gets the value of a semaphore.

  

EFAULT

  
  

EINVAL

  
  

ENOMEM

  
  

ENOTSUP

  

sem_destroy

sem_destroy

EACCES

EBUSY

Destroys a semaphore object, freeing the resources it might hold.

  

EFAULT

  
  

EINVAL

  
  

ENOTSUP

  

sem_timedwait

sem_timedwait

EFAULT

EENVAL

Advanced real-time wait.

  

EINVAL

ETIMEDWAIT

 
  

ETIMEDWAIT

EDEADLK

 
  

EDEADLK

ENTR

 
  

ENtr

  

sem_unlink

sem_unlink

EACCES

EACCES

Removes a named semaphore.

  

EFAULT

ENAMETOLONG

 
  

ENAMETOOLONG

ENOENT

 
  

ENOENT

  
  

ENOTSUP

  

sem_close

sem_close

EFAULT

EINVAL

Closes a named semaphore.

  

EINVAL

  
  

ENOMEM

  
  

ENOTSUP

  

sem_open

sem_open

EACCES

EACCES

Opens a named semaphore.

  

EEXIST

EEXIST

 
  

EFAULT

EINTR

 
  

EINVAL

EENVAL

  

EMFILE

EMFILE

 
  

ENAMETOOLONG

ENAMETOOLONG

 
  

ENOMEM

ENFILE

 
  

ENOTSUP

ENOENT

 
  

ENOSPC

ENOSPC


Table B-5. AIX and Linux IPC API Comparison: Message Queues

AIX -> Linux

AIX ERRNO(s)

Linux ERRNO(s)

Description

mq_close

EBADF

EBADF

Closes a message queue.

 

ENOMEM

EBUSY

 
 

ENOTSUP

  

mq_open

EACCES

EACCES

Opens a message queue.

 

EEXIST

EEXIST

 
 

EFAULT

EINTR

 
 

EINVAL

EINVAL

 
 

ENOMEM

EMFILE

 
 

ENOSPC

ENOSPC,

 
 

ENOTSUP

ENOENT

 
 

ENOENT

ENFILE

 
 

ENFILE

ENAMETOOLONG

 
 

ENAMETOOLONG

  

mq_notify

EBADF

EBADF

Notifies a process that a message is available.

 

EBUSY

EBUSY

 
 

EFAULT

  
 

ENOMEM

  
 

ENOTSUP

  
 

EINVAL

  

mq_getattr

EBADF

EBADF

Gets message queue attributes.

 

EFAULT

  
 

ENOMEM

  
 

EINVAL

  
 

ENOTSUP

  

mq_unlink

EACCES

EACCES

Removes a message queue.

 

EFAULT

ENOENT

 
 

EINVAL

ENAMETOOLONG

 
 

ENAMETOOLONG,

  
 

ENOTSUP

  

mq_send

EAGAIN

EAGAIN

Sends a message to the message queue

 

EFAULT

EBADF

 
 

EBADF

EINTR

 
 

EIDRM

EINVAL

 
 

EINTR

EMSGSIZE

 
 

EINVAL

  
 

EMSGSIZE

  
 

ENOMEM

  
 

ENOTSUP

  

mq_setattr

EBADF

EBADF

Sets message queue attributes

 

EFAULT

  
 

EINVAL

  
 

ENOMEM

  
 

ENOTSUP

  

mq_send
mq_timedsend
,

EAGAIN

EAGAIN

Sends a message to a message queue (REALTIME)

EBADF

EBADF

 
 

EFAULT

EINTR

 
 

EIDRM

EINVAL

 
 

EINTR

EMSGSIZE

 
 

EINVAL

ETIMEDOUT

 
 

EMSGSIZE

  
 

ENOTSUP

  
 

ETIMEDOUT

  

mq_receive

EAGAIN

EAGAIN

Receives a message from a message queue

 

EBADF

EBADF

 
 

EFAULT

EINVAL

 
 

EIDRM

EMSGSIZE

 
 

EINTR

EINTR

 
 

EINVAL

EINVAL

 
 

EMSGSIZE

ETIMEOUT

 
 

ENOMEM

  
 

ENOTSUP

  

msgctl

EACCES

EACCES

Provides message control operations

 

EPERM

EPERM

 
 

EFAULT

EDIRM

 
 

EINVAL

EFAULT

 
  

EINVAL

 

msgget

EACCES

ENOMEM

Gets a message queue identifier.

 

ENOENT

EACCES

 
 

EEXIST

ENOENT

 
 

ENOSPC

EEXIST

 
  

ENOSPC

 

msgrcv

E2BIG

E2BIG

Reads a message from a queue.

 

EACCES

EACCES

 
 

ENOMSG

ENOMSG

 
 

EFAULT

EFAULT

 
 

EINTR

EINTR

 
 

EIDRM

EIDRM

 
 

EINVAL

EINVAL

 


Table B-6. AIX and Linux POSIX Threads Comparison: APIs Shown to Have Differences

API

Differences

pthread_attr_getschedparam

In AIX, the API takes two parameters:

pthread_attr_setschedparm

pthread_attr_t*

 

struct sched_param*

 

In Linux, the API takes three parameters:

 

pthread_t

 

int (policy)

 

struct sched_param*

pthread_attr_init

Creates a new thread attribute with default values with the following exceptions.

 

AIX:

 

Contention scope = PTHREAD_SCOPE_PROCESS

 

Sched param.sched_prio = 1

 

Linux:

 

Contention scope = PTHREAD_SCOPE_SYSTEM

 

Sched param.sched_priority = 0

pthread_mutex_lock
pthread_mutex_trylock
pthread_mutex_unlockj

Lock mechanism between AIX and Linux is not compatible. The conditions for deadlocking differ, and the attribute values differ.

 

AIX: Possible attribute values are as follows:

 

PTHREAD_MUTEX_NORMAL

 

PTHREAD_MUTEX_ERRORCHECKING

 

PTHREAD_MUTEX_RECURSIVE

 

PTHREAD_MUTEX_DEFAULT

 

Linux: Possible attribute values are as follows:

 

#ifdef __USE_GNU

 

PTHREAD_MUTEX_INITIALIZER

 

PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

 

PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP

 

#ifdef __USE_UNIX98

 

PTHREAD_MUTEX_NORMAL

 

PTHREAD_MUTEX_ERRORCHECKING

 

PTHREAD_MUTEX_RECURSIVE

 

PTHREAD_MUTEX_DEFAULT

pthread_mutexattr_gettype

Gets or sets a mutex type to the following values.

pthread_mutexattr_settype

AIX: Possible attribute values are as follows:

 

PTHREAD_MUTEX_NORMAL

 

PTHREAD_MUTEX_ERRORCHECKING

 

PTHREAD_MUTEX_RECURSIVE

 

PTHREAD_MUTEX_DEFAULT

 

Linux: Possible attribute values are as follows:

 

#ifdef __USE_GNU

 

PTHREAD_MUTEX_INITIALIZER

 

PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

 

PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP

  
 

#ifdef __USE_UNIX98

 

PTHREAD_MUTEX_NORMAL

 

PTHREAD_MUTEX_ERRORCHECKING

 

PTHREAD_MUTEX_RECURSIVE

 

PTHREAD_MUTEX_DEFAULT





UNIX to Linux Porting. A Comprehensive Reference
UNIX to Linux Porting: A Comprehensive Reference
ISBN: 0131871099
EAN: 2147483647
Year: 2004
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net