> +static int vm_drop_caches(void)
> +{
> + int fd;
> + int ret = EXIT_SUCCESS;
> +
> + fd = open("/proc/sys/vm/drop_caches", O_WRONLY);
> + if (fd < 0) {
> + ksft_perror("failed to open drop_caches");
> + return EXIT_FAILURE;
> + }
> +
> + if (write(fd, "3", 1) != 1) {
> + ksft_perror("failed to write to drop_caches");
> + ret = EXIT_FAILURE;
> + }
> +
> + if (close(fd) < 0) {
> + ksft_perror("failed to close drop_caches");
> + ret = EXIT_FAILURE;
> + }
> +
> + return ret;
> +}
Can we maybe factor out this function (now used in both patches) and reuse it?
--
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel