/samples/hidraw/ |
D | hid-example.c | 46 char buf[256]; in main() local 65 memset(buf, 0x0, sizeof(buf)); in main() 87 res = ioctl(fd, HIDIOCGRAWNAME(256), buf); in main() 91 printf("Raw Name: %s\n", buf); in main() 94 res = ioctl(fd, HIDIOCGRAWPHYS(256), buf); in main() 98 printf("Raw Phys: %s\n", buf); in main() 113 buf[0] = 0x9; /* Report Number */ in main() 114 buf[1] = 0xff; in main() 115 buf[2] = 0xff; in main() 116 buf[3] = 0xff; in main() [all …]
|
/samples/kfifo/ |
D | record-example.c | 73 char buf[100]; in testfunc() local 76 struct { unsigned char buf[6]; } hello = { "hello" }; in testfunc() member 87 memset(buf, 'a' + i, i + 1); in testfunc() 88 kfifo_in(&test, buf, i + 1); in testfunc() 98 ret = kfifo_out_peek(&test, buf, sizeof(buf)); in testfunc() 100 printk(KERN_INFO "%.*s\n", ret, buf); in testfunc() 105 ret = kfifo_out(&test, buf, sizeof(buf)); in testfunc() 106 buf[ret] = '\0'; in testfunc() 107 printk(KERN_INFO "item = %.*s\n", ret, buf); in testfunc() 108 if (strcmp(buf, expected_result[i++])) { in testfunc() [all …]
|
D | bytestream-example.c | 56 unsigned char buf[6]; in testfunc() local 73 i = kfifo_out(&test, buf, 5); in testfunc() 74 printk(KERN_INFO "buf: %.*s\n", i, buf); in testfunc() 77 ret = kfifo_out(&test, buf, 2); in testfunc() 80 ret = kfifo_in(&test, buf, ret); in testfunc() 115 static ssize_t fifo_write(struct file *file, const char __user *buf, in fifo_write() argument 124 ret = kfifo_from_user(&test, buf, count, &copied); in fifo_write() 133 static ssize_t fifo_read(struct file *file, char __user *buf, in fifo_read() argument 142 ret = kfifo_to_user(&test, buf, count, &copied); in fifo_read()
|
D | inttype-example.c | 56 int buf[6]; in testfunc() local 70 ret = kfifo_out(&test, buf, 2); in testfunc() 73 ret = kfifo_in(&test, buf, ret); in testfunc() 108 static ssize_t fifo_write(struct file *file, const char __user *buf, in fifo_write() argument 117 ret = kfifo_from_user(&test, buf, count, &copied); in fifo_write() 126 static ssize_t fifo_read(struct file *file, char __user *buf, in fifo_read() argument 135 ret = kfifo_to_user(&test, buf, count, &copied); in fifo_read()
|
/samples/kobject/ |
D | kobject-example.c | 31 char *buf) in foo_show() argument 33 return sprintf(buf, "%d\n", foo); in foo_show() 37 const char *buf, size_t count) in foo_store() argument 41 ret = kstrtoint(buf, 10, &foo); in foo_store() 57 char *buf) in b_show() argument 65 return sprintf(buf, "%d\n", var); in b_show() 69 const char *buf, size_t count) in b_store() argument 73 ret = kstrtoint(buf, 10, &var); in b_store()
|
D | kset-example.c | 42 ssize_t (*show)(struct foo_obj *foo, struct foo_attribute *attr, char *buf); 43 ssize_t (*store)(struct foo_obj *foo, struct foo_attribute *attr, const char *buf, size_t count); 56 char *buf) in foo_attr_show() argument 67 return attribute->show(foo, attribute, buf); in foo_attr_show() 76 const char *buf, size_t len) in foo_attr_store() argument 87 return attribute->store(foo, attribute, buf, len); in foo_attr_store() 115 char *buf) in foo_show() argument 117 return sprintf(buf, "%d\n", foo_obj->foo); in foo_show() 121 const char *buf, size_t count) in foo_store() argument 125 ret = kstrtoint(buf, 10, &foo_obj->foo); in foo_store() [all …]
|
/samples/seccomp/ |
D | bpf-fancy.c | 33 char buf[256]; in main() local 47 JNE((unsigned long)buf, DENY), in main() 49 JGE(sizeof(buf), DENY), in main() 62 JEQ((unsigned long)buf, JUMP(&l, buf_len)), in main() 77 JLT(sizeof(buf), ALLOW), in main() 97 bytes = syscall(__NR_read, STDIN_FILENO, buf, sizeof(buf)-1); in main() 100 syscall(__NR_write, STDERR_FILENO, buf, bytes); in main()
|
D | bpf-direct.c | 65 char *buf; in emulator() local 73 buf = (char *) ctx->uc_mcontext.gregs[REG_ARG1]; in emulator() 83 bytes = write(STDOUT_FILENO, buf, len); in emulator() 165 char buf[4096]; in main() local 173 bytes = syscall(__NR_read, STDIN_FILENO, buf, sizeof(buf)); in main() 175 syscall(__NR_write, STDOUT_FILENO, buf, bytes); in main()
|
/samples/bpf/ |
D | bpf_load.c | 53 char buf[256]; in load_and_attach() local 105 snprintf(buf, sizeof(buf), in load_and_attach() 108 err = system(buf); in load_and_attach() 116 strcpy(buf, DEBUGFS); in load_and_attach() 117 strcat(buf, "events/kprobes/"); in load_and_attach() 118 strcat(buf, event); in load_and_attach() 119 strcat(buf, "/id"); in load_and_attach() 121 efd = open(buf, O_RDONLY, 0); in load_and_attach() 127 err = read(efd, buf, sizeof(buf)); in load_and_attach() 128 if (err < 0 || err >= sizeof(buf)) { in load_and_attach() [all …]
|
D | trace_output_user.c | 70 char buf[256]; in perf_event_read() local 89 memcpy(buf, begin, len); in perf_event_read() 90 memcpy(buf + len, base, e->header.size - len); in perf_event_read() 91 e = (void *) buf; in perf_event_read()
|
D | bpf_helpers.h | 32 static int (*bpf_get_current_comm)(void *buf, int buf_size) =
|
/samples/uhid/ |
D | uhid-example.c | 302 char buf[128]; in keyboard() local 305 ret = read(STDIN_FILENO, buf, sizeof(buf)); in keyboard() 315 switch (buf[i]) { in keyboard() 379 fprintf(stderr, "Invalid input: %c\n", buf[i]); in keyboard()
|