43 #include <sys/types.h> 52 if (stat (file, &s) < 0)
55 if (S_ISREG (s.st_mode))
70 if ((fd = open (file, 0)) < 0)
78 if ((n_read = read (fd, v + n_done, n_left)) < 0)
95 file, n_bytes, n_bytes - n_left);
133 fd = open (file, O_RDONLY);
142 bytes = read(fd, rv+pos, 4096);
163 void os_panic (
void) __attribute__ ((weak));
167 void os_exit (
int) __attribute__ ((weak));
173 __attribute__ ((weak));
180 int fd = is_error ? 2 : 1;
181 struct iovec iovs[2];
186 snprintf (buf,
sizeof(buf),
"%d: ", cpu);
188 iovs[n_iovs].iov_base = buf;
189 iovs[n_iovs].iov_len = strlen (buf);
193 iovs[n_iovs].iov_base = string;
194 iovs[n_iovs].iov_len = string_length;
197 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 vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
clib_smp_main_t clib_smp_main
#define clib_error_return_unix(e, args...)
always_inline uword os_get_cpu_number_inline(void)
#define vec_free(V)
Free vector's memory (no header).
uword os_get_cpu_number(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)
#define clib_error_return(e, args...)
void os_out_of_memory(void)