-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add and use run_command_strbuf #4331
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The LLVM template is first echo-ed into command_out and then command_out executed. The echo surrounds the template with double quotes, however, the template itself may contain quotes. This is generally innocuous but in tools/perf/tests/bpf-script-test-prologue.c we see: ... SEC("func=null_lseek file->f_mode offset orig") ... where the first double quote ends the double quote of the echo, then the > redirects output into a file called f_mode. To avoid this inadvertent behavior substitute redirects and similar characters to be ASCII control codes, then substitute the output in the echo back again. Fixes: 5eab5a7 ("perf llvm: Display eBPF compiling command in debug output") Signed-off-by: Ian Rogers <irogers@google.com>
Move strbuf, appendable C strings, to libapi so that other libraries may use it. Signed-off-by: Ian Rogers <irogers@google.com>
Often a command wants to be run in a shell with stdout placed in a string. This API mimics that of stdio's popen, running the given command (not argv array) with "/bin/sh -c" then appending the output from stdout to the buf argument. Signed-off-by: Ian Rogers <irogers@google.com>
If a read is smaller than the remaining space, don't grow the buffer as it is likely we've reached the end of the file. Make the grow amounts a single page rather than just over 2 once the null terminator is included. Signed-off-by: Ian Rogers <irogers@google.com>
alloc_nr gives an estimate of the actual memory behind an allocation but isn't accurate. Use malloc_usable_size to accurately set the strbuf alloc, which potentially avoids realloc calls. Signed-off-by: Ian Rogers <irogers@google.com>
Remove boiler plate by using library routine. Signed-off-by: Ian Rogers <irogers@google.com>
Switch to the common run_command_strbuf utility. Signed-off-by: Ian Rogers <irogers@google.com>
Upstream branch: db473df |
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=710713 irrelevant now. Closing PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: Add and use run_command_strbuf
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=710713