Introduction
Static Definition
Blocking Definition
A blocking function is one which will pause until the criteria of the function is met. A non-blocking function will perform the operation requested if possible, but will not wait until the function is possible to carry out. An example is the reading of a port. If a blocking instruction tries to read from a port and no data is available, it will wait or block. If data is available, it will perform the read. If a non-blocking instruction tries to read a port, if no data is available, it will normally return an error or status indicator and allow the program to continue.
This section will start with a description of the Portable Operating System Interface (POSIX). The reason for the POSIX standards is to make source code portable between various operating system platforms. The POSIX standards are produced by the Institute of Electrical and Electronics Engineers (IEEE). The standards are standardized by the International Organization for Standardization (ISO) and American National Standards Institute (ANSI).
POSIX Numbering
| standard | New Document # | ISO Number | Description |
| POSIX.1 | 1003.1 | ISO 9945-1 | Basic Interfaces |
| POSIX.1a | 1003.1 | | Extensions |
| POSIX.2 | 1003.1 | ISO | Commands |
| POSIX.3 | 1003.1 | | Test methods |
| POSIX.4 | 1003.1b | | Real time |
| POSIX.4a | 1003.1c | | Threads |
| POSIX.4b | 1003.1d | | More Real time |
| POSIX.5 | 1003.1 | | ADA Binding |
| POSIX.6 | 1003.1e | | Security |
| POSIX.7 | 1003.1 | | System Administration |
| POSIX.8 | 1003.1f | | Network File Access |
| POSIX.9 | 1003.1 | | Fortran-77 Binding |
| POSIX.10 | 1003.1 | | Supercomputing |
| POSIX.12 | 1003.1g | | Sockets |
| POSIX.13 | 1003.1 | | Real Time Profiles |
| POSIX.15 | 1003.1 | | Batch/supercomputer extensions |
| POSIX.17 | IEEE 1224.2 | | Network Directory/name services |
POSIX depends on:
|
|
- A compiler
- Headers usually in /usr/include
- Libraries
- An operating system that supports real time applications
POSIX Functionality
POSIX.1 Options
- _POSIX_JOB_CONTROL - setpgid, tcgetgrp, tcsetpgrp
- _POSIX_CHOWN_RESTRICTED - The ability to do a chown function is more restrictive
- _POSIX_SAVED_IDS - A saved set-user-id and set-group-id are maintained by processes. Affects setgid, kill, fork, and setuid.
- _POSIX_NO_TRUNC - Pathnames that are too long are not truncated but cause an error.
- _POSIX_VDISABLE - Some special terminal characters can be disabled.
- NGROUPS_MAX - Supplementary group IDs for each process can exist which may help determine file access permission.
POSIX.4 - The first item is required for POSIX.4 and the rest are options
- Real time queued signals. SA_SIGINFO, SIGRTMIN, SIGRTMAX
- _POSIX_REALTIME_SIGNALS - sigtimedwait, sigqueus, sigwaitinfo
- _POSIX_PRIORITY_SCHEDULING - sched_getparam, sched_setparam, sched_getscheduler, sched_setscheduler, sched_rr_get_interval, sched_get_priority_min, sched_get_priority_max, sched_yield
- _POSIX_TIMERS - clock_gettime, clock_settime, timer_gettime, timer_settime,clock_getres, timer_create, timer_delete, timer_getoverrun, nanosleep
- _POSIX_ASYNCHRONOUS_IO - air_read, air_write, aio_error, aio_fsync, aio_cancel, aio_return, aio_suspend, lio_listio
- _POSIX_PRIORITIZED_IO - Sets priorities for asynchronous I/O
- _POSIX_SYNCHRONIZED_IO - If _POSIX_MAPPED_FILES (msync, fdatasync).
- _POSIX_FSYNC - fsync
- _POSIX_MAPPED_FILES - If _POSIX_SYNCHRONIZED_IO (mmap, munmap, msync, ftruncate)
- _POSIX_MEMLOCK - mlockall, munlockall
- _POSIX_MEMLOCK_RANGE - mlock, munlock
- _POSIX_MEMORY_PROTECTION - mprotect
- _POSIX_MESSAGE_PASSING - mq_getattr, mqset_attr, mq_open, mq_close, mq_notify, mq_send, mq_receive, mq_unlink
- _POSIX_SEMAPHORES - sem_close, sem_destroy, sem_init, sem_open, sem_trywait, sem_unlink, sem_wait, sem_getvalue, sem_post.
- _POSIX_SHARED_MEMORY_OBJECTS - mmap, munmap, sbm_close, sbm_open, ftruncate, sbm_unlink.
The line:
#define _POSIX_SOURCE
Indicates that the program is POSIX.1 compliant, the 1990 version of POSIX. The line:
#define _POSIX_C_SOURCE 199309
Indicates the program is POSIX.4 compliant. These lines mean only POSIX functions and symbols are used.
|