Skip to content

Commit f9125dd

Browse files
authored
Revert "[libfuzzer] use timer_create() instead of setitimer() for linux" (#115811)
Reverts #110274 Buildbots broke
1 parent e855fea commit f9125dd

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,14 @@ bool ExecuteCommand(const Command &Cmd, std::string *CmdOutput) {
104104
}
105105

106106
void SetTimer(int Seconds) {
107-
timer_t TimerId;
108-
struct itimerspec T {
107+
struct itimerval T {
109108
{Seconds, 0}, { Seconds, 0 }
110109
};
111-
SetSigaction(SIGALRM, AlarmHandler);
112-
if (timer_create(CLOCK_REALTIME, nullptr, &TimerId) == -1) {
113-
Printf("libFuzzer: timer_create failed with %d\n", errno);
114-
exit(1);
115-
}
116-
if (timer_settime(TimerId, 0, &T, nullptr) == -1) {
117-
Printf("libFuzzer: timer_settime failed with %d\n", errno);
110+
if (setitimer(ITIMER_REAL, &T, nullptr)) {
111+
Printf("libFuzzer: setitimer failed with %d\n", errno);
118112
exit(1);
119113
}
114+
SetSigaction(SIGALRM, AlarmHandler);
120115
}
121116

122117
void SetSignalHandler(const FuzzingOptions& Options) {

0 commit comments

Comments
 (0)