43 #include <sys/types.h> 53 if (stat (file, &s) < 0)
56 if (S_ISREG (s.st_mode))
72 if ((fd = open (file, 0)) < 0)
80 if ((n_read = read (fd, v + n_done, n_left)) < 0)
98 " `%s' expected to read %wd bytes; read only %wd",
99 file, n_bytes, n_bytes - n_left);
139 fd = open (file, O_RDONLY);
148 bytes = read (fd, rv + pos, 4096);
169 void os_panic (
void) __attribute__ ((weak));
177 void os_exit (
int) __attribute__ ((weak));
186 __attribute__ ((weak));
194 int fd = is_error ? 2 : 1;
195 struct iovec iovs[2];
200 snprintf (buf,
sizeof (buf),
"%d: ", cpu);
202 iovs[n_iovs].iov_base = buf;
203 iovs[n_iovs].iov_len = strlen (buf);
207 iovs[n_iovs].iov_base = string;
208 iovs[n_iovs].iov_len = string_length;
211 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...
#define clib_error_return_unix(e, args...)
#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)