Specifications
The expectation is that this function is only called from within alt_sys_init(), that is, while the system
is running in single-threaded mode. Concurrent calls to this function might lead to unpredictable results.
Return
This function returns zero on success; otherwise it returns a negative value. The call can fail if a system
clock driver is already registered, or if no system clock device is available.
Related Information
• alt_alarm_start() on page 14-10
• alt_alarm_stop() on page 14-11
• alt_nticks() on page 14-46
• alt_tick() on page 14-48
• alt_ticks_per_second() on page 14-49
• gettimeofday() on page 14-72
• settimeofday() on page 14-61
• times() on page 14-67
• usleep() on page 14-70
open()
Prototype
int open (const char* pathname, int flags, mode_t mode)
Commonly Called By
C/C++ programs
Thread-safe
See description.
Available from ISR
No.
Include
<unistd.h>
<fcntl.h>
Description
The open() function opens a file or device and returns a file descriptor (a small, nonnegative integer for
use in read, write, etc.)
flags is one of: O_RDONLY, O_WRONLY, or O_RDWR, which request opening the file in read-only, write-only,
or read/write mode, respectively.
You can also bitwise-OR flags with O_NONBLOCK, which causes the file to be opened in nonblocking
mode. Neither open() nor any subsequent operation on the returned file descriptor causes the calling
process to wait.
14-66
open()
NII5V2
2015.05.14
Altera Corporation
HAL API Reference
Send Feedback