diff options
author | Christopher Faylor <cgf@redhat.com> | 2004-01-19 05:38:23 +0000 |
---|---|---|
committer | Christopher Faylor <cgf@redhat.com> | 2004-01-19 05:38:23 +0000 |
commit | 3c9c611960b37619593fbb52594323cc6bc56799 (patch) | |
tree | 860b3097c01110cbea02c3985914c01abfd06069 | |
parent | 825299b5da84c01b16d9d1ebda9320056b4117f2 (diff) | |
download | gdb-3c9c611960b37619593fbb52594323cc6bc56799.tar.gz |
* cygwin/include/signal.h: Add copyright notice.
* cygwin.din: Make clock SIGFE. Add clock_gettime, sigwaitinfo, timer_create,
timer_delete, timer_settime.
* include/cygwin/version.h: Reflect above additions.
* fork.cc (fork_child): Call fixup_timers_after_fork.
* signal.cc (sigwait): Remove unused variable.
* timer.cc: New file.
(clock_gettime): Define new function.
(timer_tracker): Define new struct used by timer functions.
(timer_tracker::timer_tracker): New function.
(to_us): New function.
(timer_thread): New function.
(timer_tracker::settime): New function.
(timer_create): New function.
(timer_settime): New function.
(timer_delete): New function.
(fixup_timers_after_fork): New function.
* cygthread.cc: Bump thread count.
-rw-r--r-- | winsup/cygwin/ChangeLog | 22 | ||||
-rw-r--r-- | winsup/cygwin/Makefile.in | 2 | ||||
-rw-r--r-- | winsup/cygwin/cygthread.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/cygthread.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/cygwin.din | 1546 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 57 | ||||
-rw-r--r-- | winsup/cygwin/fork.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/signal.h | 33 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/version.h | 309 | ||||
-rw-r--r-- | winsup/cygwin/signal.cc | 12 | ||||
-rw-r--r-- | winsup/cygwin/timer.cc | 275 | ||||
-rw-r--r-- | winsup/cygwin/times.cc | 682 |
12 files changed, 2902 insertions, 42 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9c8ad9d4407..b8100186a21 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,25 @@ +2004-01-19 Christopher Faylor <cgf@redhat.com> + + * cygwin/include/signal.h: Add copyright notice. + + * cygwin.din: Make clock SIGFE. Add clock_gettime, sigwaitinfo, + timer_create, timer_delete, timer_settime. + * include/cygwin/version.h: Reflect above additions. + * fork.cc (fork_child): Call fixup_timers_after_fork. + * signal.cc (sigwait): Remove unused variable. + * timer.cc: New file. + (clock_gettime): Define new function. + (timer_tracker): Define new struct used by timer functions. + (timer_tracker::timer_tracker): New function. + (to_us): New function. + (timer_thread): New function. + (timer_tracker::settime): New function. + (timer_create): New function. + (timer_settime): New function. + (timer_delete): New function. + (fixup_timers_after_fork): New function. + * cygthread.cc: Bump thread count. + 2004-01-17 Christopher Faylor <cgf@redhat.com> * signal.cc (sigwaitinfo): Define new function. diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index cf15b320d28..5cd0938f49d 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -134,7 +134,7 @@ DLL_OFILES:=assert.o autoload.o bsdlib.o cxx.o cygheap.o cygthread.o cygtls.o \ resource.o scandir.o sched.o sec_acl.o sec_helper.o security.o \ select.o sem.o shared.o shm.o sigfe.o signal.o sigproc.o smallprint.o \ spawn.o strace.o strsep.o sync.o syscalls.o sysconf.o syslog.o \ - termios.o thread.o times.o tty.o uinfo.o uname.o v8_regexp.o \ + termios.o thread.o timer.o times.o tty.o uinfo.o uname.o v8_regexp.o \ v8_regerror.o v8_regsub.o wait.o wincap.o window.o \ $(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MALLOC_OFILES) $(MT_SAFE_OBJECTS) diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc index e830196635d..309bd51ed18 100644 --- a/winsup/cygwin/cygthread.cc +++ b/winsup/cygwin/cygthread.cc @@ -20,7 +20,7 @@ details. */ #undef CloseHandle -static cygthread NO_COPY threads[18]; +static cygthread NO_COPY threads[32]; #define NTHREADS (sizeof (threads) / sizeof (threads[0])) DWORD NO_COPY cygthread::main_thread_id; diff --git a/winsup/cygwin/cygthread.h b/winsup/cygwin/cygthread.h index 76604b471d2..9d10bb26677 100644 --- a/winsup/cygwin/cygthread.h +++ b/winsup/cygwin/cygthread.h @@ -1,6 +1,6 @@ /* cygthread.h - Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din new file mode 100644 index 00000000000..7d4c352d168 --- /dev/null +++ b/winsup/cygwin/cygwin.din @@ -0,0 +1,1546 @@ +LIBRARY "cygwin1.dll" BASE=0x61000000 + +EXPORTS +__argc DATA +__argv DATA +__check_rhosts_file DATA +__cygwin_environ DATA +__cygwin_user_data DATA +__mb_cur_max DATA +__progname DATA +__rcmd_errstr DATA +_check_for_executable DATA +_ctype_ DATA +_daylight DATA +_sys_errlist DATA +sys_errlist = _sys_errlist DATA +_sys_nerr DATA +sys_nerr = _sys_nerr DATA +_timezone DATA +_tzname DATA +h_errno DATA +optarg DATA +opterr DATA +optind DATA +optopt DATA +optreset DATA +_alloca NOSIGFE +dll_entry@12 NOSIGFE +__assert SIGFE +__assertfail SIGFE +__eprintf SIGFE +__errno NOSIGFE +__fpclassifyd NOSIGFE +__fpclassifyf NOSIGFE +__getreent NOSIGFE +__infinity NOSIGFE +__main NOSIGFE +__signbitd NOSIGFE +__signbitf NOSIGFE +__signgam NOSIGFE +__srget SIGFE +__swbuf SIGFE +_asprintf_r SIGFE +asprintf_r = _asprintf_r SIGFE +_dll_crt0@0 NOSIGFE +_exit NOSIGFE +_f_atan2 NOSIGFE +__f_atan2 = _f_atan2 NOSIGFE +_f_atan2f NOSIGFE +__f_atan2f = _f_atan2f NOSIGFE +_f_exp NOSIGFE +__f_exp = _f_exp NOSIGFE +_f_expf NOSIGFE +__f_expf = _f_expf NOSIGFE +_f_frexp NOSIGFE +__f_frexp = _f_frexp NOSIGFE +_f_frexpf NOSIGFE +__f_frexpf = _f_frexpf NOSIGFE +_f_ldexp NOSIGFE +__f_ldexp = _f_ldexp NOSIGFE +_f_ldexpf NOSIGFE +__f_ldexpf = _f_ldexpf NOSIGFE +_f_log NOSIGFE +__f_log = _f_log NOSIGFE +_f_log10 NOSIGFE +__f_log10 = _f_log10 NOSIGFE +_f_log10f NOSIGFE +__f_log10f = _f_log10f NOSIGFE +_f_logf NOSIGFE +__f_logf = _f_logf NOSIGFE +_f_pow NOSIGFE +__f_pow = _f_pow NOSIGFE +_f_powf NOSIGFE +__f_powf = _f_powf NOSIGFE +_f_tan NOSIGFE +__f_tan = _f_tan NOSIGFE +_f_tanf NOSIGFE +__f_tanf = _f_tanf NOSIGFE +_fcloseall_r SIGFE +fcloseall_r = _fcloseall_r SIGFE +_fscanf_r SIGFE +fscanf_r = _fscanf_r SIGFE +fstat SIGFE +_fstat = fstat SIGFE +_pipe SIGFE +_pthread_cleanup_pop NOSIGFE +_pthread_cleanup_push NOSIGFE +_scanf_r SIGFE +scanf_r = _scanf_r SIGFE +_sscanf_r SIGFE +sscanf_r = _sscanf_r SIGFE +stat SIGFE +_stat = stat SIGFE +_strtold SIGFE +trunc NOSIGFE +_vasprintf_r SIGFE +vasprintf_r = _vasprintf_r SIGFE +_vfscanf_r NOSIGFE +vfscanf_r = _vfscanf_r NOSIGFE +_vscanf_r SIGFE +vscanf_r = _vscanf_r SIGFE +_vsscanf_r SIGFE +vsscanf_r = _vsscanf_r SIGFE +a64l NOSIGFE +abort SIGFE +_abort = abort SIGFE +abs NOSIGFE +_abs = abs NOSIGFE +access SIGFE +_access = access SIGFE +acl SIGFE +_acl = acl SIGFE +_acl32 = acl32 SIGFE +aclcheck NOSIGFE +_aclcheck = aclcheck NOSIGFE +_aclcheck32 = aclcheck32 NOSIGFE +aclfrommode SIGFE +_aclfrommode = aclfrommode SIGFE +_aclfrommode32 = aclfrommode32 SIGFE +aclfrompbits SIGFE +_aclfrompbits = aclfrompbits SIGFE +_aclfrompbits32 = aclfrompbits32 SIGFE +aclfromtext SIGFE +_aclfromtext = aclfromtext SIGFE +_aclfromtext32 = aclfromtext32 SIGFE +aclsort SIGFE +_aclsort = aclsort SIGFE +_aclsort32 = aclsort32 SIGFE +acltomode SIGFE +_acltomode = acltomode SIGFE +_acltomode32 = acltomode32 SIGFE +acltopbits SIGFE +_acltopbits = acltopbits SIGFE +_acltopbits32 = acltopbits32 SIGFE +acltotext SIGFE +_acltotext = acltotext SIGFE +_acltotext32 = acltotext32 SIGFE +acos NOSIGFE +_acos = acos NOSIGFE +acosf NOSIGFE +_acosf = acosf NOSIGFE +acosh NOSIGFE +_acosh = acosh NOSIGFE +acoshf NOSIGFE +_acoshf = acoshf NOSIGFE +alarm SIGFE +_alarm = alarm SIGFE +alphasort NOSIGFE +_alphasort = alphasort NOSIGFE +argz_add SIGFE +__argz_add = argz_add SIGFE +argz_add_sep SIGFE +__argz_add_sep = argz_add_sep SIGFE +argz_append SIGFE +__argz_append = argz_append SIGFE +argz_count NOSIGFE +__argz_count = argz_count NOSIGFE +argz_create SIGFE +__argz_create = argz_create SIGFE +argz_create_sep SIGFE +__argz_create_sep = argz_create_sep SIGFE +argz_delete SIGFE +__argz_delete = argz_delete SIGFE +argz_extract NOSIGFE +__argz_extract = argz_extract NOSIGFE +argz_insert SIGFE +__argz_insert = argz_insert SIGFE +argz_next NOSIGFE +__argz_next = argz_next NOSIGFE +argz_replace SIGFE +__argz_replace = argz_replace SIGFE +argz_stringify NOSIGFE +__argz_stringify = argz_stringify NOSIGFE +asctime SIGFE +_asctime = asctime SIGFE +asctime_r SIGFE +_asctime_r = asctime_r SIGFE +asin NOSIGFE +_asin = asin NOSIGFE +asinf NOSIGFE +_asinf = asinf NOSIGFE +asinh NOSIGFE +_asinh = asinh NOSIGFE +asinhf NOSIGFE +_asinhf = asinhf NOSIGFE +asprintf SIGFE +_asprintf = asprintf SIGFE +atan NOSIGFE +_atan = atan NOSIGFE +atan2 NOSIGFE +_atan2 = atan2 NOSIGFE +atan2f NOSIGFE +_atan2f = atan2f NOSIGFE +atanf NOSIGFE +_atanf = atanf NOSIGFE +atanh NOSIGFE +_atanh = atanh NOSIGFE +atanhf NOSIGFE +_atanhf = atanhf NOSIGFE +atexit = cygwin_atexit SIGFE +_atexit = cygwin_atexit SIGFE +atof SIGFE +_atof = atof SIGFE +atoff SIGFE +_atoff = atoff SIGFE +atoi NOSIGFE +_atoi = atoi NOSIGFE +atol NOSIGFE +_atol = atol NOSIGFE +bcmp NOSIGFE +_bcmp = bcmp NOSIGFE +bcopy NOSIGFE +_bcopy = bcopy NOSIGFE +bsearch NOSIGFE +_bsearch = bsearch NOSIGFE +btowc NOSIGFE +bzero NOSIGFE +_bzero = bzero NOSIGFE +cabs NOSIGFE +_cabs = cabs NOSIGFE +cabsf NOSIGFE +_cabsf = cabsf NOSIGFE +calloc SIGFE +_calloc = calloc SIGFE +cbrt NOSIGFE +_cbrt = cbrt NOSIGFE +cbrtf NOSIGFE +_cbrtf = cbrtf NOSIGFE +ceil NOSIGFE +_ceil = ceil NOSIGFE +ceilf NOSIGFE +_ceilf = ceilf NOSIGFE +cfgetispeed NOSIGFE +cfgetospeed NOSIGFE +cfsetispeed SIGFE +cfsetospeed SIGFE +chdir SIGFE +_chdir = chdir SIGFE +chmod SIGFE +_chmod = chmod SIGFE +chown SIGFE +_chown = chown SIGFE +_chown32 = chown32 SIGFE +chroot SIGFE +_chroot = chroot SIGFE +cleanup_glue NOSIGFE +clearerr NOSIGFE +_clearerr = clearerr NOSIGFE +clock SIGFE +_clock = clock SIGFE +clock_gettime SIGFE +close SIGFE +_close = close SIGFE +closedir SIGFE +_closedir = closedir SIGFE +closelog NOSIGFE +_closelog = closelog NOSIGFE +copysign NOSIGFE +_copysign = copysign NOSIGFE +copysignf NOSIGFE +_copysignf = copysignf NOSIGFE +cos NOSIGFE +_cos = cos NOSIGFE +cosf NOSIGFE +_cosf = cosf NOSIGFE +cosh NOSIGFE +_cosh = cosh NOSIGFE +coshf NOSIGFE +_coshf = coshf NOSIGFE +creat SIGFE +_creat = creat SIGFE +ctermid NOSIGFE +ctime SIGFE +_ctime = ctime SIGFE +ctime_r SIGFE +_ctime_r = ctime_r SIGFE +cuserid NOSIGFE +_cuserid = cuserid NOSIGFE +cwait SIGFE +_cwait = cwait SIGFE +accept = cygwin_accept SIGFE +cygwin_attach_handle_to_fd SIGFE +cygwin32_attach_handle_to_fd = cygwin_attach_handle_to_fd SIGFE +bind = cygwin_bind SIGFE +connect = cygwin_connect SIGFE +cygwin_conv_to_full_posix_path SIGFE +cygwin32_conv_to_full_posix_path = cygwin_conv_to_full_posix_path SIGFE +cygwin_conv_to_full_win32_path SIGFE +cygwin32_conv_to_full_win32_path = cygwin_conv_to_full_win32_path SIGFE +cygwin_conv_to_posix_path SIGFE +cygwin32_conv_to_posix_path = cygwin_conv_to_posix_path SIGFE +cygwin_conv_to_win32_path SIGFE +cygwin32_conv_to_win32_path = cygwin_conv_to_win32_path SIGFE +cygwin_detach_dll NOSIGFE +cygwin32_detach_dll = cygwin_detach_dll NOSIGFE +cygwin_dll_init NOSIGFE +endprotoent = cygwin_endprotoent SIGFE +endservent = cygwin_endservent SIGFE +endusershell SIGFE +err SIGFE +errx SIGFE +gethostbyaddr = cygwin_gethostbyaddr SIGFE +gethostbyname = cygwin_gethostbyname SIGFE +_gethostname = cygwin_gethostname SIGFE +gethostname = cygwin_gethostname SIGFE +getpeername = cygwin_getpeername SIGFE +getprogname NOSIGFE +getprotobyname = cygwin_getprotobyname SIGFE +getprotobynumber = cygwin_getprotobynumber SIGFE +getprotoent = cygwin_getprotoent SIGFE +getservbyname = cygwin_getservbyname SIGFE +getservbyport = cygwin_getservbyport SIGFE +getservent = cygwin_getservent SIGFE +getsockname = cygwin_getsockname SIGFE +getsockopt = cygwin_getsockopt SIGFE +getusershell SIGFE +herror = cygwin_herror SIGFE +hstrerror = cygwin_hstrerror NOSIGFE +inet_addr = cygwin_inet_addr SIGFE +inet_aton = cygwin_inet_aton SIGFE +inet_network = cygwin_inet_network SIGFE +inet_ntoa = cygwin_inet_ntoa SIGFE +cygwin_internal NOSIGFE +cygwin32_internal = cygwin_internal NOSIGFE +listen = cygwin_listen SIGFE +cygwin_logon_user SIGFE +lstat SIGFE +_lstat = lstat SIGFE +cygwin_posix_path_list_p NOSIGFE +cygwin32_posix_path_list_p = cygwin_posix_path_list_p NOSIGFE +cygwin_posix_to_win32_path_list NOSIGFE +cygwin32_posix_to_win32_path_list = cygwin_posix_to_win32_path_list NOSIGFE +cygwin_posix_to_win32_path_list_buf_size SIGFE +cygwin32_posix_to_win32_path_list_buf_size = cygwin_posix_to_win32_path_list_buf_size SIGFE +rcmd = cygwin_rcmd SIGFE +recv = cygwin_recv SIGFE +recvfrom = cygwin_recvfrom SIGFE +recvmsg = cygwin_recvmsg SIGFE +rexec = cygwin_rexec SIGFE +rresvport = cygwin_rresvport SIGFE +_select = cygwin_select SIGFE +select = cygwin_select SIGFE +send = cygwin_send SIGFE +sendmsg = cygwin_sendmsg SIGFE +sendto = cygwin_sendto SIGFE +cygwin_set_impersonation_token SIGFE +setprogname SIGFE +setprotoent = cygwin_setprotoent SIGFE +setservent = cygwin_setservent SIGFE +setsockopt = cygwin_setsockopt SIGFE +setusershell SIGFE +shutdown = cygwin_shutdown SIGFE +socket = cygwin_socket SIGFE +cygwin_split_path NOSIGFE +cygwin32_split_path = cygwin_split_path NOSIGFE +cygwin_stackdump SIGFE +cygwin_umount SIGFE +cygwin_win32_to_posix_path_list NOSIGFE +cygwin32_win32_to_posix_path_list = cygwin_win32_to_posix_path_list NOSIGFE +cygwin_win32_to_posix_path_list_buf_size SIGFE +cygwin32_win32_to_posix_path_list_buf_size = cygwin_win32_to_posix_path_list_buf_size SIGFE +cygwin_winpid_to_pid SIGFE +cygwin32_winpid_to_pid = cygwin_winpid_to_pid SIGFE +daemon SIGFE +difftime NOSIGFE +_difftime = difftime NOSIGFE +dirfd SIGFE +_dirfd = dirfd SIGFE +div NOSIGFE +_div = div NOSIGFE +dlclose SIGFE +dlerror NOSIGFE +dlfork NOSIGFE +dll_crt0__FP11per_process NOSIGFE +dll_dllcrt0 NOSIGFE +dll_noncygwin_dllcrt0 NOSIGFE +dlopen SIGFE +dlsym SIGFE +drand48 NOSIGFE +_drand48 = drand48 NOSIGFE +drem NOSIGFE +_drem = drem NOSIGFE +dremf NOSIGFE +_dremf = dremf NOSIGFE +dup SIGFE +_dup = dup SIGFE +dup2 SIGFE +_dup2 = dup2 SIGFE +ecvt SIGFE +_ecvt = ecvt SIGFE +ecvtbuf SIGFE +_ecvtbuf = ecvtbuf SIGFE +ecvtf SIGFE +_ecvtf = ecvtf SIGFE +endgrent NOSIGFE +_endgrent = endgrent NOSIGFE +endhostent NOSIGFE +endmntent NOSIGFE +_endmntent = endmntent NOSIGFE +endpwent NOSIGFE +_endpwent = endpwent NOSIGFE +endutent SIGFE +_endutent = endutent SIGFE +envz_add SIGFE +__envz_add = envz_add SIGFE +envz_entry NOSIGFE +__envz_entry = envz_entry NOSIGFE +envz_get NOSIGFE +__envz_get = envz_get NOSIGFE +envz_merge SIGFE +__envz_merge = envz_merge SIGFE +envz_remove SIGFE +__envz_remove = envz_remove SIGFE +envz_strip SIGFE +__envz_strip = envz_strip SIGFE +erand48 NOSIGFE +_erand48 = erand48 NOSIGFE +erf NOSIGFE +_erf = erf NOSIGFE +erfc NOSIGFE +_erfc = erfc NOSIGFE +erfcf NOSIGFE +_erfcf = erfcf NOSIGFE +erff NOSIGFE +_erff = erff NOSIGFE +execl SIGFE +_execl = execl SIGFE +execle SIGFE +_execle = execle SIGFE +execlp SIGFE +_execlp = execlp SIGFE +execv SIGFE +_execv = execv SIGFE +execve SIGFE +_execve = execve SIGFE +execvp SIGFE +_execvp = execvp SIGFE +exit = cygwin_exit NOSIGFE +exp NOSIGFE +_exp = exp NOSIGFE +exp2 NOSIGFE +exp2f NOSIGFE +expf NOSIGFE +_expf = expf NOSIGFE +expm1 NOSIGFE +_expm1 = expm1 NOSIGFE +expm1f NOSIGFE +_expm1f = expm1f NOSIGFE +fabs NOSIGFE +_fabs = fabs NOSIGFE +fabsf NOSIGFE +_fabsf = fabsf NOSIGFE +facl SIGFE +_facl = facl SIGFE +_facl32 = facl32 SIGFE +fchdir SIGFE +_fchdir = fchdir SIGFE +fchmod SIGFE +_fchmod = fchmod SIGFE +fchown SIGFE +_fchown = fchown SIGFE +_fchown32 = fchown32 SIGFE +fclose SIGFE +_fclose = fclose SIGFE +fcloseall SIGFE +_fcloseall = fcloseall SIGFE +fcntl SIGFE +_fcntl = fcntl SIGFE +_fcntl64 = fcntl64 SIGFE +fcvt SIGFE +_fcvt = fcvt SIGFE +fcvtbuf SIGFE +_fcvtbuf = fcvtbuf SIGFE +fcvtf SIGFE +_fcvtf = fcvtf SIGFE +fdim NOSIGFE +fdimf NOSIGFE +fdopen SIGFE +_fdopen = fdopen SIGFE +_fdopen64 = fdopen64 SIGFE +feof NOSIGFE +_feof = feof NOSIGFE +ferror NOSIGFE +_ferror = ferror NOSIGFE +fflush NOSIGFE +_fflush = fflush NOSIGFE +ffs NOSIGFE +_ffs = ffs NOSIGFE +fgetc SIGFE +_fgetc = fgetc SIGFE +fgetpos NOSIGFE +_fgetpos = fgetpos NOSIGFE +_fgetpos64 = fgetpos64 NOSIGFE +fgets SIGFE +_fgets = fgets SIGFE +fileno NOSIGFE +_fileno = fileno NOSIGFE +finite NOSIGFE +_finite = finite NOSIGFE +finitef NOSIGFE +_finitef = finitef NOSIGFE +fiprintf SIGFE +_fiprintf = fiprintf SIGFE +flock SIGFE +flock SIGFE +floor NOSIGFE +_floor = floor NOSIGFE +floorf NOSIGFE +_floorf = floorf NOSIGFE +fma NOSIGFE +fmaf NOSIGFE +fmax NOSIGFE +fmaxf NOSIGFE +fmin NOSIGFE +fminf NOSIGFE +fmod NOSIGFE +_fmod = fmod NOSIGFE +fmodf NOSIGFE +_fmodf = fmodf NOSIGFE +fnmatch NOSIGFE +_fnmatch = fnmatch NOSIGFE +fopen SIGFE +_fopen = fopen SIGFE +_fopen64 = fopen64 SIGFE +fork SIGFE +_fork = fork SIGFE +forkpty SIGFE +fpathconf SIGFE +fprintf SIGFE +_fprintf = fprintf SIGFE +fputc NOSIGFE +_fputc = fputc NOSIGFE +fputs SIGFE +_fputs = fputs SIGFE +fread SIGFE +_fread = fread SIGFE +free SIGFE +_free = free SIGFE +freopen SIGFE +_freopen = freopen SIGFE +_freopen64 = freopen64 SIGFE +frexp NOSIGFE +_frexp = frexp NOSIGFE +frexpf NOSIGFE +_frexpf = frexpf NOSIGFE +fscanf SIGFE +_fscanf = fscanf SIGFE +fseek SIGFE +_fseek = fseek SIGFE +fseeko SIGFE +_fseeko = fseeko SIGFE +_fseeko64 = fseeko64 SIGFE +fsetpos SIGFE +_fsetpos = fsetpos SIGFE +_fsetpos64 = fsetpos64 SIGFE +_fstat64 = fstat64 SIGFE +fstatfs SIGFE +_fstatfs = fstatfs SIGFE +fsync SIGFE +_fsync = fsync SIGFE +ftell NOSIGFE +_ftell = ftell NOSIGFE +ftello NOSIGFE +_ftello = ftello NOSIGFE +_ftello64 = ftello64 NOSIGFE +ftime SIGFE +_ftime = ftime SIGFE +ftok SIGFE +_ftok = ftok SIGFE +ftruncate SIGFE +_ftruncate = ftruncate SIGFE +_ftruncate64 = ftruncate64 SIGFE +fwrite SIGFE +_fwrite = fwrite SIGFE +gamma NOSIGFE +_gamma = gamma NOSIGFE +gamma_r NOSIGFE +_gamma_r = gamma_r NOSIGFE +gammaf NOSIGFE +_gammaf = gammaf NOSIGFE +gammaf_r NOSIGFE +_gammaf_r = gammaf_r NOSIGFE +gcvt SIGFE +_gcvt = gcvt SIGFE +gcvtf SIGFE +_gcvtf = gcvtf SIGFE +get_osfhandle SIGFE +_get_osfhandle = get_osfhandle SIGFE +getc SIGFE +_getc = getc SIGFE +getc_unlocked SIGFE +_getc_unlocked = getc_unlocked SIGFE +getchar NOSIGFE +_getchar = getchar NOSIGFE +getchar_unlocked NOSIGFE +_getchar_unlocked = getchar_unlocked NOSIGFE +getcwd SIGFE +_getcwd = getcwd SIGFE +getdomainname SIGFE +_getdomainname = getdomainname SIGFE +getdtablesize NOSIGFE +_getdtablesize = getdtablesize NOSIGFE +getegid NOSIGFE +_getegid = getegid NOSIGFE +_getegid32 = getegid32 NOSIGFE +getenv NOSIGFE +_getenv = getenv NOSIGFE +geteuid NOSIGFE +_geteuid = geteuid NOSIGFE +_geteuid32 = geteuid32 NOSIGFE +getgid NOSIGFE +_getgid = getgid NOSIGFE +_getgid32 = getgid32 NOSIGFE +getgrent SIGFE +_getgrent = getgrent SIGFE +_getgrent32 = getgrent32 SIGFE +getgrgid SIGFE +_getgrgid = getgrgid SIGFE +_getgrgid32 = getgrgid32 SIGFE +getgrnam SIGFE +_getgrnam = getgrnam SIGFE +_getgrnam32 = getgrnam32 SIGFE +getgroups SIGFE +_getgroups = getgroups SIGFE +_getgroups32 = getgroups32 SIGFE +gethostid SIGFE +getitimer SIGFE +getlogin NOSIGFE +_getlogin = getlogin NOSIGFE +getmntent SIGFE +_getmntent = getmntent SIGFE +getmode SIGFE +_getmode = getmode SIGFE +getopt SIGFE +getopt_long SIGFE +getpagesize SIGFE +_getpagesize = getpagesize SIGFE +getpass SIGFE +_getpass = getpass SIGFE +getpgid SIGFE +getpgrp SIGFE +_getpgrp = getpgrp SIGFE +getpid NOSIGFE +_getpid = getpid NOSIGFE +getppid NOSIGFE +_getppid = getppid NOSIGFE +getpwduid NOSIGFE +_getpwduid = getpwduid NOSIGFE +getpwent SIGFE +_getpwent = getpwent SIGFE +getpwnam SIGFE +_getpwnam = getpwnam SIGFE +getpwnam_r SIGFE +getpwuid SIGFE +_getpwuid = getpwuid SIGFE +_getpwuid32 = getpwuid32 SIGFE +getpwuid_r SIGFE +_getpwuid_r32 = getpwuid_r32 SIGFE +getrlimit SIGFE +_getrlimit = getrlimit SIGFE +getrusage SIGFE +_getrusage = getrusage SIGFE +gets NOSIGFE +_gets = gets NOSIGFE +getsid SIGFE +gettimeofday SIGFE +_gettimeofday = gettimeofday SIGFE +getuid NOSIGFE +_getuid = getuid NOSIGFE +_getuid32 = getuid32 NOSIGFE +getutent SIGFE +_getutent = getutent SIGFE +getutid SIGFE +_getutid = getutid SIGFE +getutline SIGFE +_getutline = getutline SIGFE +getw SIGFE +_getw = getw SIGFE +getwd SIGFE +_getwd = getwd SIGFE +glob SIGFE +_glob = glob SIGFE +globfree SIGFE +_globfree = globfree SIGFE +gmtime SIGFE +_gmtime = gmtime SIGFE +gmtime_r SIGFE +_gmtime_r = gmtime_r SIGFE +grantpt NOSIGFE +hcreate SIGFE +hcreate_r SIGFE +hdestroy SIGFE +hdestroy_r SIGFE +hsearch SIGFE +hsearch_r SIGFE +htonl NOSIGFE +_htonl = htonl NOSIGFE +htons NOSIGFE +_htons = htons NOSIGFE +hypot NOSIGFE +_hypot = hypot NOSIGFE +hypotf NOSIGFE +_hypotf = hypotf NOSIGFE +ilogb NOSIGFE +_ilogb = ilogb NOSIGFE +ilogbf NOSIGFE +_ilogbf = ilogbf NOSIGFE +index NOSIGFE +_index = index NOSIGFE +inet_makeaddr NOSIGFE +inet_netof NOSIGFE +infinity NOSIGFE +_infinity = infinity NOSIGFE +infinityf NOSIGFE +_infinityf = infinityf NOSIGFE +initgroups SIGFE +_initgroups32 = initgroups32 SIGFE +initstate NOSIGFE +ioctl SIGFE +_ioctl = ioctl SIGFE +iprintf SIGFE +_iprintf = iprintf SIGFE +iruserok SIGFE +ruserok SIGFE +isalnum NOSIGFE +_isalnum = isalnum NOSIGFE +isalpha NOSIGFE +_isalpha = isalpha NOSIGFE +isascii NOSIGFE +_isascii = isascii NOSIGFE +isatty SIGFE +_isatty = isatty SIGFE +isblank NOSIGFE +iscntrl NOSIGFE +_iscntrl = iscntrl NOSIGFE +isdigit NOSIGFE +_isdigit = isdigit NOSIGFE +isgraph NOSIGFE +_isgraph = isgraph NOSIGFE +isinf NOSIGFE +_isinf = isinf NOSIGFE +isinff NOSIGFE +_isinff = isinff NOSIGFE +islower NOSIGFE +_islower = islower NOSIGFE +isnan NOSIGFE +_isnan = isnan NOSIGFE +isnanf NOSIGFE +_isnanf = isnanf NOSIGFE +isprint NOSIGFE +_isprint = isprint NOSIGFE +ispunct NOSIGFE +_ispunct = ispunct NOSIGFE +isspace NOSIGFE +_isspace = isspace NOSIGFE +isupper NOSIGFE +_isupper = isupper NOSIGFE +iswalnum NOSIGFE +iswalpha NOSIGFE +iswblank NOSIGFE +iswcntrl NOSIGFE +iswctype NOSIGFE +iswdigit NOSIGFE +iswgraph NOSIGFE +iswlower NOSIGFE +iswprint NOSIGFE +iswpunct NOSIGFE +iswspace NOSIGFE +iswupper NOSIGFE +iswxdigit NOSIGFE +isxdigit NOSIGFE +_isxdigit = isxdigit NOSIGFE +j0 NOSIGFE +_j0 = j0 NOSIGFE +j0f NOSIGFE +_j0f = j0f NOSIGFE +j1 NOSIGFE +_j1 = j1 NOSIGFE +j1f NOSIGFE +_j1f = j1f NOSIGFE +jn NOSIGFE +_jn = jn NOSIGFE +jnf NOSIGFE +_jnf = jnf NOSIGFE +jrand48 NOSIGFE +_jrand48 = jrand48 NOSIGFE +kill SIGFE +_kill = kill SIGFE +killpg SIGFE +l64a NOSIGFE +labs NOSIGFE +_labs = labs NOSIGFE +lacl SIGFE +_lacl = lacl SIGFE +lchown SIGFE +_lchown = lchown SIGFE +_lchown32 = lchown32 SIGFE +lcong48 NOSIGFE +_lcong48 = lcong48 NOSIGFE +ldexp NOSIGFE +_ldexp = ldexp NOSIGFE +ldexpf NOSIGFE +_ldexpf = ldexpf NOSIGFE +ldiv NOSIGFE +_ldiv = ldiv NOSIGFE +lgamma NOSIGFE +_lgamma = lgamma NOSIGFE +lgamma_r NOSIGFE +_lgamma_r = lgamma_r NOSIGFE +lgammaf NOSIGFE +_lgammaf = lgammaf NOSIGFE +lgammaf_r NOSIGFE +_lgammaf_r = lgammaf_r NOSIGFE +link SIGFE +_link = link SIGFE +localeconv NOSIGFE +_localeconv = localeconv NOSIGFE +localtime SIGFE +_localtime = localtime SIGFE +localtime_r NOSIGFE +_localtime_r = localtime_r NOSIGFE +log NOSIGFE +_log = log NOSIGFE +log10 NOSIGFE +_log10 = log10 NOSIGFE +log10f NOSIGFE +_log10f = log10f NOSIGFE +log1p NOSIGFE +_log1p = log1p NOSIGFE +log1pf NOSIGFE +_log1pf = log1pf NOSIGFE +logb NOSIGFE +_logb = logb NOSIGFE +logbf NOSIGFE +_logbf = logbf NOSIGFE +logf NOSIGFE +_logf = logf NOSIGFE +login SIGFE +login_tty SIGFE +logout SIGFE +logwtmp SIGFE +updwtmp SIGFE +longjmp NOSIGFE +_longjmp = longjmp NOSIGFE +lrand48 NOSIGFE +_lrand48 = lrand48 NOSIGFE +lrint NOSIGFE +lrintf NOSIGFE +lround NOSIGFE +lroundf NOSIGFE +lseek SIGFE +_lseek = lseek SIGFE +_lseek64 = lseek64 SIGFE +_lstat64 = lstat64 SIGFE +mallinfo SIGFE +malloc SIGFE +_malloc = malloc SIGFE +malloc_stats SIGFE +malloc_trim SIGFE +malloc_usable_size SIGFE +mallopt SIGFE +matherr NOSIGFE +_matherr = matherr NOSIGFE +mblen NOSIGFE +_mblen = mblen NOSIGFE +mbrlen NOSIGFE +mbrtowc NOSIGFE +mbsinit NOSIGFE +mbsrtowcs NOSIGFE +mbstowcs NOSIGFE +_mbstowcs = mbstowcs NOSIGFE +mbtowc NOSIGFE +_mbtowc = mbtowc NOSIGFE +memalign SIGFE +memccpy NOSIGFE +_memccpy = memccpy NOSIGFE +memchr NOSIGFE +_memchr = memchr NOSIGFE +memcmp NOSIGFE +_memcmp = memcmp NOSIGFE +memcpy NOSIGFE +_memcpy = memcpy NOSIGFE +memmove NOSIGFE +_memmove = memmove NOSIGFE +mempcpy NOSIGFE +__mempcpy = mempcpy NOSIGFE +memset NOSIGFE +_memset = memset NOSIGFE +mkdir SIGFE +_mkdir = mkdir SIGFE +mkfifo SIGFE +mknod SIGFE +_mknod = mknod SIGFE +_mknod32 = mknod32 SIGFE +mkstemp SIGFE +_mkstemp = mkstemp SIGFE +mktemp SIGFE +_mktemp = mktemp SIGFE +mktime SIGFE +_mktime = mktime SIGFE +mmap SIGFE +_mmap64 = mmap64 SIGFE +modf NOSIGFE +_modf = modf NOSIGFE +modff NOSIGFE +_modff = modff NOSIGFE +mount SIGFE +_mount = mount SIGFE +mprotect SIGFE +mrand48 NOSIGFE +msgctl SIGFE +msgget SIGFE +msgrcv SIGFE +msgsnd SIGFE +msync SIGFE +munmap SIGFE +nan NOSIGFE +_nan = nan NOSIGFE +nanf NOSIGFE +_nanf = nanf NOSIGFE +nanosleep SIGFE +_nanosleep = nanosleep SIGFE +nearbyint NOSIGFE +nearbyintf NOSIGFE +nextafter NOSIGFE +_nextafter = nextafter NOSIGFE +nextafterf NOSIGFE +_nextafterf = nextafterf NOSIGFE +nice SIGFE +_nice = nice SIGFE +nl_langinfo SIGFE +_nl_langinfo = nl_langinfo SIGFE +nrand48 NOSIGFE +_nrand48 = nrand48 NOSIGFE +ntohl NOSIGFE +_ntohl = ntohl NOSIGFE +ntohs NOSIGFE +_ntohs = ntohs NOSIGFE +on_exit SIGFE +open SIGFE +_open = open SIGFE +_open64 +opendir SIGFE +_opendir = opendir SIGFE +openlog SIGFE +_openlog = openlog SIGFE +openpty SIGFE +pathconf SIGFE +_pathconf = pathconf SIGFE +pause SIGFE +pclose SIGFE +_pclose = pclose SIGFE +perror SIGFE +_perror = perror SIGFE +pipe SIGFE +poll SIGFE +_poll = poll SIGFE +popen SIGFE +_popen = popen SIGFE +posix_regcomp SIGFE +posix_regerror SIGFE +posix_regexec SIGFE +posix_regfree SIGFE +pow NOSIGFE +_pow = pow NOSIGFE +powf NOSIGFE +_powf = powf NOSIGFE +printf SIGFE +_printf = printf SIGFE +pthread_atfork SIGFE +pthread_attr_destroy NOSIGFE +pthread_attr_getdetachstate NOSIGFE +pthread_attr_getinheritsched NOSIGFE +pthread_attr_getschedparam NOSIGFE +pthread_attr_getschedpolicy NOSIGFE +pthread_attr_getscope NOSIGFE +pthread_attr_getstacksize NOSIGFE +pthread_attr_init SIGFE +pthread_attr_setdetachstate NOSIGFE +pthread_attr_setinheritsched NOSIGFE +pthread_attr_setschedparam NOSIGFE +pthread_attr_setschedpolicy NOSIGFE +pthread_attr_setscope NOSIGFE +pthread_attr_setstacksize NOSIGFE +pthread_cancel NOSIGFE +pthread_cond_broadcast SIGFE +pthread_cond_destroy NOSIGFE +pthread_cond_init SIGFE +pthread_cond_signal SIGFE +pthread_cond_timedwait SIGFE +pthread_cond_wait SIGFE +pthread_condattr_destroy NOSIGFE +pthread_condattr_getpshared NOSIGFE +pthread_condattr_init SIGFE +pthread_condattr_setpshared NOSIGFE +pthread_continue SIGFE +pthread_create SIGFE +pthread_detach SIGFE +pthread_equal NOSIGFE +pthread_exit NOSIGFE +pthread_getconcurrency NOSIGFE +pthread_getschedparam NOSIGFE +pthread_getsequence_np NOSIGFE +pthread_getspecific NOSIGFE +pthread_join SIGFE +pthread_key_create SIGFE +pthread_key_delete NOSIGFE +pthread_kill SIGFE +pthread_mutex_destroy NOSIGFE +pthread_mutex_getprioceiling SIGFE +pthread_mutex_init SIGFE +pthread_mutex_lock SIGFE +pthread_mutex_setprioceiling SIGFE +pthread_mutex_trylock SIGFE +pthread_mutex_unlock SIGFE +pthread_mutexattr_destroy NOSIGFE +pthread_mutexattr_getprioceiling NOSIGFE +pthread_mutexattr_getprotocol NOSIGFE +pthread_mutexattr_getpshared NOSIGFE +pthread_mutexattr_gettype NOSIGFE +pthread_mutexattr_init SIGFE +pthread_mutexattr_setprioceiling NOSIGFE +pthread_mutexattr_setprotocol NOSIGFE +pthread_mutexattr_setpshared NOSIGFE +pthread_mutexattr_settype NOSIGFE +pthread_once SIGFE +pthread_rwlock_destroy NOSIGFE +pthread_rwlock_init SIGFE +pthread_rwlock_rdlock SIGFE +pthread_rwlock_tryrdlock SIGFE +pthread_rwlock_wrlock SIGFE +pthread_rwlock_trywrlock SIGFE +pthread_rwlock_unlock SIGFE +pthread_rwlockattr_init SIGFE +pthread_rwlockattr_getpshared NOSIGFE +pthread_rwlockattr_setpshared NOSIGFE +pthread_rwlockattr_destroy NOSIGFE +pthread_self NOSIGFE +pthread_setcancelstate NOSIGFE +pthread_setcanceltype NOSIGFE +pthread_setconcurrency NOSIGFE +pthread_setschedparam SIGFE +pthread_setspecific NOSIGFE +pthread_sigmask SIGFE +pthread_suspend SIGFE +pthread_testcancel NOSIGFE +ptsname SIGFE +putc SIGFE +_putc = putc SIGFE +putc_unlocked SIGFE +_putc_unlocked = putc_unlocked SIGFE +putchar NOSIGFE +_putchar = putchar NOSIGFE +putchar_unlocked NOSIGFE +_putchar_unlocked = putchar_unlocked NOSIGFE +putenv SIGFE +_putenv = putenv SIGFE +puts SIGFE +_puts = puts SIGFE +pututline SIGFE +_pututline = pututline SIGFE +putw SIGFE +_putw = putw SIGFE +qsort NOSIGFE +_qsort = qsort NOSIGFE +raise SIGFE +_raise = raise SIGFE +rand NOSIGFE +_rand = rand NOSIGFE +random NOSIGFE +read SIGFE +_read = read SIGFE +readdir SIGFE +_readdir = readdir SIGFE +readlink SIGFE +_readlink = readlink SIGFE +readv SIGFE +_readv = readv SIGFE +realloc SIGFE +_realloc = realloc SIGFE +realpath SIGFE +remainder NOSIGFE +_remainder = remainder NOSIGFE +remainderf NOSIGFE +_remainderf = remainderf NOSIGFE +remove SIGFE +_remove = remove SIGFE +remquo NOSIGFE +remquof NOSIGFE +rename SIGFE +_rename = rename SIGFE +revoke SIGFE +rewind SIGFE +_rewind = rewind SIGFE +rewinddir SIGFE +_rewinddir = rewinddir SIGFE +rindex NOSIGFE +_rindex = rindex NOSIGFE +rint NOSIGFE +_rint = rint NOSIGFE +rintf NOSIGFE +_rintf = rintf NOSIGFE +rmdir SIGFE +_rmdir = rmdir SIGFE +round NOSIGFE +roundf NOSIGFE +sbrk SIGFE +_sbrk = sbrk SIGFE +scalb NOSIGFE +_scalb = scalb NOSIGFE +scalbf NOSIGFE +_scalbf = scalbf NOSIGFE +scalbln NOSIGFE +scalblnf NOSIGFE +scalbn NOSIGFE +_scalbn = scalbn NOSIGFE +scalbnf NOSIGFE +_scalbnf = scalbnf NOSIGFE +scandir SIGFE +_scandir = scandir SIGFE +scanf SIGFE +_scanf = scanf SIGFE +sched_get_priority_max SIGFE +sched_get_priority_min SIGFE +sched_getparam SIGFE +sched_getscheduler NOSIGFE +sched_rr_get_interval SIGFE +sched_setparam SIGFE +sched_setscheduler SIGFE +sched_yield SIGFE +seed48 NOSIGFE +_seed48 = seed48 NOSIGFE +seekdir SIGFE +_seekdir = seekdir SIGFE +_seekdir64 = seekdir64 SIGFE +sem_close SIGFE +sem_destroy NOSIGFE +sem_getvalue SIGFE +sem_init SIGFE +sem_open SIGFE +sem_post SIGFE +sem_timedwait SIGFE +sem_trywait SIGFE +sem_wait SIGFE +semctl SIGFE +semget SIGFE +semop SIGFE +setbuf SIGFE +_setbuf = setbuf SIGFE +setbuffer SIGFE +setdtablesize SIGFE +_setdtablesize = setdtablesize SIGFE +setegid SIGFE +_setegid = setegid SIGFE +_setegid32 = setegid32 SIGFE +setenv SIGFE +_setenv = setenv SIGFE +seteuid SIGFE +_seteuid = seteuid SIGFE +_seteuid32 = seteuid32 SIGFE +setgid SIGFE +_setgid = setgid SIGFE +_setgid32 = setgid32 SIGFE +setgrent NOSIGFE +_setgrent = setgrent NOSIGFE +setgroups SIGFE +_setgroups = setgroups SIGFE +_setgroups32 = setgroups32 SIGFE +sethostent NOSIGFE +setitimer SIGFE +setjmp NOSIGFE +_setjmp = setjmp NOSIGFE +setlinebuf SIGFE +setlocale NOSIGFE +_setlocale = setlocale NOSIGFE +setlogmask NOSIGFE +setmntent SIGFE +_setmntent = setmntent SIGFE +setmode SIGFE +_setmode = setmode SIGFE +setpassent NOSIGFE +_setpassent = setpassent NOSIGFE +setpgid SIGFE +_setpgid = setpgid SIGFE +setpgrp SIGFE +_setpgrp = setpgrp SIGFE +setpwent NOSIGFE +_setpwent = setpwent NOSIGFE +setregid SIGFE +_setregid = setregid SIGFE +setregid32 SIGFE +_setregid32 = setregid32 SIGFE +setreuid SIGFE +_setreuid = setreuid SIGFE +setreuid32 SIGFE +_setreuid32 = setreuid32 SIGFE +setrlimit SIGFE +_setrlimit = setrlimit SIGFE +setsid SIGFE +_setsid = setsid SIGFE +setstate NOSIGFE +settimeofday SIGFE +_settimeofday = settimeofday SIGFE +setuid SIGFE +_setuid = setuid SIGFE +_setuid32 = setuid32 SIGFE +setutent SIGFE +_setutent = setutent SIGFE +setvbuf SIGFE +_setvbuf = setvbuf SIGFE +sexecl = sexecve_is_bad SIGFE +sexecle = sexecve_is_bad SIGFE +sexeclp = sexecve_is_bad SIGFE +sexeclpe = sexecve_is_bad SIGFE +sexecp = sexecve_is_bad SIGFE +sexecv = sexecve_is_bad SIGFE +sexecve = sexecve_is_bad SIGFE +sexecvpe = sexecve_is_bad SIGFE +shmat SIGFE +shmctl SIGFE +shmdt SIGFE +shmget SIGFE +sigaction SIGFE +sigaddset SIGFE +sigdelset SIGFE +sigemptyset NOSIGFE +sigfillset NOSIGFE +siginterrupt SIGFE +sigismember SIGFE +signal SIGFE +significand NOSIGFE +significandf NOSIGFE +sigpause SIGFE +sigpending SIGFE +sigprocmask SIGFE +sigsuspend SIGFE +sigwait SIGFE +sigwaitinfo SIGFE +sin NOSIGFE +_sin = sin NOSIGFE +sincos NOSIGFE +sincosf NOSIGFE +sinf NOSIGFE +_sinf = sinf NOSIGFE +sinh NOSIGFE +_sinh = sinh NOSIGFE +sinhf NOSIGFE +_sinhf = sinhf NOSIGFE +siprintf SIGFE +_siprintf = siprintf SIGFE +sleep SIGFE +_sleep = sleep SIGFE +snprintf SIGFE +_snprintf = snprintf SIGFE +socketpair SIGFE +spawnl SIGFE +_spawnl = spawnl SIGFE +spawnle SIGFE +_spawnle = spawnle SIGFE +spawnlp SIGFE +_spawnlp = spawnlp SIGFE +spawnlpe SIGFE +_spawnlpe = spawnlpe SIGFE +spawnv SIGFE +_spawnv = spawnv SIGFE +spawnve SIGFE +_spawnve = spawnve SIGFE +spawnvp SIGFE +_spawnvp = spawnvp SIGFE +spawnvpe SIGFE +_spawnvpe = spawnvpe SIGFE +sprintf SIGFE +_sprintf = sprintf SIGFE +sqrt NOSIGFE +_sqrt = sqrt NOSIGFE +sqrtf NOSIGFE +_sqrtf = sqrtf NOSIGFE +srand NOSIGFE +_srand = srand NOSIGFE +srand48 NOSIGFE +_srand48 = srand48 NOSIGFE +srandom NOSIGFE +sscanf SIGFE +_sscanf = sscanf SIGFE +_stat64 = stat64 SIGFE +statfs SIGFE +_statfs = statfs SIGFE +strcasecmp NOSIGFE +_strcasecmp = strcasecmp NOSIGFE +strcat NOSIGFE +_strcat = strcat NOSIGFE +strchr NOSIGFE +_strchr = strchr NOSIGFE +strcmp NOSIGFE +_strcmp = strcmp NOSIGFE +strcoll NOSIGFE +_strcoll = strcoll NOSIGFE +strcpy NOSIGFE +_strcpy = strcpy NOSIGFE +strcspn NOSIGFE +_strcspn = strcspn NOSIGFE +strdup SIGFE +_strdup = strdup SIGFE +strerror NOSIGFE +_strerror = strerror NOSIGFE +strerror_r NOSIGFE +_strerror_r = strerror_r NOSIGFE +strftime SIGFE +_strftime = strftime SIGFE +strlcat NOSIGFE +_strlcat = strlcat NOSIGFE +strlcpy NOSIGFE +_strlcpy = strlcpy NOSIGFE +strlen NOSIGFE +_strlen = strlen NOSIGFE +strlwr NOSIGFE +_strlwr = strlwr NOSIGFE +strncasecmp NOSIGFE +_strncasecmp = strncasecmp NOSIGFE +strncat NOSIGFE +_strncat = strncat NOSIGFE +strncmp NOSIGFE +_strncmp = strncmp NOSIGFE +strncpy NOSIGFE +_strncpy = strncpy NOSIGFE +strndup SIGFE +strnlen NOSIGFE +strpbrk NOSIGFE +_strpbrk = strpbrk NOSIGFE +strptime SIGFE +_strptime = strptime SIGFE +strrchr NOSIGFE +_strrchr = strrchr NOSIGFE +strsep NOSIGFE +_strsep = strsep NOSIGFE +strsignal SIGFE +strspn NOSIGFE +_strspn = strspn NOSIGFE +strstr NOSIGFE +_strstr = strstr NOSIGFE +strtod SIGFE +_strtod = strtod SIGFE +strtof SIGFE +_strtodf = strtof SIGFE +strtodf = strtof SIGFE +strtok NOSIGFE +_strtok = strtok NOSIGFE +strtok_r NOSIGFE +_strtok_r = strtok_r NOSIGFE +strtol NOSIGFE +_strtol = strtol NOSIGFE +strtoll NOSIGFE +_strtoll = strtoll NOSIGFE +strtosigno SIGFE +strtoul NOSIGFE +_strtoul = strtoul NOSIGFE +strtoull NOSIGFE +_strtoull = strtoull NOSIGFE +strupr NOSIGFE +_strupr = strupr NOSIGFE +strxfrm NOSIGFE +_strxfrm = strxfrm NOSIGFE +swab NOSIGFE +_swab = swab NOSIGFE +symlink SIGFE +_symlink = symlink SIGFE +sync NOSIGFE +_sync = sync NOSIGFE +sysconf SIGFE +_sysconf = sysconf SIGFE +syslog SIGFE +_syslog = syslog SIGFE +vsyslog SIGFE +system SIGFE +_system = system SIGFE +tan NOSIGFE +_tan = tan NOSIGFE +tanf NOSIGFE +_tanf = tanf NOSIGFE +tanh NOSIGFE +_tanh = tanh NOSIGFE +tanhf NOSIGFE +_tanhf = tanhf NOSIGFE +tcdrain SIGFE +_tcdrain = tcdrain SIGFE +tcflow SIGFE +_tcflow = tcflow SIGFE +tcflush SIGFE +_tcflush = tcflush SIGFE +tcgetattr SIGFE +_tcgetattr = tcgetattr SIGFE +tcgetpgrp SIGFE +_tcgetpgrp = tcgetpgrp SIGFE +tcsendbreak SIGFE +_tcsendbreak = tcsendbreak SIGFE +tcsetattr SIGFE +_tcsetattr = tcsetattr SIGFE +tcsetpgrp SIGFE +_tcsetpgrp = tcsetpgrp SIGFE +tdelete SIGFE +tdestroy NOSIGFE +telldir SIGFE +_telldir = telldir SIGFE +_telldir64 = telldir64 SIGFE +tempnam SIGFE +_tempnam = tempnam SIGFE +tfind NOSIGFE +tgamma NOSIGFE +tgammaf NOSIGFE +time SIGFE +_time = time SIGFE +timer_create SIGFE +timer_delete SIGFE +timer_settime SIGFE +times SIGFE +_times = times SIGFE +timezone SIGFE +tmpfile SIGFE +_tmpfile = tmpfile SIGFE +_tmpfile64 = tmpfile64 SIGFE +tmpnam SIGFE +_tmpnam = tmpnam SIGFE +toascii NOSIGFE +_toascii = toascii NOSIGFE +tolower NOSIGFE +_tolower = tolower NOSIGFE +toupper NOSIGFE +_toupper = toupper NOSIGFE +towctrans NOSIGFE +towlower NOSIGFE +towupper NOSIGFE +truncate SIGFE +_truncate = truncate SIGFE +_truncate64 = truncate64 SIGFE +truncf NOSIGFE +tsearch SIGFE +ttyname SIGFE +_ttyname = ttyname SIGFE +ttyslot NOSIGFE +twalk NOSIGFE +tzset SIGFE +_tzset = tzset SIGFE +ualarm SIGFE +_ualarm = ualarm SIGFE +umask NOSIGFE +_umask = umask NOSIGFE +umount SIGFE +_umount = umount SIGFE +uname SIGFE +_uname = uname SIGFE +ungetc SIGFE +_ungetc = ungetc SIGFE +unlink SIGFE +_unlink = unlink SIGFE +unlockpt NOSIGFE +unsetenv NOSIGFE +_unsetenv = unsetenv NOSIGFE +usleep SIGFE +_usleep = usleep SIGFE +utime SIGFE +_utime = utime SIGFE +utimes SIGFE +_utimes = utimes SIGFE +utmpname SIGFE +_utmpname = utmpname SIGFE +valloc SIGFE +vasprintf SIGFE +_vasprintf = vasprintf SIGFE +verr SIGFE +verrx SIGFE +vwarn SIGFE +vwarnx SIGFE +vfiprintf SIGFE +_vfiprintf = vfiprintf SIGFE +vfork SIGFE +_vfork = vfork SIGFE +vfprintf SIGFE +_vfprintf = vfprintf SIGFE +vfscanf SIGFE +_vfscanf = vfscanf SIGFE +vhangup SIGFE +_vhangup = vhangup SIGFE +vprintf SIGFE +_vprintf = vprintf SIGFE +vscanf SIGFE +_vscanf = vscanf SIGFE +vsnprintf SIGFE +_vsnprintf = vsnprintf SIGFE +vsprintf SIGFE +_vsprintf = vsprintf SIGFE +vsscanf SIGFE +_vsscanf = vsscanf SIGFE +wait SIGFE +_wait = wait SIGFE +wait3 SIGFE +wait4 SIGFE +waitpid SIGFE +_waitpid = waitpid SIGFE +warn SIGFE +warnx SIGFE +wcrtomb NOSIGFE +wcscat NOSIGFE +wcschr NOSIGFE +wcscmp NOSIGFE +_wcscmp = wcscmp NOSIGFE +wcscoll NOSIGFE +wcscpy NOSIGFE +wcscspn NOSIGFE +wcslcat NOSIGFE +wcslcpy NOSIGFE +wcslen NOSIGFE +_wcslen = wcslen NOSIGFE +wcsncat NOSIGFE +wcsncmp NOSIGFE +wcsncpy NOSIGFE +wcspbrk NOSIGFE +wcsrchr NOSIGFE +wcsrtombs NOSIGFE +wcsspn NOSIGFE +wcsstr NOSIGFE +wcstombs NOSIGFE +_wcstombs = wcstombs NOSIGFE +wcswidth NOSIGFE +wctob NOSIGFE +wctomb NOSIGFE +_wctomb = wctomb NOSIGFE +wctrans NOSIGFE +wctype NOSIGFE +wcwidth NOSIGFE +wmemchr NOSIGFE +wmemcmp NOSIGFE +wmemcpy NOSIGFE +wmemmove NOSIGFE +wmemset NOSIGFE +wprintf SIGFE +_wprintf = wprintf SIGFE +write SIGFE +_write = write SIGFE +writev SIGFE +_writev = writev SIGFE +y0 NOSIGFE +y0f NOSIGFE +y1 NOSIGFE +y1f NOSIGFE +yn NOSIGFE +ynf NOSIGFE diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index cdb20f20c67..1e9745b2266 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -935,40 +935,52 @@ sigpacket::process () } int rc = 1; - bool insigwait_mask = tls ? sigismember (&tls->sigwait_mask, si.si_signo) : false; - bool special_case = ISSTATE (myself, PID_STOPPED) || main_vfork->pid; - bool masked = sigismember (mask, si.si_signo); - if (si.si_signo != SIGKILL && si.si_signo != SIGSTOP - && (special_case || main_vfork->pid || masked || insigwait_mask - || (tls && sigismember (&tls->sigmask, si.si_signo)))) - { - sigproc_printf ("signal %d blocked", si.si_signo); - if ((!special_case && !masked) - && (insigwait_mask || (tls = _threadinfo::find_tls (si.si_signo)) != NULL)) - goto thread_specific; - rc = -1; - goto done; - } - - /* Clear pending SIGCONT on stop signals */ - if (si.si_signo == SIGSTOP || si.si_signo == SIGTSTP || si.si_signo == SIGTTIN || si.si_signo == SIGTTOU) - sig_clear (SIGCONT); sigproc_printf ("signal %d processing", si.si_signo); struct sigaction thissig = global_sigs[si.si_signo]; - void *handler; - handler = (void *) thissig.sa_handler; myself->rusage_self.ru_nsignals++; if (si.si_signo == SIGKILL) goto exit_sig; + if ( si.si_signo == SIGSTOP) + { + sig_clear (SIGCONT); + goto stop; + } + + bool masked; + bool special_case; + bool insigwait_mask; + insigwait_mask = masked = false; + if (special_case = (main_vfork->pid || ISSTATE (myself, PID_STOPPED))) + /* nothing to do */; + else if (tls && sigismember (&tls->sigwait_mask, si.si_signo)) + insigwait_mask = true; + else if (!tls && (tls = _threadinfo::find_tls (si.si_signo))) + insigwait_mask = true; + else if (!(masked = sigismember (mask, si.si_signo)) && tls) + masked = sigismember (&tls->sigmask, si.si_signo); + + if (insigwait_mask) + goto thread_specific; if (!tls) tls = _main_tls; - if (si.si_signo == SIGSTOP) - goto stop; + if (special_case || masked) + { + sigproc_printf ("signal %d blocked", si.si_signo); + rc = -1; + goto done; + } + + void *handler; + handler = (void *) thissig.sa_handler; + + /* Clear pending SIGCONT on stop signals */ + if (si.si_signo == SIGTSTP || si.si_signo == SIGTTIN || si.si_signo == SIGTTOU) + sig_clear (SIGCONT); #if 0 char sigmsg[24]; @@ -1025,6 +1037,7 @@ done: thread_specific: tls->sig = si.si_signo; + tls->set_siginfo (this); sigproc_printf ("releasing sigwait for thread"); SetEvent (tls->event); goto done; diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 407a47dddbc..2471ad22576 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -231,6 +231,7 @@ sync_with_parent (const char *s, bool hang_self) static int __stdcall fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) { + extern void fixup_timers_after_fork (); debug_printf ("child is running. pid %d, ppid %d, stack here %p", myself->pid, myself->ppid, __builtin_frame_address (0)); @@ -316,6 +317,7 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) (*t)->set (); pthread::atforkchild (); + fixup_timers_after_fork (); wait_for_sigthread (); cygbench ("fork-child"); return 0; diff --git a/winsup/cygwin/include/cygwin/signal.h b/winsup/cygwin/include/cygwin/signal.h index 20ab1c3a3df..87af7c883dd 100644 --- a/winsup/cygwin/include/cygwin/signal.h +++ b/winsup/cygwin/include/cygwin/signal.h @@ -1,3 +1,13 @@ +/* signal.h + + Copyright 2004 Red Hat, Inc. + + This file is part of Cygwin. + + This software is a copyrighted work licensed under the terms of the + Cygwin license. Please consult the file "CYGWIN_LICENSE" for + details. */ + #ifndef _CYGWIN_SIGNAL_H #define _CYGWIN_SIGNAL_H @@ -22,6 +32,15 @@ typedef union sigval void *sival_ptr; /* pointer signal value */ } sigval_t; +typedef struct sigevent +{ + sigval_t sigev_value; /* signal value */ + int sigev_signo; /* signal number */ + int sigev_notify; /* notification type */ + void (*sigev_notify_function) (sigval_t); /* notification function */ + pthread_attr_t *sigev_notify_attributes; /* notification attributes */ +} sigevent_t; + #pragma pack(push,4) typedef struct { @@ -43,11 +62,12 @@ typedef struct { struct { - unsigned int si_tid; /* timer id */ + timer_t si_tid; /* timer id */ unsigned int si_overrun; /* overrun count */ }; + sigval_t si_sigval; /* signal value */ + sigval_t si_value; /* signal value */ }; - sigval_t si_sigval; /* signal value */ }; }; @@ -110,15 +130,6 @@ enum CLD_CONTINUED /* stopped child has continued */ }; -typedef struct sigevent -{ - sigval_t sigev_value; /* signal value */ - int sigev_signo; /* signal number */ - int sigev_notify; /* notification type */ - void (*sigev_notify_function) (sigval_t); /* notification function */ - pthread_attr_t *sigev_notify_attributes; /* notification attributes */ -} sigevent_t; - enum { SIGEV_SIGNAL = 0, /* a queued signal, with an application diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h new file mode 100644 index 00000000000..e8b557797fa --- /dev/null +++ b/winsup/cygwin/include/cygwin/version.h @@ -0,0 +1,309 @@ +/* version.h -- Cygwin version numbers and accompanying documentation. + + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +/* Cygwin versioning is relatively complicated because of its status + as a shared library. Let's start with how versioning used to be done. + + Historical versioning in Cygwin 16.0 to 19.5: + + In the olden days of Cygwin, we had a dll major and minor version + and a registry version. The major number started at 16 because the + "b15" GNU-Win32 release of the compiler tools was out when this + scheme was started. We incremented the DLL name frequently (for + every official release) and towards the end of this period every + release used a different shared memory area to prevent DLLs from + interfering with each other (embedding a build timestamp into the + name of the shared memory area). This turned out to be a Bad Idea + (tm) because people needed to mingle separate releases and have + them work together more than we thought they would. This was + especially problematic when tty info needed to be retained when an + old Cygwin executable executed a newer one. + + In the old scheme, we incremented the major number whenever a + change to the dll invalidated existing executables. This can + happen for a number of reasons, including when functions are + removed from the export list of the dll. The minor number was + incremented when a change was made that we wanted to record, but + that didn't invalidate existing executables. Both numbers were + recorded in the executable and in the dll. + + In October 1998 (starting with Cygwin 19.6), we started a new method + of Cygwin versioning: */ + + /* The DLL major and minor numbers correspond to the "version of + the Cygwin shared library". This version is used to track important + changes to the DLL and is mainly informative in nature. */ + +#define CYGWIN_VERSION_DLL_MAJOR 1005 +#define CYGWIN_VERSION_DLL_MINOR 6 + + /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are + incompatible. */ + +#define CYGWIN_VERSION_DLL_EPOCH 19 + + /* CYGWIN_VERSION_DLL_COMBINED gives us a single number + representing the combined DLL major and minor numbers. */ + + /* WATCH OUT FOR OCTAL! Don't use, say, "00020" for 0.20 */ + +#define CYGWIN_VERSION_DLL_MAKE_COMBINED(maj, min) (((maj) * 1000) + min) +#define CYGWIN_VERSION_DLL_COMBINED \ + CYGWIN_VERSION_DLL_MAKE_COMBINED (CYGWIN_VERSION_DLL_MAJOR, CYGWIN_VERSION_DLL_MINOR) + + /* Every version of cygwin <= this uses an old, incorrect method + to determine signal masks. */ + +#define CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK 19005 + + /* API versions <= this had a termios structure whose members were + too small to accomodate modern settings. */ +#define CYGWIN_VERSION_DLL_OLD_TERMIOS 5 +#define CYGWIN_VERSION_DLL_IS_OLD_TERMIOS \ + (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \ + CYGWIN_VERSION_DLL_OLD_TERMIOS) + +#define CYGWIN_VERSION_DLL_MALLOC_ENV 28 + /* Old APIs had getc/putc macros that conflict with new CR/LF + handling in the stdio buffers */ +#define CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING \ + (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \ + 20) + +#define CYGWIN_VERSION_CHECK_FOR_S_IEXEC \ + (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) >= \ + 36) + +#define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK \ + (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \ + 28) + +#define CYGWIN_VERSION_CHECK_FOR_USING_BIG_TYPES \ + (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) >= \ + 79) + /* We used to use the DLL major/minor to track + non-backward-compatible interface changes to the API. Now we + use an API major/minor number for this purpose. */ + + /* API_MAJOR 0.0: Initial version. API_MINOR changes: + 1: Export cygwin32_ calls as cygwin_ as well. + 2: Export j1, jn, y1, yn. + 3: Export dll_noncygwin_dllcrt0. + 4: New socket ioctls, revamped ifconf support. + 5: Thread support/exports. + 6: Change in termios handling. + 7: Export scandir and alphasort. + 8: Export _ctype_, _sys_errlist, _sys_nerr. + 9: Mount-related changes, new cygwin_umount export. + Raw device support (tape, floppies). + 10: Fast math routine support added. + 11: Export seekdir, telldir. + 12: Export pthread_join, pthread_detach. + 13: Export math funcs gamma and friends, also _j0, _j1, etc. + 14: Export snprintf and vnsprintf. + 15: Export glob + 16: Export cygwin_stackdump + 17: Export fast math stuff + 18: Stop exporting _strace_wm + 19: Export fchown, lchown, lacl + 20: regsub, inet_network + 21: incompatible change to stdio cr/lf and buffering + 22: Export cygwin_logon_user, cygwin_set_impersonation_token. + geteuid, getegid return effective uid/gid. + getuid, getgid return real uid/gid. + seteuid, setegid set only effective uid/gid. + setuid, setgid set effective and real uid/gid. + 23: Export new dll_crt0 interface and cygwin_user_data for use + with crt0 startup code. + 24: Export poll and _poll. + 25: Export getmode and _getmode. + 26: CW_GET_CYGDRIVE_PREFIXES addition to external.cc + 27: CW_GETPINFO_FULL addition to external.cc + 28: Accidentally bumped by cgf + 29: Export hstrerror + 30: CW_GET_CYGDRIVE_INFO addition to external.cc + 31: Export inet_aton + 32: Export getrlimit/setrlimit + 33: Export setlogmask + 34: Separated out mount table + 35: Export drand48, erand48, jrand48, lcong48, lrand48, + mrand48, nrand48, seed48, and srand48. + 36: Added _cygwin_S_IEXEC, et al + 37: [f]pathconv support _PC_POSIX_PERMISSIONS and _PC_POSIX_SECURITY + 38: vscanf, vscanf_r, and random pthread functions + 39: asctime_r, ctime_r, gmtime_r, localtime_r + 40: fchdir + 41: __signgam + 42: sys_errlist, sys_nerr + 43: sigsetjmp, siglongjmp fixed + 44: Export dirfd + 45: perprocess change, gamma_r, gammaf_r, lgamma_r, lgammaf_r + 46: Remove cygwin_getshared + 47: Report EOTWarningZoneSize in struct mtget. + 48: Export "posix" regex functions + 49: Export setutent, endutent, utmpname, getutent, getutid, getutline. + 50: Export fnmatch. + 51: Export recvmsg, sendmsg. + 52: Export strptime + 53: Export strlcat, strlcpy. + 54: Export __fpclassifyd, __fpclassifyf, __signbitd, __signbitf. + 55: Export fcloseall, fcloseall_r. + 56: Make ntsec on by default. + 57: Export setgroups. + 58: Export memalign, valloc, malloc_trim, malloc_usable_size, mallopt, + malloc_stats + 59: getsid + 60: MSG_NOSIGNAL + 61: Export getc_unlocked, getchar_unlocked, putc_unlocked, + putchar_unlocked + 62: Erroneously bumped + 63: Export pututline + 64: Export fseeko, ftello + 65: Export siginterrupt + 66: Export nl_langinfo + 67: Export pthread_getsequence_np + 68: Export netdb stuff + 69: Export strtof + 70: Export asprintf, _asprintf_r, vasprintf, _vasprintf_r + 71: Export strerror_r + 72: Export nanosleep + 73: Export setreuid32, setreuid, setregid32, setregid + 74: Export _strtold a64l hcreate hcreate_r hdestroy hdestroy_r hsearch + hsearch_r isblank iswalnum iswalpha iswblank iswcntrl iswctype + iswdigit iswgraph iswlower iswprint iswpunct iswspace iswupper + iswxdigit l64a mbrlen mbrtowc mbsinit mbsrtowcs mempcpy + on_exit setbuffer setlinebuf strndup strnlen tdelete tdestroy + tfind towctrans towlower towupper tsearch twalk wcrtomb wcscat + wcschr wcscpy wcscspn wcslcat wcslcpy wcsncat wcsncmp wcsncpy + wcspbrk wcsrchr wcsrtombs wcsspn wcsstr wctob wctob wctrans + wctype wmemchr wmemcmp wmemcpy wmemmove wmemset + 75: Export exp2 exp2f fdim fdimf fma fmaf fmax fmaxf fmin fminf lrint + lrintf lround lroundf nearbyint nearbyintf remquo remquof + round roundf scalbln scalblnf sincos sincosf tgamma tgammaf + truncf + 76: mallinfo + 77: thread-safe exit/at_exit + 78: Use stat and fstat rather than _stat, and _fstat. + Export btowc and trunc. + 79: Export acl32 aclcheck32 aclfrommode32 aclfrompbits32 aclfromtext32 + aclsort32 acltomode32 acltopbits32 acltotext32 facl32 + fgetpos64 fopen64 freopen64 fseeko64 fsetpos64 ftello64 + _open64 _lseek64 _fstat64 _stat64 mknod32 + 80: Export pthread_rwlock stuff + 81: CW_CHECK_NTSEC addition to external.cc + 82: Export wcscoll wcswidth wcwidth + 83: Export gethostid + 84: Pty open allocates invisible console. 64 bit interface + 85: Export new 32/64 functions from API 0.79 only with leading + underscore. No problems with backward compatibility since no + official release has been made so far. This change removes + exported symbols like fopen64, which might confuse configure. + 86: Export ftok + 87: Export vsyslog + 88: Export _getreent + 89: Export __mempcpy + 90: Export _fopen64 + 91: Export argz_add argz_add_sep argz_append argz_count argz_create + argz_create_sep argz_delete argz_extract argz_insert + argz_next argz_replace argz_stringify envz_add envz_entry + envz_get envz_merge envz_remove envz_strip + 92: Export getusershell, setusershell, endusershell + 93: Export daemon, forkpty, openpty, iruserok, ruserok, login_tty, + openpty, forkpty, revoke, logwtmp, updwtmp + 94: Export getopt, getopt_long, optarg, opterr, optind, optopt, + optreset, __check_rhosts_file, __rcmd_errstr. + 95: Export shmat, shmctl, shmdt, shmget. + 96: CW_GET_ERRNO_FROM_WINERROR addition to external.cc + 97: Export sem_open, sem_close, sem_timedwait, sem_getvalue. + 98: Export _tmpfile64. + 99: CW_GET_POSIX_SECURITY_ATTRIBUTE addition to external.cc. + 100: CW_GET_SHMLBA addition to external.cc. + 101: Export err, errx, verr, verrx, warn, warnx, vwarn, vwarnx. + 102: CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID addition to external.cc. + 103: Export getprogname, setprogname. + 104: Export msgctl, msgget, msgrcv, msgsnd, semctl, semget, semop. + 105: Export sigwait. + 106: Export flock. + 107: Export fcntl64. + 108: Remove unused (hopefully) reent_data export. + 109: Export clock_gettime, sigwaitinfo, timer_create, timer_delete, + timer_settime + */ + + /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ + +#define CYGWIN_VERSION_API_MAJOR 0 +#define CYGWIN_VERSION_API_MINOR 109 + + /* There is also a compatibity version number associated with the + shared memory regions. It is incremented when incompatible + changes are made to the shared memory region *or* to any named + shared mutexes, semaphores, etc. The arbitrary starting + version was 0 (cygwin release 98r2). */ + +#define CYGWIN_VERSION_SHARED_DATA 3 + + /* An identifier used in the names used to create shared objects. + The full names include the CYGWIN_VERSION_SHARED_DATA version + as well as this identifier. */ + +#define CYGWIN_VERSION_DLL_IDENTIFIER "cygwin1" + + /* The Cygwin mount table interface in the Win32 registry also + has a version number associated with it in case that is + changed in a non-backwards compatible fashion. Increment this + version number whenever incompatible changes in mount table + registry usage are made. + + 1: Original number version. + 2: New mount registry layout, system-wide mount accessibility. + */ + +#define CYGWIN_VERSION_MOUNT_REGISTRY 2 + + /* Identifiers used in the Win32 registry. */ + +#define CYGWIN_INFO_CYGNUS_REGISTRY_NAME "Cygnus Solutions" +#define CYGWIN_INFO_CYGWIN_REGISTRY_NAME "Cygwin" +#define CYGWIN_INFO_PROGRAM_OPTIONS_NAME "Program Options" +#define CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME "mounts v2" +#define CYGWIN_INFO_CYGDRIVE_FLAGS "cygdrive flags" +#define CYGWIN_INFO_CYGDRIVE_PREFIX "cygdrive prefix" +#define CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX "/cygdrive" + + /* In addition to the above version number strings, the build + process adds some strings that may be useful in + debugging/identifying a particular Cygwin DLL: + + The mkvers.sh script at the top level produces a .cc file + which initializes a cygwin_version structure based on the + above version information and creates a string table for + grepping via "fgrep '%%%' cygwinwhatever.dll" if you are + using GNU grep. Otherwise you may want to do a + "strings cygwinwhatever.dll | fgrep '%%%'" instead. + + This will produce output such as: + + %%% Cygwin dll_identifier: cygwin + %%% Cygwin api_major: 0 + %%% Cygwin api_minor: 0 + %%% Cygwin dll_major: 19 + %%% Cygwin dll_minor: 6 + %%% Cygwin shared_data: 1 + %%% Cygwin registry: b15 + %%% Cygwin build date: Wed Oct 14 16:26:51 EDT 1998 + %%% Cygwin shared id: cygwinS1 + + This information can also be obtained through a call to + cygwin_internal (CW_GETVERSIONINFO). + */ + +#define CYGWIN_VERSION_MAGIC(a, b) ((unsigned) ((((unsigned short) a) << 16) | (unsigned short) b)) +#define CYGWIN_VERSION_MAGIC_VERSION(a) ((unsigned) ((unsigned)a & 0xffff)) diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 4dde8127c69..d442b17f35f 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -481,11 +481,10 @@ siginterrupt (int sig, int flag) extern "C" int sigwait (const sigset_t *set, int *sig_ptr) { - siginfo_t si; - int pid = sigwaitinfo (set, NULL); - if (pid > 0) - *sig_ptr = pid; - return pid > 0 ? 0 : -1; + int sig = sigwaitinfo (set, NULL); + if (sig > 0) + *sig_ptr = sig; + return sig > 0 ? 0 : -1; } extern "C" int @@ -506,7 +505,8 @@ sigwaitinfo (const sigset_t *set, siginfo_t *info) switch (WaitForSingleObject (_my_tls.event, INFINITE)) { case WAIT_OBJECT_0: - res = _my_tls.infodata.si_pid; + res = _my_tls.infodata.si_signo; + sigproc_printf ("returning sig %d", res); if (info) *info = _my_tls.infodata; break; diff --git a/winsup/cygwin/timer.cc b/winsup/cygwin/timer.cc new file mode 100644 index 00000000000..8e836e9d483 --- /dev/null +++ b/winsup/cygwin/timer.cc @@ -0,0 +1,275 @@ +/* timer.cc + + Copyright 2004 Red Hat, Inc. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#include "winsup.h" +#include <time.h> +#include <stdlib.h> +#include "cygerrno.h" +#include "security.h" +#include "hires.h" +#include "thread.h" +#include "cygtls.h" +#include "cygthread.h" +#include "sigproc.h" +#include "sync.h" + +#define TT_MAGIC 0x513e4a1c +struct timer_tracker +{ + static muto *protect; + unsigned magic; + clockid_t clock_id; + sigevent evp; + itimerspec it; + HANDLE cancel; + int flags; + cygthread *th; + struct timer_tracker *next; + int settime (int, const itimerspec *, itimerspec *); + timer_tracker (clockid_t, const sigevent *); + timer_tracker (); +}; + +timer_tracker ttstart; + +muto *timer_tracker::protect; + +timer_tracker::timer_tracker () +{ + new_muto (protect); +} + +timer_tracker::timer_tracker (clockid_t c, const sigevent *e) +{ + if (e != NULL) + evp = *e; + else + { + evp.sigev_notify = SIGEV_SIGNAL; + evp.sigev_signo = SIGALRM; + evp.sigev_value.sival_ptr = this; + } + clock_id = c; + cancel = NULL; + flags = 0; + memset (&it, 0, sizeof (it)); + protect->acquire (); + next = ttstart.next; + ttstart.next = this; + protect->release (); + magic = TT_MAGIC; +} + +static long long +to_us (timespec& ts) +{ + long long res = ts.tv_sec; + res *= 1000000; + res += ts.tv_nsec / 1000 + ((ts.tv_nsec % 1000) >= 500 ? 1 : 0); + return res; +} + +static NO_COPY itimerspec itzero; +static NO_COPY timespec tzero; + +static DWORD WINAPI +timer_thread (VOID *x) +{ + timer_tracker *tp = ((timer_tracker *) x); + timer_tracker tt = *tp; + for (bool first = true; ; first = false) + { + long long sleep_us = to_us (first ? tt.it.it_value : tt.it.it_interval); + long long sleep_to = sleep_us; + long long now = gtod.usecs (false); + if (tt.flags & TIMER_ABSTIME) + sleep_us -= now; + else + sleep_to += now; + + DWORD sleep_ms = (sleep_us < 0) ? 0 : (sleep_us / 1000); + debug_printf ("%p waiting for %u ms, first %d", x, sleep_ms, first); + tp->it.it_value = tzero; + switch (WaitForSingleObject (tt.cancel, sleep_ms)) + { + case WAIT_TIMEOUT: + debug_printf ("timed out"); + break; + case WAIT_OBJECT_0: + now = gtod.usecs (false); + sleep_us = sleep_to - now; + if (sleep_us < 0) + sleep_us = 0; + tp->it.it_value.tv_sec = sleep_us / 1000000; + tp->it.it_value.tv_nsec = (sleep_us % 1000000) * 1000; + debug_printf ("%p cancelled, elapsed %D", x, sleep_us); + goto out; + default: + debug_printf ("%p timer wait failed, %E", x); + goto out; + } + + switch (tt.evp.sigev_notify) + { + case SIGEV_SIGNAL: + { + siginfo_t si; + memset (&si, 0, sizeof (si)); + si.si_signo = tt.evp.sigev_signo; + si.si_sigval.sival_ptr = tt.evp.sigev_value.sival_ptr; + debug_printf ("%p sending sig %d", x, tt.evp.sigev_signo); + sig_send (NULL, si); + break; + } + case SIGEV_THREAD: + { + pthread_t notify_thread; + debug_printf ("%p starting thread", x); + int rc = pthread_create (¬ify_thread, tt.evp.sigev_notify_attributes, + (void * (*) (void *)) tt.evp.sigev_notify_function, + &tt.evp.sigev_value); + if (rc) + { + debug_printf ("thread creation failed, %E"); + return 0; + } + // FIXME: pthread_join? + break; + } + } + if (!tt.it.it_interval.tv_sec && !tt.it.it_interval.tv_nsec) + break; + tt.flags = 0; + debug_printf ("looping"); + } + +out: + CloseHandle (tt.cancel); + // FIXME: race here but is it inevitable? + if (tt.cancel == tp->cancel) + tp->cancel = NULL; + return 0; +} + +static bool +it_bad (const timespec& t) +{ + if (t.tv_nsec < 0 || t.tv_nsec >= 1000000000 || t.tv_sec < 0) + { + set_errno (EINVAL); + return true; + } + return false; +} + +int +timer_tracker::settime (int in_flags, const itimerspec *value, itimerspec *ovalue) +{ + if (!value) + { + set_errno (EINVAL); + return -1; + } + + if (__check_invalid_read_ptr_errno (value, sizeof (*value))) + return -1; + + if (ovalue && check_null_invalid_struct_errno (ovalue)) + return -1; + + itimerspec *elapsed; + if (!cancel) + elapsed = &itzero; + else + { + SetEvent (cancel); // should be closed when the thread exits + th->detach (); + elapsed = ⁢ + } + + if (ovalue) + *ovalue = *elapsed; + + if (value->it_value.tv_sec || value->it_value.tv_nsec) + { + if (it_bad (value->it_value)) + return -1; + if (it_bad (value->it_interval)) + return -1; + flags = in_flags; + cancel = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL); + it = *value; + th = new cygthread (timer_thread, this, "itimer"); + } + + return 0; +} + +extern "C" int +timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid) +{ + if (evp && check_null_invalid_struct_errno (evp)) + return -1; + if (check_null_invalid_struct_errno (timerid)) + return -1; + + if (clock_id != CLOCK_REALTIME) + { + set_errno (EINVAL); + return -1; + } + + *timerid = (timer_t) new timer_tracker (clock_id, evp); + return 0; +} + +extern "C" int +timer_settime (timer_t timerid, int flags, const struct itimerspec *value, + struct itimerspec *ovalue) +{ + timer_tracker *tt = (timer_tracker *) timerid; + if (check_null_invalid_struct_errno (tt) || tt->magic != TT_MAGIC) + return -1; + return tt->settime (flags, value, ovalue); +} + +extern "C" int +timer_delete (timer_t timerid) +{ + timer_tracker *in_tt = (timer_tracker *) timerid; + if (check_null_invalid_struct_errno (in_tt) || in_tt->magic != TT_MAGIC) + return -1; + + timer_tracker::protect->acquire (); + for (timer_tracker *tt = &ttstart; tt->next != NULL; tt = tt->next) + if (tt->next == in_tt) + { + timer_tracker *deleteme = tt->next; + tt->next = deleteme->next; + delete deleteme; + timer_tracker::protect->release (); + return 0; + } + timer_tracker::protect->release (); + + set_errno (EINVAL); + return 0; +} + +void +fixup_timers_after_fork () +{ + for (timer_tracker *tt = &ttstart; tt->next != NULL; /* nothing */) + { + timer_tracker *deleteme = tt->next; + tt->next = deleteme->next; + delete deleteme; + } +} diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc new file mode 100644 index 00000000000..635d05a37ed --- /dev/null +++ b/winsup/cygwin/times.cc @@ -0,0 +1,682 @@ +/* times.cc + + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#include "winsup.h" +#include <time.h> +#include <sys/times.h> +#include <sys/timeb.h> +#include <utime.h> +#include <stdio.h> +#include <stdlib.h> +#include <pthread.h> +#include "cygerrno.h" +#include "security.h" +#include "path.h" +#include "fhandler.h" +#include "pinfo.h" +#include "hires.h" +#include "cygtls.h" +#include "cygthread.h" +#include "sigproc.h" +#include "sync.h" + +#define FACTOR (0x19db1ded53e8000LL) +#define NSPERSEC 10000000LL + +static void __stdcall timeval_to_filetime (timeval *time, FILETIME *out); + +/* Cygwin internal */ +static unsigned long long __stdcall +__to_clock_t (FILETIME * src, int flag) +{ + unsigned long long total = ((unsigned long long) src->dwHighDateTime << 32) + ((unsigned)src->dwLowDateTime); + syscall_printf ("dwHighDateTime %u, dwLowDateTime %u", src->dwHighDateTime, src->dwLowDateTime); + + /* Convert into clock ticks - the total is in 10ths of a usec. */ + if (flag) + total -= FACTOR; + + total /= (unsigned long long) (NSPERSEC / CLOCKS_PER_SEC); + syscall_printf ("total %08x %08x", (unsigned)(total>>32), (unsigned)(total)); + return total; +} + +/* times: POSIX 4.5.2.1 */ +extern "C" clock_t +times (struct tms *buf) +{ + FILETIME creation_time, exit_time, kernel_time, user_time; + + if (check_null_invalid_struct_errno (buf)) + return ((clock_t) -1); + + DWORD ticks = GetTickCount (); + /* Ticks is in milliseconds, convert to our ticks. Use long long to prevent + overflow. */ + clock_t tc = (clock_t) ((long long) ticks * CLOCKS_PER_SEC / 1000); + if (wincap.has_get_process_times ()) + { + GetProcessTimes (hMainProc, &creation_time, &exit_time, + &kernel_time, &user_time); + + syscall_printf ("ticks %d, CLOCKS_PER_SEC %d", ticks, CLOCKS_PER_SEC); + syscall_printf ("user_time %d, kernel_time %d, creation_time %d, exit_time %d", + user_time, kernel_time, creation_time, exit_time); + buf->tms_stime = __to_clock_t (&kernel_time, 0); + buf->tms_utime = __to_clock_t (&user_time, 0); + timeval_to_filetime (&myself->rusage_children.ru_stime, &kernel_time); + buf->tms_cstime = __to_clock_t (&kernel_time, 1); + timeval_to_filetime (&myself->rusage_children.ru_utime, &user_time); + buf->tms_cutime = __to_clock_t (&user_time, 1); + } + else + /* GetProcessTimes() does not work for non-NT versions of Windows. The + return values are undefined, so instead just copy the ticks value + into utime so that clock() will work properly on these systems */ + { + buf->tms_utime = tc; + buf->tms_stime = 0; + buf->tms_cstime = 0; + buf->tms_cutime = 0; + } + + return tc; +} + +extern "C" clock_t _times (struct tms *) __attribute__((alias ("times"))); + +/* settimeofday: BSD */ +extern "C" int +settimeofday (const struct timeval *tv, const struct timezone *tz) +{ + SYSTEMTIME st; + struct tm *ptm; + int res; + + tz = tz; /* silence warning about unused variable */ + + ptm = gmtime (&tv->tv_sec); + st.wYear = ptm->tm_year + 1900; + st.wMonth = ptm->tm_mon + 1; + st.wDayOfWeek = ptm->tm_wday; + st.wDay = ptm->tm_mday; + st.wHour = ptm->tm_hour; + st.wMinute = ptm->tm_min; + st.wSecond = ptm->tm_sec; + st.wMilliseconds = tv->tv_usec / 1000; + + res = !SetSystemTime (&st); + + syscall_printf ("%d = settimeofday (%x, %x)", res, tv, tz); + + return res; +} + +/* timezone: standards? */ +extern "C" char * +timezone () +{ + char *b = _my_tls.locals.timezone_buf; + + tzset (); + __small_sprintf (b,"GMT%+d:%02d", (int) (-_timezone / 3600), (int) (abs (_timezone / 60) % 60)); + return b; +} + +/* Cygwin internal */ +void __stdcall +totimeval (struct timeval *dst, FILETIME *src, int sub, int flag) +{ + long long x = __to_clock_t (src, flag); + + x *= (int) (1e6) / CLOCKS_PER_SEC; /* Turn x into usecs */ + x -= (long long) sub * (int) (1e6); + + dst->tv_usec = x % (long long) (1e6); /* And split */ + dst->tv_sec = x / (long long) (1e6); +} + +hires_ms gtod; +UINT NO_COPY hires_ms::minperiod; + +/* FIXME: Make thread safe */ +extern "C" int +gettimeofday (struct timeval *tv, struct timezone *tz) +{ + static bool tzflag; + LONGLONG now = gtod.usecs (false); + if (now == (LONGLONG) -1) + return -1; + + tv->tv_sec = now / 1000000; + tv->tv_usec = now % 1000000; + + if (tz != NULL) + { + if (!tzflag) + { + tzset (); + tzflag = true; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; +} + +extern "C" int _gettimeofday (struct timeval *, struct timezone *) + __attribute__((alias ("gettimeofday"))); + +/* Cygwin internal */ +void +time_t_to_filetime (time_t time_in, FILETIME *out) +{ + long long x = time_in * NSPERSEC + FACTOR; + out->dwHighDateTime = x >> 32; + out->dwLowDateTime = x; +} + +/* Cygwin internal */ +static void __stdcall +timeval_to_filetime (timeval *time_in, FILETIME *out) +{ + long long x = time_in->tv_sec * NSPERSEC + + time_in->tv_usec * (NSPERSEC/1000000) + FACTOR; + out->dwHighDateTime = x >> 32; + out->dwLowDateTime = x; +} + +/* Cygwin internal */ +static timeval __stdcall +time_t_to_timeval (time_t in) +{ + timeval res; + res.tv_sec = in; + res.tv_usec = 0; + return res; +} + +/* Cygwin internal */ +/* Convert a Win32 time to "UNIX" format. */ +long __stdcall +to_time_t (FILETIME *ptr) +{ + /* A file time is the number of 100ns since jan 1 1601 + stuffed into two long words. + A time_t is the number of seconds since jan 1 1970. */ + + long long x = ((long long) ptr->dwHighDateTime << 32) + ((unsigned)ptr->dwLowDateTime); + + /* pass "no time" as epoch */ + if (x == 0) + return 0; + + x -= FACTOR; /* number of 100ns between 1601 and 1970 */ + x /= (long long) NSPERSEC; /* number of 100ns in a second */ + return x; +} + +/* Cygwin internal */ +/* Convert a Win32 time to "UNIX" timestruc_t format. */ +void __stdcall +to_timestruc_t (FILETIME *ptr, timestruc_t *out) +{ + /* A file time is the number of 100ns since jan 1 1601 + stuffed into two long words. + A timestruc_t is the number of seconds and microseconds since jan 1 1970 + stuffed into a time_t and a long. */ + + long rem; + long long x = ((long long) ptr->dwHighDateTime << 32) + ((unsigned)ptr->dwLowDateTime); + + /* pass "no time" as epoch */ + if (x == 0) + { + out->tv_sec = 0; + out->tv_nsec = 0; + return; + } + + x -= FACTOR; /* number of 100ns between 1601 and 1970 */ + rem = x % ((long long)NSPERSEC); + x /= (long long) NSPERSEC; /* number of 100ns in a second */ + out->tv_nsec = rem * 100; /* as tv_nsec is in nanoseconds */ + out->tv_sec = x; +} + +/* Cygwin internal */ +/* Get the current time as a "UNIX" timestruc_t format. */ +void __stdcall +time_as_timestruc_t (timestruc_t * out) +{ + SYSTEMTIME systemtime; + FILETIME filetime; + + GetSystemTime (&systemtime); + SystemTimeToFileTime (&systemtime, &filetime); + to_timestruc_t (&filetime, out); +} + +/* time: POSIX 4.5.1.1, C 4.12.2.4 */ +/* Return number of seconds since 00:00 UTC on jan 1, 1970 */ +extern "C" time_t +time (time_t * ptr) +{ + time_t res; + SYSTEMTIME systemtime; + FILETIME filetime; + + GetSystemTime (&systemtime); + SystemTimeToFileTime (&systemtime, &filetime); + res = to_time_t (&filetime); + if (ptr) + *ptr = res; + + syscall_printf ("%d = time (%x)", res, ptr); + + return res; +} + +/* + * localtime_r.c + * Original Author: Adapted from tzcode maintained by Arthur David Olson. + * + * Converts the calendar time pointed to by tim_p into a broken-down time + * expressed as local time. Returns a pointer to a structure containing the + * broken-down time. + */ + +#define SECSPERMIN 60 +#define MINSPERHOUR 60 +#define HOURSPERDAY 24 +#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) +#define SECSPERDAY (SECSPERHOUR * HOURSPERDAY) +#define DAYSPERWEEK 7 +#define MONSPERYEAR 12 + +#define YEAR_BASE 1900 +#define EPOCH_YEAR 1970 +#define EPOCH_WDAY 4 + +#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) + +#if 0 /* POSIX_LOCALTIME */ + +static _CONST int mon_lengths[2][MONSPERYEAR] = { + {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, + {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} +}; + +static _CONST int year_lengths[2] = { + 365, + 366 +}; + +/* + * Convert a time_t into a struct tm *. + * Does NO timezone conversion. + */ + +/* Cygwin internal */ +static struct tm * __stdcall +corelocaltime (const time_t * tim_p) +{ + long days, rem; + int y; + int yleap; + _CONST int *ip; + struct tm &localtime_buf=_my_tls.locals.localtime_buf; + + time_t tim = *tim_p; + struct tm *res = &localtime_buf; + + days = ((long) tim) / SECSPERDAY; + rem = ((long) tim) % SECSPERDAY; + + while (rem < 0) + { + rem += SECSPERDAY; + --days; + } + while (rem >= SECSPERDAY) + { + rem -= SECSPERDAY; + ++days; + } + + /* compute hour, min, and sec */ + res->tm_hour = (int) (rem / SECSPERHOUR); + rem %= SECSPERHOUR; + res->tm_min = (int) (rem / SECSPERMIN); + res->tm_sec = (int) (rem % SECSPERMIN); + + /* compute day of week */ + if ((res->tm_wday = ((EPOCH_WDAY + days) % DAYSPERWEEK)) < 0) + res->tm_wday += DAYSPERWEEK; + + /* compute year & day of year */ + y = EPOCH_YEAR; + if (days >= 0) + { + for (;;) + { + yleap = isleap (y); + if (days < year_lengths[yleap]) + break; + y++; + days -= year_lengths[yleap]; + } + } + else + { + do + { + --y; + yleap = isleap (y); + days += year_lengths[yleap]; + } while (days < 0); + } + + res->tm_year = y - YEAR_BASE; + res->tm_yday = days; + ip = mon_lengths[yleap]; + for (res->tm_mon = 0; days >= ip[res->tm_mon]; ++res->tm_mon) + days -= ip[res->tm_mon]; + res->tm_mday = days + 1; + + /* set daylight saving time flag */ + res->tm_isdst = -1; + + syscall_printf ("%d = corelocaltime (%x)", res, tim_p); + + return (res); +} + +/* localtime: POSIX 8.1.1, C 4.12.3.4 */ +/* + * localtime takes a time_t (which is in UTC) + * and formats it into a struct tm as a local time. + */ +extern "C" struct tm * +localtime (const time_t *tim_p) +{ + time_t tim = *tim_p; + struct tm *rtm; + + tzset (); + + tim -= _timezone; + + rtm = corelocaltime (&tim); + + rtm->tm_isdst = _daylight; + + syscall_printf ("%x = localtime (%x)", rtm, tim_p); + + return rtm; +} + +/* gmtime: C 4.12.3.3 */ +/* + * gmtime takes a time_t (which is already in UTC) + * and just puts it into a struct tm. + */ +extern "C" struct tm * +gmtime (const time_t *tim_p) +{ + time_t tim = *tim_p; + + struct tm *rtm = corelocaltime (&tim); + /* UTC has no daylight savings time */ + rtm->tm_isdst = 0; + + syscall_printf ("%x = gmtime (%x)", rtm, tim_p); + + return rtm; +} + +#endif /* POSIX_LOCALTIME */ + +/* utimes: standards? */ +extern "C" int +utimes (const char *path, struct timeval *tvp) +{ + int res = 0; + struct timeval tmp[2]; + path_conv win32 (path); + + if (win32.error) + { + set_errno (win32.error); + syscall_printf ("-1 = utimes (%s, %x)", path, tvp); + return -1; + } + + /* MSDN suggests using FILE_FLAG_BACKUP_SEMANTICS for accessing + the times of directories. */ + /* Note: It's not documented in MSDN that FILE_WRITE_ATTRIBUTES is + sufficient to change the timestamps... */ + HANDLE h = CreateFile (win32, FILE_WRITE_ATTRIBUTES, + FILE_SHARE_READ | FILE_SHARE_WRITE, + &sec_none_nih, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, + 0); + + if (h == INVALID_HANDLE_VALUE) + { + if (win32.isdir ()) + { + /* What we can do with directories more? */ + res = 0; + } + else + { + res = -1; + __seterrno (); + } + } + else + { + if (tvp == 0) + { + gettimeofday (&tmp[0], 0); + tmp[1] = tmp[0]; + tvp = tmp; + } + + FILETIME lastaccess; + FILETIME lastwrite; + + timeval_to_filetime (tvp + 0, &lastaccess); + timeval_to_filetime (tvp + 1, &lastwrite); + + debug_printf ("incoming lastaccess %08x %08x", + tvp->tv_sec, + tvp->tv_usec); + +// dump_filetime (lastaccess); +// dump_filetime (lastwrite); + + /* FIXME: SetFileTime needs a handle with a write lock + on the file whose time is being modified. So calls to utime() + fail for read only files. */ + + if (!SetFileTime (h, 0, &lastaccess, &lastwrite)) + { + __seterrno (); + res = -1; + } + else + res = 0; + CloseHandle (h); + } + + syscall_printf ("%d = utimes (%s, %x); (h%d)", + res, path, tvp, h); + return res; +} + +/* utime: POSIX 5.6.6.1 */ +extern "C" int +utime (const char *path, struct utimbuf *buf) +{ + struct timeval tmp[2]; + + if (buf == 0) + return utimes (path, 0); + + debug_printf ("incoming utime act %x", buf->actime); + tmp[0] = time_t_to_timeval (buf->actime); + tmp[1] = time_t_to_timeval (buf->modtime); + + return utimes (path, tmp); +} + +/* ftime: standards? */ +extern "C" int +ftime (struct timeb *tp) +{ + struct timeval tv; + struct timezone tz; + + if (gettimeofday (&tv, &tz) < 0) + return -1; + + tp->time = tv.tv_sec; + tp->millitm = tv.tv_usec / 1000; + tp->timezone = tz.tz_minuteswest; + tp->dstflag = tz.tz_dsttime; + + return 0; +} + +/* obsolete, changed to cygwin_tzset when localtime.c was added - dj */ +extern "C" void +cygwin_tzset () +{ +} + +void +hires_us::prime () +{ + LARGE_INTEGER ifreq; + if (!QueryPerformanceFrequency (&ifreq)) + { + inited = -1; + return; + } + + FILETIME f; + int priority = GetThreadPriority (GetCurrentThread ()); + SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL); + if (!QueryPerformanceCounter (&primed_pc)) + { + SetThreadPriority (GetCurrentThread (), priority); + inited = -1; + return; + } + + GetSystemTimeAsFileTime (&f); + SetThreadPriority (GetCurrentThread (), priority); + + inited = 1; + primed_ft.HighPart = f.dwHighDateTime; + primed_ft.LowPart = f.dwLowDateTime; + primed_ft.QuadPart -= FACTOR; + primed_ft.QuadPart /= 10; + freq = (double) ((double) 1000000. / (double) ifreq.QuadPart); + return; +} + +LONGLONG +hires_us::usecs (bool justdelta) +{ + if (!inited) + prime (); + if (inited < 0) + { + set_errno (ENOSYS); + return (long long) -1; + } + + LARGE_INTEGER now; + if (!QueryPerformanceCounter (&now)) + { + set_errno (ENOSYS); + return -1; + } + + // FIXME: Use round() here? + now.QuadPart = (LONGLONG) (freq * (double) (now.QuadPart - primed_pc.QuadPart)); + LONGLONG res = justdelta ? now.QuadPart : primed_ft.QuadPart + now.QuadPart; + return res; +} + +UINT +hires_ms::prime () +{ + TIMECAPS tc; + FILETIME f; + + if (!minperiod) + if (timeGetDevCaps (&tc, sizeof (tc)) != TIMERR_NOERROR) + minperiod = 1; + else + { + minperiod = min (max (tc.wPeriodMin, 1), tc.wPeriodMax); + timeBeginPeriod (minperiod); + } + + if (!inited) + { + int priority = GetThreadPriority (GetCurrentThread ()); + SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL); + initime_ms = timeGetTime (); + GetSystemTimeAsFileTime (&f); + SetThreadPriority (GetCurrentThread (), priority); + + inited = 1; + initime_us.HighPart = f.dwHighDateTime; + initime_us.LowPart = f.dwLowDateTime; + initime_us.QuadPart -= FACTOR; + initime_us.QuadPart /= 10; + } + return minperiod; +} + +LONGLONG +hires_ms::usecs (bool justdelta) +{ + if (!minperiod) /* NO_COPY variable */ + prime (); + DWORD now = timeGetTime (); + // FIXME: Not sure how this will handle the 49.71 day wrap around + LONGLONG res = initime_us.QuadPart + ((LONGLONG) (now - initime_ms) * 1000); + return res; +} + +extern "C" int +clock_gettime (clockid_t clk_id, struct timespec *tp) +{ + if (clk_id != CLOCK_REALTIME) + { + set_errno (ENOSYS); + return -1; + } + + LONGLONG now = gtod.usecs (false); + if (now == (LONGLONG) -1) + return -1; + + tp->tv_sec = now / 1000000; + tp->tv_nsec = (now % 1000000) * 1000; + return 0; +} |