Skip to content

Commit 8f5e72d

Browse files
committed
Merge branch 'progress-wall-clock'
2 parents 4fb32ed + f361a8a commit 8f5e72d

File tree

9 files changed

+28
-227
lines changed

9 files changed

+28
-227
lines changed

Makefile

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ include shared.mak
142142
# Define NO_PREAD if you have a problem with pread() system call (e.g.
143143
# cygwin1.dll before v1.5.22).
144144
#
145-
# Define NO_SETITIMER if you don't have setitimer()
146-
#
147-
# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
148-
# This also implies NO_SETITIMER
149-
#
150145
# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
151146
# generally faster on your platform than accessing the working directory.
152147
#
@@ -1927,13 +1922,6 @@ endif
19271922
ifdef OBJECT_CREATION_USES_RENAMES
19281923
COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
19291924
endif
1930-
ifdef NO_STRUCT_ITIMERVAL
1931-
COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
1932-
NO_SETITIMER = YesPlease
1933-
endif
1934-
ifdef NO_SETITIMER
1935-
COMPAT_CFLAGS += -DNO_SETITIMER
1936-
endif
19371925
ifdef NO_PREAD
19381926
COMPAT_CFLAGS += -DNO_PREAD
19391927
COMPAT_OBJS += compat/pread.o

compat/mingw-posix.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ typedef int pid_t;
6363
#define SIGQUIT 3
6464
#define SIGKILL 9
6565
#define SIGPIPE 13
66-
#define SIGALRM 14
6766
#define SIGCHLD 17
6867

6968
#define F_GETFD 1
@@ -98,11 +97,6 @@ struct sigaction {
9897
#define SA_RESTART 0
9998
#define SA_NOCLDSTOP 1
10099

101-
struct itimerval {
102-
struct timeval it_value, it_interval;
103-
};
104-
#define ITIMER_REAL 0
105-
106100
struct utsname {
107101
char sysname[16];
108102
char nodename[1];
@@ -193,7 +187,6 @@ struct tm *localtime_r(const time_t *timep, struct tm *result);
193187
#endif
194188
int getpagesize(void); /* defined in MinGW's libgcc.a */
195189
struct passwd *getpwuid(uid_t uid);
196-
int setitimer(int type, struct itimerval *in, struct itimerval *out);
197190
int sigaction(int sig, struct sigaction *in, struct sigaction *out);
198191
int link(const char *oldpath, const char *newpath);
199192
int uname(struct utsname *buf);

compat/mingw.c

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,110 +2420,15 @@ struct passwd *getpwuid(int uid UNUSED)
24202420
return p;
24212421
}
24222422

2423-
static HANDLE timer_event;
2424-
static HANDLE timer_thread;
2425-
static int timer_interval;
2426-
static int one_shot;
2427-
static sig_handler_t timer_fn = SIG_DFL, sigint_fn = SIG_DFL;
2428-
2429-
/* The timer works like this:
2430-
* The thread, ticktack(), is a trivial routine that most of the time
2431-
* only waits to receive the signal to terminate. The main thread tells
2432-
* the thread to terminate by setting the timer_event to the signalled
2433-
* state.
2434-
* But ticktack() interrupts the wait state after the timer's interval
2435-
* length to call the signal handler.
2436-
*/
2437-
2438-
static unsigned __stdcall ticktack(void *dummy UNUSED)
2439-
{
2440-
while (WaitForSingleObject(timer_event, timer_interval) == WAIT_TIMEOUT) {
2441-
mingw_raise(SIGALRM);
2442-
if (one_shot)
2443-
break;
2444-
}
2445-
return 0;
2446-
}
2447-
2448-
static int start_timer_thread(void)
2449-
{
2450-
timer_event = CreateEvent(NULL, FALSE, FALSE, NULL);
2451-
if (timer_event) {
2452-
timer_thread = (HANDLE) _beginthreadex(NULL, 0, ticktack, NULL, 0, NULL);
2453-
if (!timer_thread )
2454-
return errno = ENOMEM,
2455-
error("cannot start timer thread");
2456-
} else
2457-
return errno = ENOMEM,
2458-
error("cannot allocate resources for timer");
2459-
return 0;
2460-
}
2461-
2462-
static void stop_timer_thread(void)
2463-
{
2464-
if (timer_event)
2465-
SetEvent(timer_event); /* tell thread to terminate */
2466-
if (timer_thread) {
2467-
int rc = WaitForSingleObject(timer_thread, 10000);
2468-
if (rc == WAIT_TIMEOUT)
2469-
error("timer thread did not terminate timely");
2470-
else if (rc != WAIT_OBJECT_0)
2471-
error("waiting for timer thread failed: %lu",
2472-
GetLastError());
2473-
CloseHandle(timer_thread);
2474-
}
2475-
if (timer_event)
2476-
CloseHandle(timer_event);
2477-
timer_event = NULL;
2478-
timer_thread = NULL;
2479-
}
2480-
2481-
static inline int is_timeval_eq(const struct timeval *i1, const struct timeval *i2)
2482-
{
2483-
return i1->tv_sec == i2->tv_sec && i1->tv_usec == i2->tv_usec;
2484-
}
2423+
static sig_handler_t sigint_fn = SIG_DFL;
24852424

2486-
int setitimer(int type UNUSED, struct itimerval *in, struct itimerval *out)
2487-
{
2488-
static const struct timeval zero;
2489-
static int atexit_done;
2490-
2491-
if (out)
2492-
return errno = EINVAL,
2493-
error("setitimer param 3 != NULL not implemented");
2494-
if (!is_timeval_eq(&in->it_interval, &zero) &&
2495-
!is_timeval_eq(&in->it_interval, &in->it_value))
2496-
return errno = EINVAL,
2497-
error("setitimer: it_interval must be zero or eq it_value");
2498-
2499-
if (timer_thread)
2500-
stop_timer_thread();
2501-
2502-
if (is_timeval_eq(&in->it_value, &zero) &&
2503-
is_timeval_eq(&in->it_interval, &zero))
2504-
return 0;
2505-
2506-
timer_interval = in->it_value.tv_sec * 1000 + in->it_value.tv_usec / 1000;
2507-
one_shot = is_timeval_eq(&in->it_interval, &zero);
2508-
if (!atexit_done) {
2509-
atexit(stop_timer_thread);
2510-
atexit_done = 1;
2511-
}
2512-
return start_timer_thread();
2513-
}
2514-
2515-
int sigaction(int sig, struct sigaction *in, struct sigaction *out)
2425+
int sigaction(int sig, struct sigaction *in UNUSED, struct sigaction *out)
25162426
{
25172427
if (sig == SIGCHLD)
25182428
return -1;
2519-
else if (sig != SIGALRM)
2520-
return errno = EINVAL,
2521-
error("sigaction only implemented for SIGALRM");
25222429
if (out)
25232430
return errno = EINVAL,
25242431
error("sigaction: param 3 != NULL not implemented");
2525-
2526-
timer_fn = in->sa_handler;
25272432
return 0;
25282433
}
25292434

@@ -2533,11 +2438,6 @@ sig_handler_t mingw_signal(int sig, sig_handler_t handler)
25332438
sig_handler_t old;
25342439

25352440
switch (sig) {
2536-
case SIGALRM:
2537-
old = timer_fn;
2538-
timer_fn = handler;
2539-
break;
2540-
25412441
case SIGINT:
25422442
old = sigint_fn;
25432443
sigint_fn = handler;
@@ -2554,15 +2454,6 @@ sig_handler_t mingw_signal(int sig, sig_handler_t handler)
25542454
int mingw_raise(int sig)
25552455
{
25562456
switch (sig) {
2557-
case SIGALRM:
2558-
if (timer_fn == SIG_DFL) {
2559-
if (isatty(STDERR_FILENO))
2560-
fputs("Alarm clock\n", stderr);
2561-
exit(128 + SIGALRM);
2562-
} else if (timer_fn != SIG_IGN)
2563-
timer_fn(SIGALRM);
2564-
return 0;
2565-
25662457
case SIGINT:
25672458
if (sigint_fn == SIG_DFL)
25682459
exit(128 + SIGINT);

compat/posix.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -198,23 +198,6 @@ static inline time_t git_time(time_t *tloc)
198198
}
199199
#define time git_time
200200

201-
#ifdef NO_STRUCT_ITIMERVAL
202-
struct itimerval {
203-
struct timeval it_interval;
204-
struct timeval it_value;
205-
};
206-
#endif
207-
208-
#ifdef NO_SETITIMER
209-
static inline int git_setitimer(int which UNUSED,
210-
const struct itimerval *value UNUSED,
211-
struct itimerval *newvalue UNUSED) {
212-
return 0; /* pretend success */
213-
}
214-
#undef setitimer
215-
#define setitimer(which,value,ovalue) git_setitimer(which,value,ovalue)
216-
#endif
217-
218201
#ifndef NO_LIBGEN_H
219202
#include <libgen.h>
220203
#else

configure.ac

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,6 @@ case $ac_cv_type_socklen_t in
872872
esac
873873
GIT_CONF_SUBST([SOCKLEN_T])
874874

875-
#
876-
# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval.
877-
AC_CHECK_TYPES([struct itimerval],
878-
[NO_STRUCT_ITIMERVAL=],
879-
[NO_STRUCT_ITIMERVAL=UnfortunatelyYes],
880-
[#include <sys/time.h>])
881-
GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL])
882875
#
883876
# Define USE_ST_TIMESPEC=YesPlease when stat.st_mtimespec.tv_nsec exists.
884877
# Define NO_NSEC=YesPlease when neither stat.st_mtim.tv_nsec nor
@@ -1097,12 +1090,6 @@ GIT_CHECK_FUNC(sync_file_range,
10971090
[HAVE_SYNC_FILE_RANGE=])
10981091
GIT_CONF_SUBST([HAVE_SYNC_FILE_RANGE])
10991092

1100-
#
1101-
# Define NO_SETITIMER if you don't have setitimer.
1102-
GIT_CHECK_FUNC(setitimer,
1103-
[NO_SETITIMER=],
1104-
[NO_SETITIMER=YesPlease])
1105-
GIT_CONF_SUBST([NO_SETITIMER])
11061093
#
11071094
# Define NO_STRCASESTR if you don't have strcasestr.
11081095
GIT_CHECK_FUNC(strcasestr,

meson.build

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,22 +1350,6 @@ else
13501350
error('Native regex support requested but not found')
13511351
endif
13521352

1353-
# setitimer and friends are provided by compat/mingw.c.
1354-
if host_machine.system() != 'windows'
1355-
if not compiler.compiles('''
1356-
#include <sys/time.h>
1357-
void func(void)
1358-
{
1359-
struct itimerval value;
1360-
}
1361-
''', name: 'struct itimerval')
1362-
libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
1363-
libgit_c_args += '-DNO_SETITIMER'
1364-
elif not compiler.has_function('setitimer')
1365-
libgit_c_args += '-DNO_SETITIMER'
1366-
endif
1367-
endif
1368-
13691353
if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
13701354
libgit_c_args += '-DUSE_ST_TIMESPEC'
13711355
elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')

0 commit comments

Comments
 (0)