43 #include <sys/types.h> 48 __thread
uword __os_thread_index = 0;
55 if (stat (file, &s) < 0)
58 if (S_ISREG (s.st_mode))
74 if ((fd = open (file, 0)) < 0)
82 if ((n_read = read (fd, v + n_done, n_left)) < 0)
100 " `%s' expected to read %wd bytes; read only %wd",
101 file, n_bytes, n_bytes - n_left);
141 fd = open (file, O_RDONLY);
150 bytes = read (fd, rv + pos, 4096);
171 void os_panic (
void) __attribute__ ((weak));
179 void os_exit (
int) __attribute__ ((weak));
188 __attribute__ ((weak));
196 int fd = is_error ? 2 : 1;
197 struct iovec iovs[2];
202 snprintf (buf,
sizeof (buf),
"%d: ", cpu);
204 iovs[n_iovs].iov_base = buf;
205 iovs[n_iovs].iov_len = strlen (buf);
209 iovs[n_iovs].iov_base = string;
210 iovs[n_iovs].iov_len = string_length;
213 if (writev (fd, iovs, n_iovs) < 0)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
clib_error_t * unix_file_n_bytes(char *file, uword *result)
#define clib_error_return(e, args...)
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
#define clib_error_return_unix(e, args...)
#define vec_free(V)
Free vector's memory (no header).
uword os_get_nthreads(void)
clib_error_t * unix_file_contents(char *file, u8 **result)
void os_puts(u8 *string, uword string_length, uword is_error)
clib_error_t * unix_file_read_contents(char *file, u8 *result, uword n_bytes)
clib_error_t * unix_proc_file_contents(char *file, u8 **result)
static_always_inline uword os_get_thread_index(void)
void os_out_of_memory(void)