-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
pipe: add flb_pipe_error #10017
Merged
Merged
pipe: add flb_pipe_error #10017
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
864216c
pipe: add flb_pipe_error
braydonk c66851c
pipe: add flb_pipe_error
braydonk 05f391c
Merge branch 'flb_pipe_error' of github.com:braydonk/fluent-bit into …
braydonk 7a1429c
log: address wsa error function comments
braydonk 429bbe1
log: rename get last error print
braydonk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,11 @@ | |
#include <fluent-bit/flb_worker.h> | ||
#include <fluent-bit/flb_mem.h> | ||
|
||
#ifdef WIN32 | ||
#include <winsock.h> | ||
#include <winbase.h> | ||
#endif | ||
|
||
#ifdef FLB_HAVE_AWS_ERROR_REPORTER | ||
#include <fluent-bit/aws/flb_aws_error_reporter.h> | ||
|
||
|
@@ -57,7 +62,7 @@ static inline int64_t flb_log_consume_signal(struct flb_log *context) | |
sizeof(signal_value)); | ||
|
||
if (result <= 0) { | ||
flb_errno(); | ||
flb_pipe_error(); | ||
|
||
return -1; | ||
} | ||
|
@@ -75,7 +80,7 @@ static inline int flb_log_enqueue_signal(struct flb_log *context, | |
sizeof(signal_value)); | ||
|
||
if (result <= 0) { | ||
flb_errno(); | ||
flb_pipe_error(); | ||
|
||
result = 1; | ||
} | ||
|
@@ -121,8 +126,6 @@ static inline int log_read(flb_pipefd_t fd, struct flb_log *log) | |
bytes = flb_pipe_read_all(fd, &msg, sizeof(struct log_message)); | ||
|
||
if (bytes <= 0) { | ||
flb_errno(); | ||
|
||
return -1; | ||
} | ||
if (msg.size > sizeof(msg.msg)) { | ||
|
@@ -742,8 +745,20 @@ int flb_errno_print(int errnum, const char *file, int line) | |
|
||
strerror_r(errnum, buf, sizeof(buf) - 1); | ||
flb_error("[%s:%i errno=%i] %s", file, line, errnum, buf); | ||
return 0; | ||
return errnum; | ||
} | ||
|
||
#ifdef WIN32 | ||
int flb_wsa_get_last_error_print(int errnum, const char *file, int line) | ||
{ | ||
char buf[256]; | ||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, | ||
NULL, errnum, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | ||
buf, sizeof(buf), NULL); | ||
flb_error("[%s:%i WSAGetLastError=%i] %s", file, line, errnum, buf); | ||
return errnum; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a return value or change the return type to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a return value to keep it lined up with |
||
#endif | ||
|
||
int flb_log_destroy(struct flb_log *log, struct flb_config *config) | ||
{ | ||
|
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to make the body of the function or the whole function conditional?
This function is only referenced by
flb_WSAGetLastError
if our target is Windows so I don't think making the whole thing conditional would be a problem.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep fair assessment. Done in 7a1429c