Searched refs:buf (Results 1 - 25 of 138) sorted by relevance

123456

/systemd/src/journal/
H A Dtest-compress-benchmark.c57 char *buf; local
60 buf = malloc(count);
61 assert_se(buf);
64 memzero(buf, count);
67 buf[i] = 'a' + i % ('z' - 'a' + 1);
71 random_bytes(buf, step);
72 memzero(buf + 1*step, step);
73 random_bytes(buf + 2*step, step);
74 memzero(buf + 3*step, step);
75 random_bytes(buf
92 _cleanup_free_ char *text, *buf; local
[all...]
H A Djournald-syslog.h26 size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid);
30 void server_process_syslog_message(Server *s, const char *buf, const struct ucred *ucred, const struct timeval *tv, const char *label, size_t label_len);
H A Dtest-journal-syslog.c27 const char *buf = str; local
31 ret2 = syslog_parse_identifier(&buf, &ident2, &pid2);
H A Dfsprg.c44 static void mpi_export(void *buf, size_t buflen, const gcry_mpi_t x) { argument
51 memzero(buf, buflen);
52 gcry_mpi_print(GCRYMPI_FMT_USG, buf + (buflen - len), len, &nwritten, x);
56 static gcry_mpi_t mpi_import(const void *buf, size_t buflen) { argument
60 gcry_mpi_scan(&h, GCRYMPI_FMT_USG, buf, buflen, NULL);
68 static void uint64_export(void *buf, size_t buflen, uint64_t x) { argument
70 ((uint8_t*) buf)[0] = (x >> 56) & 0xff;
71 ((uint8_t*) buf)[1] = (x >> 48) & 0xff;
72 ((uint8_t*) buf)[2] = (x >> 40) & 0xff;
73 ((uint8_t*) buf)[
80 uint64_import(const void *buf, size_t buflen) argument
94 det_randomize(void *buf, size_t buflen, const void *seed, size_t seedlen, uint32_t idx) argument
126 uint8_t buf[buflen]; local
146 uint8_t buf[buflen]; local
240 store_secpar(void *buf, uint16_t secpar) argument
246 read_secpar(const void *buf) argument
[all...]
/systemd/src/libsystemd-network/
H A Ddhcp6-option.c44 static int option_append_hdr(uint8_t **buf, size_t *buflen, uint16_t optcode, argument
46 DHCP6Option *option = (DHCP6Option*) *buf;
48 assert_return(buf, -EINVAL);
49 assert_return(*buf, -EINVAL);
58 *buf += sizeof(DHCP6Option);
64 int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code, argument
70 r = option_append_hdr(buf, buflen, code, optlen);
75 memcpy(*buf, optval, optlen);
77 *buf += optlen;
83 int dhcp6_option_append_ia(uint8_t **buf, size_ argument
141 option_parse_hdr(uint8_t **buf, size_t *buflen, uint16_t *optcode, size_t *optlen) argument
166 dhcp6_option_parse(uint8_t **buf, size_t *buflen, uint16_t *optcode, size_t *optlen, uint8_t **optvalue) argument
186 dhcp6_option_parse_ia(uint8_t **buf, size_t *buflen, uint16_t iatype, DHCP6IA *ia) argument
[all...]
H A Ddhcp6-internal.h60 int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code,
62 int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia);
63 int dhcp6_option_parse(uint8_t **buf, size_t *buflen, uint16_t *optcode,
65 int dhcp6_option_parse_ia(uint8_t **buf, size_t *buflen, uint16_t iatype,
/systemd/src/test/
H A Dtest-date.c28 char buf[FORMAT_TIMESTAMP_MAX], buf_relative[FORMAT_TIMESTAMP_RELATIVE_MAX], *sp; local
31 format_timestamp_us(buf, sizeof(buf), t);
32 log_info("%s", buf);
35 sp = strrchr(buf, ' ');
39 assert_se(parse_timestamp(buf, &q) >= 0);
44 assert_se(parse_timestamp(buf, &q) >= 0);
H A Dtest-strbuf.c48 l = strv_parse_nulstr(sb->buf, sb->len);
73 assert_se(streq(sb->buf + a, "waldo"));
74 assert_se(streq(sb->buf + b, "foo"));
75 assert_se(streq(sb->buf + c, "bar"));
76 assert_se(streq(sb->buf + d, "waldo"));
77 assert_se(streq(sb->buf + e, "aldo"));
78 assert_se(streq(sb->buf + f, "do"));
79 assert_se(streq(sb->buf + g, "waldorf"));
H A Dtest-copy.c36 _cleanup_free_ char *buf = NULL; local
54 assert_se(read_full_file(fn_copy, &buf, &sz) == 0);
55 assert_se(streq(buf, "foo bar bar bar foo\n"));
67 char buf[64] = {0}; local
79 assert_se(read(out_fd, buf, sizeof(buf)) == sizeof(text) - 1);
80 assert_se(streq(buf, text));
115 _cleanup_free_ char *buf = NULL; local
120 assert_se(read_full_file(f, &buf, &sz) == 0);
121 assert_se(streq(buf, "fil
144 char buf[1024], buf2[1024]; local
[all...]
H A Dtest-calendarspec.c31 char buf[FORMAT_TIMESTAMP_MAX]; local
43 printf("Next: %s\n", r < 0 ? strerror(-r) : format_timestamp(buf, sizeof(buf), u));
57 char buf[FORMAT_TIMESTAMP_MAX]; local
76 printf("At: %s\n", r < 0 ? strerror(-r) : format_timestamp_us(buf, sizeof(buf), u));
/systemd/src/basic/
H A Descape.c30 size_t cescape_char(char c, char *buf) { argument
31 char * buf_old = buf;
36 *(buf++) = '\\';
37 *(buf++) = 'a';
40 *(buf++) = '\\';
41 *(buf++) = 'b';
44 *(buf++) = '\\';
45 *(buf++) = 'f';
48 *(buf++) = '\\';
49 *(buf
[all...]
H A Dbarrier.c191 static bool barrier_write(Barrier *b, uint64_t buf) { argument
200 len = write(b->me, &buf, sizeof(buf));
203 if (len != sizeof(buf))
207 if (buf >= (uint64_t)BARRIER_ABORTION) {
213 b->barriers += buf;
239 uint64_t buf; local
252 len = read(b->them, &buf, sizeof(buf));
256 if (len != sizeof(buf))
[all...]
H A Dstdio-util.h29 #define xsprintf(buf, fmt, ...) \
30 assert_message_se((size_t) snprintf(buf, ELEMENTSOF(buf), fmt, __VA_ARGS__) < ELEMENTSOF(buf), "xsprintf: " #buf "[] must be big enough")
H A Dio-util.c37 char buf[LINE_MAX]; local
51 l = read(fd, buf, sizeof(buf));
66 ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) { argument
67 uint8_t *p = buf;
71 assert(buf);
113 int loop_read_exact(int fd, void *buf, size_t nbytes, bool do_poll) { argument
116 n = loop_read(fd, buf, nbytes, do_poll);
125 int loop_write(int fd, const void *buf, size_t nbytes, bool do_poll) { argument
126 const uint8_t *p = buf;
[all...]
H A Dtime-util.h93 char *format_timestamp(char *buf, size_t l, usec_t t);
94 char *format_timestamp_utc(char *buf, size_t l, usec_t t);
95 char *format_timestamp_us(char *buf, size_t l, usec_t t);
96 char *format_timestamp_us_utc(char *buf, size_t l, usec_t t);
97 char *format_timestamp_relative(char *buf, size_t l, usec_t t);
98 char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy);
116 #define xstrftime(buf, fmt, tm) \
117 assert_message_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0, \
118 "xstrftime: " #buf "[] mus
[all...]
H A Dstrbuf.c52 str->buf = new0(char, 1);
53 if (!str->buf)
63 free(str->buf);
93 free(str->buf);
153 if (depth == len || (node->value_len >= len && memcmp(str->buf + off, s, len) == 0)) {
171 buf_new = realloc(str->buf, str->len + len+1);
174 str->buf = buf_new;
176 memcpy(str->buf + off, s, len);
178 str->buf[str->len++] = '\0';
/systemd/src/libsystemd/sd-hwdb/
H A Dsd-hwdb.c64 static void linebuf_init(struct linebuf *buf) { argument
65 buf->size = 0;
66 buf->len = 0;
69 static const char *linebuf_get(struct linebuf *buf) { argument
70 if (buf->len + 1 >= sizeof(buf->bytes))
72 buf->bytes[buf->len] = '\0';
73 return buf->bytes;
76 static bool linebuf_add(struct linebuf *buf, cons argument
84 linebuf_add_char(struct linebuf *buf, char c) argument
91 linebuf_rem(struct linebuf *buf, size_t count) argument
96 linebuf_rem_char(struct linebuf *buf) argument
168 trie_fnmatch_f(sd_hwdb *hwdb, const struct trie_node_f *node, size_t p, struct linebuf *buf, const char *search) argument
202 struct linebuf buf; local
[all...]
/systemd/src/udev/collect/
H A Dcollect.c88 char buf[512]; local
95 xsprintf(buf, "%s/%s", dir, filename);
97 fd = open(buf,O_RDWR|O_CREAT|O_CLOEXEC, S_IRUSR|S_IWUSR);
99 fprintf(stderr, "Cannot open %s: %m\n", buf);
108 fprintf(stderr, "Acquired lock on %s\n", buf);
111 fprintf(stderr, "Could not get lock on %s: %m\n", buf);
136 char *buf, *ptr, *word = NULL; local
141 buf = malloc(bufsize + 1);
142 if (!buf)
144 memset(buf, ' ', bufsiz
281 char *buf; local
[all...]
/systemd/src/bootchart/
H A Dstore.c61 static char *bufgetline(char *buf) { argument
64 if (!buf)
67 c = strchr(buf, '\n');
105 char buf[4096]; local
138 n = pread(vmstat, buf, sizeof(buf) - 1, 0);
146 buf[n] = '\0';
148 m = buf;
198 n = pread(e_fd, buf, sizeof(buf)
[all...]
/systemd/src/core/
H A Dsmack-setup.c45 char buf[NAME_MAX]; local
99 FOREACH_LINE(buf, policy,
105 if (isempty(truncate_nl(buf)))
110 if (sscanf(buf, "%ms %ms %ms %ms", &sbj, &obj, &acc1, &acc2) < 3) {
111 log_error_errno(errno, "Failed to parse rule '%s' in '%s', ignoring.", buf, entry->d_name);
115 if (write(isempty(acc2) ? load2_fd : change_fd, buf, strlen(buf)) < 0) {
119 buf, isempty(acc2) ? "/sys/fs/smackfs/load2" : "/sys/fs/smackfs/change-rule", entry->d_name);
131 char buf[NAME_MAX]; local
178 FOREACH_LINE(buf, polic
202 char buf[NAME_MAX]; local
[all...]
/systemd/src/random-seed/
H A Drandom-seed.c38 _cleanup_free_ void* buf = NULL; local
69 buf = malloc(buf_size);
70 if (!buf) {
116 k = loop_read(seed_fd, buf, buf_size, false);
125 r = loop_write(random_fd, buf, (size_t) k, false);
158 k = loop_read(random_fd, buf, buf_size, false);
169 r = loop_write(seed_fd, buf, (size_t) k, false);
/systemd/src/libsystemd/sd-id128/
H A Dsd-id128.c113 char buf[33]; local
129 r = loop_read_exact(fd, buf, 33, false);
132 if (buf[32] !='\n')
138 a = unhexchar(buf[j*2]);
139 b = unhexchar(buf[j*2+1]);
158 char buf[36]; local
175 r = loop_read_exact(fd, buf, 36, false);
179 for (j = 0, p = buf; j < 16; j++) {
182 if (p >= buf + 35)
187 if (p >= buf
[all...]
/systemd/src/boot/efi/
H A Dutil.c95 EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, CHAR16 *name, CHAR8 *buf, UINTN size, BOOLEAN persistent) { argument
102 return uefi_call_wrapper(RT->SetVariable, 5, name, (EFI_GUID *)vendor, flags, size, buf);
117 CHAR8 *buf; local
122 err = efivar_get_raw(&loader_guid, name, &buf, &size);
126 val = StrDuplicate((CHAR16 *)buf);
128 FreePool(buf);
149 CHAR8 *buf; local
154 buf = AllocatePool(l);
155 if (!buf)
158 err = uefi_call_wrapper(RT->GetVariable, 5, name, (EFI_GUID *)vendor, NULL, &l, buf);
308 CHAR8 *buf; local
[all...]
/systemd/src/journal-remote/
H A Djournal-upload-journal.c30 * Write up to size bytes to buf. Return negative on error, and number of
33 static ssize_t write_entry(char *buf, size_t size, Uploader *u) { argument
49 r = snprintf(buf + pos, size - pos,
59 buf[size - 1] = '\n';
73 r = snprintf(buf + pos, size - pos,
83 buf[size - 1] = '\n';
98 r = snprintf(buf + pos, size - pos,
108 buf[size - 1] = '\n';
123 r = snprintf(buf + pos, size - pos,
133 buf[siz
245 journal_input_callback(void *buf, size_t size, size_t nmemb, void *userp) argument
[all...]
/systemd/src/shared/
H A Defivars.c206 _cleanup_free_ void *buf = NULL; local
234 buf = malloc(st.st_size - 4 + 2);
235 if (!buf)
238 n = read(fd, buf, (size_t) st.st_size - 4);
245 ((char*) buf)[st.st_size - 4] = 0;
246 ((char*) buf)[st.st_size - 4 + 1] = 0;
248 *value = buf;
249 buf = NULL;
266 char buf[]; member in struct:var
267 } _packed_ * _cleanup_free_ buf local
353 _cleanup_free_ uint8_t *buf = NULL; local
485 _cleanup_free_ char *buf = NULL; local
546 _cleanup_free_ void *buf = NULL; local
[all...]

Completed in 71 milliseconds

123456