3. System Interfaces

This section describes how QNX Neutrino conforms to POSIX with regards to system interfaces.

acos(), acosf(), and acosl()

For finite values not in the range [-1,1], acos() , acosf() , and acosl() return NaN. The return value for +/-Inf is NaN.

acosh(), acoshf(), acoshl()

For finite values of x < 1, acosh() , acoshf() , and acoshl() return NaN. The return value when x is -Inf is NaN.

asin(), asinf(), asinl()

For finite values not in the range [-1,1], asin() , asinf() , and asinl() return NaN. The return value for +/-Inf is NaN.

atan(), atanf(), atanhl()

For finite values of |x| > 1, atan() , atanf() , and atanhl() return NaN. The return value for +/-Inf is NaN.

calloc()

The calloc() function returns a unique pointer when the size of space requested is zero.

clock_getres(), clock_settime()

The resolution of all clocks, as returned by clock_getres() , is the same as the system clock resolution:

  • for CPU targets executing at less than 40 MHz, the resolution is 10 milliseconds
  • for CPU targets executing at more than 40 MHz, the resolution is 1 millisecond

The system clock resolution can be set using the QNX-specific ClockPeriod() kernel call using the CLOCK_REALTIME clock.

The clock_settime() function is supported only for the CLOCK_REALTIME clock.

Appropriate privileges for setting the CLOCK_REALTIME clock are obtained by executing with a user ID equal to 0.

cos(), cosf(), cosl()

When x is +/-Inf, cos() , cosf() , and cosl() return NaN.

erfc(), erfcf(), erfcl()

For a correct value that would cause an underflow, erfc() , erfcf() , and erfcl() return 0.0.

exp(), expf(), expl()

For a correct value that would cause an underflow, exp() , expf() , and expl() return 0.0.

exp2(), exp2f(), exp2l()

For a correct value that would cause an underflow, exp2(), exp2f(), and exp2l() return 0.0.

fclose()

The fclose() may give an EIO error under the following circumstances:

  • An I/O error occurred when writing cached data to the underlying media.
  • An I/O error occurred when updating metadata on the underlying media.
  • The filesystem resides on a removable media device, and the media has been forcibly removed.

fcntl()

The following addition values for the cmd argument to fcntl() are defined:

Value Meaning
F_ALLOCSP Allocate storage space for the section of the file specified by the l_start, l_len, and l_whence fields of a struct flock structure pointed to by the argument to fcntl() .
F_FREESP Free storage space for the section of the file specified by the l_start, l_len, and l_whence fields of a struct flock structure pointed to by the argument to fcntl().
F_ALLOCSP64 Same as F_ALLOCSP, except that the argument is a pointer to a struct flock64 structure, where the l_start and l_len fields are 64-bit values.
F_FREESP64 Same as F_FREESP, except that the argument is a pointer to a struct flock64 structure, where the l_start and l_len fields are 64-bit values.
F_GETLK64 Same as F_GETLK, except that the argument is a pointer to a struct flock64 structure, where the l_start and l_len fields are 64-bit values.
F_SETLK64 Same as F_SETLK, except that the argument is a pointer to a struct flock64 structure, where the l_start and l_len fields are 64-bit values.
F_SETLKW64 Same as F_GETLKW, except that the argument is a pointer to a struct flock64 structure, where the l_start and l_len fields are 64-bit values.

fdim(), fdimf(), fdiml()

When xy is positive and underflows, fdim(), fdimf(), and fdiml() return 0.0.

fegetexceptflag()

The representation of the floating-point status flags used by fegetexceptflag() depends on the CPU architecture. For x86 processors, the following values are used:

Value Meaning
0x01 Invalid operation exception
0x02 Denormalization exception
0x04 Division-by-zero exception
0x08 Overflow exception
0x10 Underflow exception
0x20 Inexact exception

feraiseexcept()

The feraiseexcept() function doesn't raise the inexact floating-point exception whenever it raises the overflow or underflow floating point exception.

fflush()

The fflush() may return an EIO error under the following circumstances:

  • an I/O error when writing cached data to the underlying media
  • an I/O error when updating metadata on the underlying media
  • the filesystem resides on a removable media device, and the media has been forcibly removed

fgetc()

The fgetc() function may return an EIO error if the filesystem resides on a removable media device, and the media has been forcibly removed.

fma(), fmaf(), fmal()

When x multiplied by y is an exact infinity, and z is also an infinity with the opposite sign, fma(), fmaf(), and fmal() return NaN.

The return value when one of x and y is infinite, the other is zero, and z isn't a NaN is NaN.

fmod(), fmodf(), fmodl()

For a correct value that would cause an underflow, fmod() , fmodf() , and fmodl() return 0.0. The return value when y is zero is NaN. The return value when x is infinite is NaN.

fpclassify()

There are no additional classification categories for the fpclassify() function, other than NaN, infinite, normal, subnormal and zero.

fprintf()

For the fprintf() function, the low-order digit rounding for numbers in double format is round-to-nearest.

For double arguments, the styles for representing infinity and NaN are as follows:

Value Format conversion specifier Representation
Infinity f [-]inf
Infinity F [-]INF
NaN f [-]nan
NaN F [-]NAN

The value of a pointer for the p conversion specifier is converted to a sequence of hexadecimal digits. The sequence is padded with leading zeroes if the 0 flag is specified.

fputc()

The fputc() function may return an EIO error if the filesystem resides on a removable media device, and the media has been forcibly removed.

freopen()

The following mode changes are permitted for freopen() :

  • w to a
  • a to w
  • r+ to r
  • r+ to w
  • r+ to a
  • r+ to w+
  • r+ to a+
  • w+ to r
  • w+ to w
  • w+ to a
  • w+ to r+
  • w+ to w+
  • w+ to a+
  • a+ to r
  • a+ to w
  • a+ to a
  • a+ to r+
  • a+ to w+

fscanf()

A - in the scanlist for fscanf() that isn't the first character, nor the second where the first character is a ^, nor the last character, defines a range of characters to be matched. This range consists of characters numerically greater than or equal to the character before the -, and numerically less than or equal to the character after the -.

The p conversion specifier matches a sequence of hexadecimal digits. If the sequence contains more than 8 digits, the conversion is performed only on the last 8 digits in the sequence.

fseeko()

The fseeko() function returns EOF on devices that are incapable of seeking. It sets errno to either ESPIPE or ENOSYS, depending on the implementation of the device or filesystem.

An EIO error may be returned if the filesystem resides on a removable media device, and the media has been forcibly removed.

fsetpos()

The fsetpos() function returns EOF on devices that are incapable of seeking. It sets errno to either ESPIPE or ENOSYS, depending on the implementation of the device or filesystem.

An EIO error may be returned if the filesystem resides on a removable media device, and the media has been forcibly removed.

fstat()

No additional or alternative file access control mechanisms are provided for the fstat() function.

fsync()

The fsync() function causes all buffered data for the file to be written to the storage device; the file modification times are updated.

kill()

No extended security controls are provided for the kill() function.

ldexp(), ldexpf(), ldexpl()

For a correct value that would cause an underflow, ldexp() , ldexpf() , and ldexpl() return 0.0.

log(), logf(), logl()

For finite values of x less than zero, log() , logf() , and logl() return NaN. The return value when x is -Inf is NaN.

log10(), log10f(), log10l()

For finite values of x less than zero, log10() , log10f() , and log10l() return NaN. The return value when x is -Inf is NaN.

log1p(), log1pf(), log1pl()

For finite values of x less than -1, log1p() , log1pf() , and log1pl() return NaN. The return value when x is -Inf is NaN.

log2(), log2f(), log2l()

For finite values of x less than 0, log2(), log2f(), and log2l() return NaN. The return value when x is -Inf is NaN.

lseek()

The lseek() function returns -1 on devices that are incapable of seeking. It sets errno to either ESPIPE or ENOSYS, depending on the implementation of the device or filesystem.

malloc()

The malloc() function returns a unique pointer when the size of space requested is zero.

mkdir()

In the mkdir() function, the following bits, in addition to file permission bits, behave as follows:

S_ISGID
Files and directories created within this directory have the group ID of this directory instead of the group ID of the process creating the file or directory.
S_ISVTX
Files can be removed or renamed only if one or more of the following is true:
  • The user owns the file.
  • The user owns the directory.
  • The file is writable by the user.
  • The user is privileged.

mlock()

There's no limit on the amount of memory that a process may lock by calling mlock() , other than the amount of physical memory in the system.

mlockall(), munlockall()

Locking implied by MCL_FUTURE in a call to mlockall() or munlockall() is performed during an mmap() operation. If this exceeds the amount of available physical memory, that mmap() call fails with an ENOMEM error.

There is no limit on the amount of memory that a process may lock other than the amount of physical memory in the system.

mmap()

The return value for a successful mmap() call is a pointer whose value is a valid address in the process virtual address space. This establishes translations from the virtual address range to the physical memory addresses corresponding to the specified section of the memory object.

The return value for an unsuccessful mmap() call is MAP_FAILED, whose value is ((void *) -1).

The implementation supports MAP_FIXED.

When MAP_FIXED isn't set, addr is used as a hint to derive the virtual address returned:

  • If no mapping currently exists in the range [addr, addr + len), addr is used.
  • Otherwise, the system searches for the first available unused area of the process's address space that's large enough to hold the specified size.

There are no limits on the number of memory regions that can be mapped other than the limit imposed on the process's virtual address space.

open()

The O_TRUNC flag for open() has no effect on file types other than regular files.

posix_trace_*()

The Trace (TRC) option isn't supported, so BlackBerry PlayBook OS doesn't support the following:

  • posix_trace_attr_getlogsize()
  • posix_trace_attr_getmaxdatasize()
  • posix_trace_attr_getlogstreamsize()
  • posix_trace_create_withlog()
  • posix_trace_flush,posix_trace_shutdown()
  • posix_trace_eventset()
  • posix_trace_getnext_event()
  • posix_trace_trygetnext_event()
  • posix_trace_timedgetnext_event()

pow(), powf(), powl()

For finite values of x less than 0 and finite non-integer values of y, pow() , powf() , and powl() return NaN. The return value for a correct value that would cause underflow is 0.0.

pthread_attr_destroy()

The QNX Neutrino implementation of pthread_attr_destroy() doesn't set an invalid value.

pthread_condattr_destroy(), pthread_condattr_init()

There are no additional implementation-defined condition variable attributes for pthread_condattr_destroy() and pthread_condattr_init() to destroy or initialize, and no additional functions for getting or setting such attributes.

pthread_getschedparam(), pthread_setschedparam()

The SCHED_OTHER policy is implemented identically to the SCHED_RR policy. The pthread_getschedparam() and pthread_setschedparam() functions affect only the priority scheduling parameter.

The pthread_setschedparam() function supports dynamically changing the policy to SCHED_SPORADIC.

pthread_rwlock_rdlock()

The Thread Execution Scheduling (TPS) option is supported, so a thread that calls pthread_rwlock_rdlock() doesn't acquire the lock if a writer holds the lock or there are writers blocked on the lock. The maximum number of simultaneous read locks is 2147483647.

pthread_rwlock_unlock()

The TPS option is supported, so if threads executing with the SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC are waiting on a lock, they acquire the lock in priority order when a call to pthread_rwlock_unlock() means that the lock becomes available. For threads of equal priority, write locks take precedence over read locks.

pthread_rwlockattr_getpshared(), pthread_rwlockattr_setpshared()

There are no additional implementation-defined read-write lock attributes, so there are no functions in addition to pthread_rwlockattr_getpshared() and pthread_rwlockattr_setpshared() for getting or setting such attributes.

read()

For special device files, a subsequent read() request after the end-of-file condition has been reached results in 0 bytes being read.

When the value of nbyte is greater than SSIZE_MAX, the number of bytes read is limited to LONG_MAXoffset, where offset is the current file offset.

An EIO error may be returned if the filesystem resides on a removable media device, and the media has been forcibly removed.

remainder(), remainderf(), remainderl()

When x is infinite or y is zero and the other is non-NaN, remainder() , remainderf() , and remainderl() return NaN.

remquo(), remquof(), remquol()

For remquo(), remquof(), and remquol(), the value of n used to determine the magnitude of the result is 31. The return value when x is +/-Inf or y is zero and the other argument is non-NaN is NaN.

rint(), rintf(), rintl()

The current rounding mode used is determined by invoking the fegetround() function in the implementation of the rint() , rintf() , and rintl() functions.

scalbln(), scalblnf(), scalblnl(), scalbn(), scalbnf(), scalbnl()

When a correct value would cause an underflow, scalbln(), scalblnf(), scalblnl(), scalbn() , scalbnf() , and scalbnl() return 0.0.

sem_open()

When the name argument to sem_open() doesn't begin with a slash character, the semaphore is created with a name that consists of the specified name prepended with the current working directory.

Additional slash characters other than the leading slash character aren't interpreted, and the specified name, including these slash characters, is used to identify the semaphore.

setlocale()

Valid strings for the locale argument to setlocale() are:

  • "C"
  • "POSIX"
  • "C-TRADITIONAL"
  • ""
  • the name of a locale in the set of currently defined locales

When the locale string is set to "", the default native environment is the POSIX locale.

shm_open()

When the name argument doesn't begin with a slash, shm_open() creates or opens a shared memory object with the specified name relative to the current working directory of the calling process. This name appears in the file system and is visible to other functions that take pathnames as arguments.

Additional slash characters in the name cause the shared memory object be created with a pathname equivalent to name:

  • If there's an initial slash, this specifies an absolute pathname.
  • If there's no initial slash, this specifies a pathname relative to the current working directory.

The intermediate directories corresponding to each slash-separated component have only read and search permissions.

sigaction()

When SA_SIGINFO isn't set in the sa_flags member of the sigaction structure passed to sigaction() , the disposition of subsequent occurrences of a pending signal aren't affected.

signal()

If you've used signal() to register a function to handle a signal, then when the signal occurs, it's blocked.

SIGBUS may be generated for a misaligned memory access:

  • a 16-bit access using a pointer that isn't 16-bit aligned
  • a 32-bit access using a pointer that isn't 32-bit aligned

sigwait()

When there are multiple pending instances of a single signal number prior to a call to sigwait() , all but one of the pending instances remain pending after a successful return of the sigwait() function.

sin(), sinf(), sinl()

If x is +/-Inf, sin() , sinf() , and sinl() return NaN.

sqrt(), sqrtf(), sqrtl()

For finite values of x < -0, sqrt() , sqrtf() , and sqrtl() return NaN. The return value when x is -Inf is NaN.

stat()

No additional or alternative file access control mechanisms are provided, so there are no implementation-defined reasons for stat() to fail.

strtod(), strtof(), strtold()

The strtod(), strtof(), and strtold() functions don't interpret an n-char sequence, and the result is equivalent to specifying nan or NAN without the n-char sequence.

No other subject sequences beyond those specified are accepted.

strtol(), strtoll()

The strtol() and strtoll() don't accept any other subject sequences beyond those specified.

strtoul(), strtoull()

The strtoul() and strtoull() functions don't accept any other subject sequences beyond those specified by the standard.

tan(), tanf(), tanl()

For a correct value that would cause an underflow, tan() , tanf() , and tanl() return 0.0. The return value when x is +/-Inf is NaN.

tgamma(), tgammaf(), tgammal()

When x is a negative integer, tgamma(), tgammaf(), and tgammal() return NaN. The return value when x is -Inf is NaN.

timer_create()

The timer_create() function fails if the clock ID corresponds to the CPU-time clock of a process or thread different from the process or thread invoking the function.

tmpnam()

After TMP_MAX names have been generated, tmpnam() reuses names that have been previously generated:

  • If a file with the new name doesn't exist, the new name is returned.
  • If a file with the new name does exist, a default pathname with a basename of 000000 is returned.

tzset()

If the TZ environment variable isn't set when you call tzset() , the value of the implementation-defined _CS_TIMEZONE confstr() string is used as the default time zone.

If no _CS_TIMEZONE string is set, the default timezone UTC0 is used.

uname()

The communications network for the nodename reported by uname() is primarily a TCP/IP network.

If the networking server has QNX Neutrino Transparent Distributed Processing (Qnet) enabled, the nodename is used to identify the node within the network of nodes that are able to communicate via the Qnet protocol.

Each member of the utsname structure is a 257-byte array:

This member: Contains the:
sysname[] OS name: "QNX"
nodename[] Host name in an unspecified format
release[] OS release level " x.y.z "
version[] Build date of the OS kernel as generated by a date +%Y/%m/%d-%T%Z command
machine[] Name of the hardware platform, in an unspecified format
The official product name of the OS is QNX Neutrino, not simply QNX.

write()

When the value of nbyte is greater than SSIZE_MAX, the number of bytes written by the write() function is limited to LONG_MAXoffset, where offset is the current file offset.

An EIO error may be returned if the filesystem resides on a removable media device, and the media has been forcibly removed.