This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
This appendix lists the QNX 4 C library functions along with their QNX Neutrino equivalents. For functions that have no direct replacement, you'll find either a cover function or a suggested workaround.
Use these links to find a function quickly:
A | B | C | D | E | F | G | H | I | K | L | |
M | N | O | P | Q | R | S | T | U | V | W | Y |
This call is a drop-in replacement.
QNX Neutrino doesn't support segment-based functions.
A thread in QNX 4 is really just a separate process that shares the data segment of its parent, whereas a thread in QNX Neutrino is really within the same process as its parent and shares a great deal more. |
QNX Neutrino doesn't support segment-based functions. You can use realloc() in place of this, but beware that realloc() will move your memory block to a new address if needed, and _bexpand() will fail rather than move your memory block to a new address. |
QNX Neutrino doesn't support segment-based functions.
QNX Neutrino doesn't support segment-based functions.
QNX Neutrino doesn't support segment-based functions.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
readblock(filedes, 512, block - 1, nblocks, buf)
The block number has been changed from 1-based to 0-based. |
writeblock(filedes, 512, block - 1, nblocks, buf)
The block number has been changed from 1-based to 0-based. When applied to a regular file, the QNX 4 block_write() would never grow the file; the writeblock() function may cause a regular file to be extended if writing occurs beyond the end-of-file. Note that the cover function in the migration library calls writeblock(). |
QNX Neutrino doesn't support segment-based functions.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
QNX Neutrino doesn't support segment-based functions.
The following functions aren't in the migration library:
QNX 4 function: | QNX Neutrino equivalent: |
---|---|
_CA_PCI_BIOS_Present() | pci_present() |
_CA_PCI_Find_Class() | pci_find_class() |
_CA_PCI_Find_Device() | pci_find_device() |
_CA_PCI_Generate_Special_Cycle() | No longer supported |
_CA_PCI_Read_Config_Byte() | pci_read_config8() |
_CA_PCI_Read_Config_DWord() | pci_read_config32() |
_CA_PCI_Read_Config_Word() | pci_read_config16() |
_CA_PCI_Write_Config_Byte() | pci_write_config8() |
_CA_PCI_Write_Config_DWord() | pci_write_config32() |
_CA_PCI_Write_Config_Word() | pci_write_config16() |
event.sigev_notify = SIGEV_UNBLOCK; TimerTimeout(CLOCK_REALTIME, _NTO_TIMEOUT_RECEIVE, &event, NULL, NULL );
event.sigev_notify = SIGEV_UNBLOCK; TimerTimeout(CLOCK_REALTIME, _NTO_TIMEOUT_RECEIVE, &event, NULL, NULL );
The QNX Neutrino version is Unix-compatible. For the QNX 4 version, qnx_crypt().
Not all event types are supported. For _DEV_EVENT_HANGUP, consider setting up a controlling terminal and handle SIGHUP. For _DEV_EVENT_WINCH, consider using SIGWINCH.
You can't get all the information, but you can get bits and pieces elsewhere.
You can't get all the information, but you can get bits and pieces elsewhere.
You can implement some of this by using readcond() and ionotify(). The readcond() can handle the cases where proxy == 0. The ionotify() in conjunction with pulses (signals are even easier) can handle the cases where proxy != 0 and min, time, and timeout are all 0.
For equivalent functionality to min, time, and timeout combined with a pulse or signal for notification, create a separate thread that requests pulse notification using ionotify(). Set up another pulse notification for the timeout. Then go into a MsgReceive() loop with with a TimerTimeout() call before the MsgReceive() call for the interbyte time. Deliver a pulse or set a signal when the min, time or timeout condition is satisfied.
The cover function doesn't handle the proxy and armed parameters. |
You can use devctl() with DCMD_CHR_GETOBAND in place of this for getting out-of-band data from resource managers that support it. Currently, only devc-* resource managers support this.
There's no equivalent way of directly setting these states:
See <sys/dcmd_cam.h> and <sys/cam_device.h>. Although a cover function is provided in the migration library, you might want to use the direct devctl()s that build this -- they're more useful and have better field definitions (e.g. "cylinders" in QNX Neutrino is 32-bit, but only 16-bit in QNX 4, and large EIDE disks have already wrapped this due to geometry translation).
Although a cover function is provided in the migration library, you might want to switch directly to statvfs() because it has additional fields that may be useful (block size, mount flags, etc.).
You can use realloc() in place of this, but beware that realloc() will move your memory block to a new address if needed, and _expand() will fail rather than move your memory block to a new address. |
You can use realloc() in place of this, but beware that realloc() will move your memory block to a new address if needed, and _expand() will fail rather than move your memory block to a new address.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
You can do this with:
fstat(fd, &st);
followed by:
return(S_ISBLK(st.st_mode) ? st.st_nblocks * st.st_blocksize : st.st_size);
A little more may be needed for 64-bit support.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
Use sopen(), which returns a file descriptor, then use fdopen() to associate a stream with it.
The following functions aren't in the migration library:
QNX 4 function: | QNX Neutrino equivalent: |
---|---|
_fstrcat() | strcat() |
_fstrchr() | strchr() |
_fstrcmp() | strcmp() |
_fstrcpy() | strcpy() |
_fstrcspn() | strcspn() |
_fstrdup() | strdup() |
_fstricmp() | strcmp() |
_fstrlen() | strlen() |
_fstrlwr() | strlwr() |
_fstrncat() | strncat() |
_fstrncmp() | strncmp() |
_fstrncpy() | strncpy() |
_fstrnicmp() | strnicmp() |
_fstrnset() | strnset() |
_fstrpbrk() | strpbrk() |
_fstrrchr() | strrchr() |
_fstrrev() | strrev() |
_fstrset() | strset() |
_fstrspn() | strspn() |
_fstrstr() | strstr() |
_fstrtok() | strtok() |
_fstrupr() | strupr() |
The filesystem doesn't provide the information because the QNX Neutrino io-blk doesn't give preferential treatment to any particular disk format.
You can use the devctl() command DCMD_FSYS_MOUNTED_ON to get this information, but it must be sent as part of a combine message. See the source for fsys_get_mount_dev() in the migration library for code for doing this.
You can use the devctl() command DCMD_FSYS_MOUNTED_BY to get this information, but it must be sent as part of a combine message. See the source for fsys_get_mount_pt() in the migration library for code for doing this.
The filesystem doesn't provide the information because the QNX Neutrino io-blk doesn't give preferential treatment to any particular disk format.
Unlike QNX 4, QNX Neutrino doesn't use node IDs (nids). Instead, nodes on a network have names. To get the name of the caller's node, use netmgr_ndtostr() with the nd parameter set to ND_LOCAL_NODE.
The migration library has a getnid() function that returns whatever was passed to mig4nto-procmgr via the -n option.
The getwd() function requires a preallocated buffer, whereas getcwd() will allocate one if it's passed NULL for the buffer. The getcwd() function also has a size parameter. For portability, use getcwd() instead of getwd().
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
For the dcmds to use with QSS-supplied resource managers, see <sys/dcmd_*.h>.
You should call mmap_device_io() before calling the port I/O functions. |
You should call mmap_device_io() before calling the port I/O functions. |
You should call mmap_device_io() before calling the port I/O functions. |
Replace with an expression using isalpha(), isdigit() and testing for the underscore character.
Replace with an expression using isalpha() and testing for the underscore character.
This is supported, but its prototype has changed. |
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
You can use realloc() in place of this, but beware that realloc() will move your memory block to a new address if needed, and _nexpand() will fail rather than move your memory block to a new address.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
See the malloc_g library described in the "Heap Analysis" chapter in Programmer's Guide.
You should call mmap_device_io() before calling the port I/O functions. |
You should call mmap_device_io() before calling the port I/O functions. |
You should call mmap_device_io() before calling the port I/O functions. |
Alternate method: simply open /dev/tty and use putc().
The resource manager library removes the need for this.
The resource manager library removes the need for this.
There may be something later.
Use realpath() followed by a call to netmgr_ndtostr() to get the node name.
Currently, there's no way of getting the time from another node in a native QNX network. Use clock_gettime() to get the time on the local node.
See the section on "Getting process information" in the Programming Issues chapter in this guide.
For the dcmds to use with QSS-supplied resource managers, see <sys/dcmd_*.h>.
For the dcmds to use with QSS-supplied resource managers, see <sys/dcmd_*.h>.
If you're not using the migration library and you're using QNX Neutrino, then use name_attach() or write resource managers.
For some other methods that the sender can use to find the receiver, see the section on "How does the sender find the receiver?" in the Programming Issues chapter in this guide.
If you're not using the migration library and you're replacing qnx_name_attach() with name_attach(), then use name_detach().
If you're not using the migration library and you're using QNX Neutrino, then use name_attach() or write resource managers.
For some other methods that the sender can use to find the receiver, see the section on "How does the sender find the receiver?" in the Programming Issues chapter in this guide.
The migration library has a qnx_name_query() function for querying the names registered using the qnx_name_attach() migration library function.
Find out the name of your network directory by calling netmgr_ndtostr() with ND_LOCAL_NODE for the nd parameter. Then walk through the network directory using readdir(). The nodes listed are those that are up.
See the section on "Getting system information" in the Programming Issues chapter in this guide.
QNX Neutrino doesn't have as many hard limits as QNX 4, but instead keeps allocating memory until it runs out. Some limits can be found out by calling sysconf().
See the section on "Process flags" in the Programming Issues chapter in this guide.
If you were using this function just to put a name in the prefix table so that other processes could find yours, then use name_attach() instead (QNX Neutrino).
If you were using this function in an I/O manager that handled _IO_* messages, then you need to convert to the resource manager library.
If you were using this function to create an alias, then use pathmgr_symlink() instead.
If you're using name_attach() to register a name (QNX Neutrino), then use name_detach() to detach it.
If you're writing a resource manager and had attached the name via resmgr_attach(), then use resmgr_detach() to detach it.
If you wanted to remove a symlink created using pathmgr_symlink(), then use pathmgr_unlink() or unlink() instead.
QNX Neutrino doesn't have the concept of a network root.
For the names that are associated with a resource manager, you can walk through the directory structure under /proc/mount. The numbers shown refer to a resource manager and are nd,pid,chid,handle,type where the type is one of the _FTYPE_* macros in <sys/ftype.h>. Names that are the equivalent of replacements (or aliases) aren't visible in QNX Neutrino.
QNX Neutrino doesn't have the concept of a network root.
If you're not using the migration library, then consider replacing proxies with pulses.
If you're not using the migration library and you're replacing qnx_proxy_attach() with pulses, then you may need to detach the connection for delivering the pulse.
If you're not using the migration library, then consider replacing proxies with pulses.
If you're not using the migration library and you're replacing qnx_proxy_rem_attach() with pulses, then you may need to detach the connection for delivering the pulse.
See the section on "Getting system information" in the Programming Issues chapter in this guide.
Currently, there's no way to do this across the network.
See shm_open(), ftruncate(), and mmap().
See shm_open(), ftruncate(), and mmap().
See mmap().
See munmap() and shm_unlink().
To get a physical address, use posix_mem_offset().
See mmap_device_memory() or mmap().
See mmap_device_memory() or mmap().
Create a shared memory object and use shm_ctl() to both set its size and to create it as contiguous. If the process dies, then as long as you don't do shm_unlink() the memory will still be set aside. To get a physical address, use posix_mem_offset().
To return memory allocated as detailed above under qnx_segment_raw_alloc(), close() the file descriptor, munmap() the memory, and call shm_unlink().
There's no equivalent function for adding memory that wasn't reported by the BIOS. However, this sort of thing can be done using the -M option to startup-* (Utilities reference) or from the startup code using add_mem() (see Building Embedded Systems in the Embedding SDK package).
You can grow shared memory at any time. You can shrink it only to 0 bytes and only when no other process has it mapped. Shrinking it to other sizes may be implemented in a future release.
Currently, there's no way to do this across the network.
To obtain the equivalent of most of these flags, see the source for qnx_osinfo() in the migration library.
See the section on "Process issues" in the Programming Issues chapter in this guide.
These functions don't synchronize a filesystem on another node of the network. |
This behaves like qnx_ticksize() with the _TICKSIZE_CLOSEST flag.
Consider using syslog() for logging instead.
Consider using syslog() for logging instead.
Consider using syslog() for logging instead.
Consider using syslog() for logging instead.
Consider using syslog() for logging instead.
Consider using syslog() for logging instead.
There's no way to set the umask of another process, but you can use umask() to set the umask for the caller.
This is the equivalent of doing open() (or name_open()) of a name that is registered by a process on another node via resmgr_attach() (or name_attach()).
See the various docs on QNX Neutrino native networking for similar options.
Call this function with the receive ID returned from MsgReceive() instead of a process ID. |
Call this function with the receive ID returned from MsgReceive() instead of a process ID. |
Call this function with a channel ID returned from ChannelCreate() instead of a process ID. |
For more information, see the section on "Channel IDs vs process IDs" in the Programming Issues chapter in this guide.
Call this function with a channel ID returned from ChannelCreate() instead of a process ID. |
For more information, see the section on "Channel IDs vs process IDs" in the Programming Issues chapter in this guide.
Call this function with the receive ID returned from MsgReceive() instead of a process ID. |
Call this function with the receive ID returned from MsgReceive() instead of a process ID. |
The searchenv() function doesn't search in the current directory unless it's specified in the given environment variable. |
This function takes a connection ID (coid) instead of a process ID. You can get this coid (a file descriptor) from open() or ConnectAttach(..., _NTO_SIDE_CHANNEL, ...). |
For more information, see the section on "Channel IDs vs process IDs" in the Programming Issues chapter in this guide.
This function takes a file descriptor (which is also a connection ID in QNX Neutrino). |
For more information, see the section on "Channel IDs vs process IDs" in the Programming Issues chapter in this guide.
This function takes a file descriptor (which is also a connection ID in QNX Neutrino). |
For more information, see the section on "Channel IDs vs process IDs" in the Programming Issues chapter in this guide.
This function takes a connection ID (coid) instead of a process ID. You can get this coid (a file descriptor) from open() or ConnectAttach(..., _NTO_SIDE_CHANNEL, ...). |
For more information, see the section on "Channel IDs vs process IDs" in the Programming Issues chapter in this guide.
This is available in the C++ library (posted as free software for QNX Neutrino).
This is available in the C++ library (posted as free software for QNX Neutrino).
Although there's no equivalent function for this, the first tty that is opened without O_NOCTTY after a call to setsid() and that doesn't already have a controlling process will cause the calling process to be the controlling process for this tty.
The following functions have no QNX Neutrino equivalent, and aren't in the migration library; use ncurses instead.
term_attr_type()
term_axis()
term_bar()
term_box()
term_box_fill()
term_box_off()
term_box_on()
term_clear()
term_color()
term_cur()
term_delete_char()
term_delete_line()
term_down()
term_field()
term_fill()
term_flush()
term_get_line()
term_home()
term_init()
term_insert_char()
term_insert_line()
term_insert_off()
term_insert_on()
term_key()
term_left()
term_lmenu()
term_load()
term_menu()
term_mouse_default()
term_mouse_flags()
term_mouse_handler()
term_mouse_hide()
term_mouse_move()
term_mouse_off()
term_mouse_on()
term_mouse_process()
term_printf()
term_receive()
term_relearn_size()
term_resize_off()
term_resize_on()
term_restore()
term_restore_image()
term_right()
term_save_image()
term_scroll_down()
term_scroll_up()
term_setup()
term_type()
term_unkey()
term_up()
term_video_off()
term_video_on()
term_window_scan()
QNX Neutrino has true POSIX threads. See the pthread_*() functions (specifically, pthread_create()) as a starting point.
The QNX 4 version was based on a draft standard. In QNX Neutrino, the timer ID is returned through the third parameter, and the sigevent structure is filled in differently.
The following functions have no QNX Neutrino equivalent, and aren't in the migration library; consider using syslog() for logging instead:
Trace0()
Trace0b()
Trace1()
Trace2()
Trace2b()
Trace3()
Trace4()
Trace4b()
Trace5()
Trace5b()
Trace6()
Trace6b()
Proxies have been replaced by pulses. See the section on "Proxies vs pulses" in the chapter on Programming Issues in this guide.
The migration library Trigger() function works the same as the QNX 4 one, but it's slower if the "triggerer" is in a different process than that which the proxy is attached to. For details, see the Trigger() function in the Migration Library chapter in this guide.
This is supported, but it now has unused flags parameters.
This function takes the receive ID returned from MsgReceive() instead of a process ID. |
This function takes the receive ID returned from MsgReceive() instead of a process ID. |