newlib-cygwin/newlib/libc/include/sys/lock.h

70 lines
2.4 KiB
C
Raw Normal View History

#ifndef __SYS_LOCK_H__
#define __SYS_LOCK_H__
/* dummy lock routines for single-threaded aps */
#include <newlib.h>
#include <_ansi.h>
#if !defined(_RETARGETABLE_LOCKING)
typedef int _LOCK_T;
typedef int _LOCK_RECURSIVE_T;
#define __LOCK_INIT(class,lock) static int lock = 0;
#define __LOCK_INIT_RECURSIVE(class,lock) static int lock = 0;
2008-12-11 Craig Howland <howland@LGSInnovations.com> * libc/include/sys/lock.h: Add void cast to avoid "statement has no effect" warnings from gcc. * libc/include/sys/stdio.h: Ditto. * libc/include/sys/time.h: Correct gettimeofday() prototype. * libc/stdlib/__exp10.c: Add #include "std.h" for function prototype. * libc/stdlib/__ten_mu.c: Ditto. * libc/stdlib/std.h: Correct __exp10's ANSI prototype. * libc/stdlib/ldtoa.c: Change eiisinf definition to ANSI form. (Are already others in file without _ansi method, so did not bother.) * libc/stdlib/system.c: Use _ansi forms for function prototypes and definitions. * libc/time/mktime.c: Ditto. * libc/misc/__dprintf.c: Ditto. * libc/include/stdio.h: Add function prototypes for _fgetc_r, _fgetpos_r, _fsetpos_r, _freopen_r, _rewind_r, freopen64, _freopen64_r, _funopen_r, and _fopencookie_r. * libc/include/reent.h: Add function prototype for _stat64_r, align _execve_r prototype with POSIX definition for execve. * libc/reent/execr.c: Align function prototype with POSIX definition. * libc/stdio/asniprintf.c: Add #include "local.h". * libc/stdio/vasniprintf.c: Ditto. * libc/stdio/fread.c: Remove unused variable newcount. * libc/stdio/local.h: Add function prototype for __sccl. * libc/stdio/open_memstream.c: Remove unused variable flags. * libc/stdio/vfscanf.c: Proper prototyping for ccfn, remove prototype for __sccl since now in local.h. * libc/string/memcpy.c: Add #include <string.h> (for real and for traditional synopsis), remove extraneous stddef.h and limits.h. * libc/syscalls/sysclose.c: Add #include <unistd.h>. * libc/syscalls/sysfork.c: Ditto. * libc/syscalls/sysgetpid.c: Ditto. * libc/syscalls/sysexecve.c: Add #include <unistd.h>, align function prototype with POSIX definition. * libc/syscalls/sysfstat.c: Add #include <sys/stat.h>. * libc/syscalls/sysgettod.c: Correct sys/times.h to sys/time.h. * libc/syscalls/syskill.c: Add #include <signal.h>. * libc/syscalls/syslink.c: Add #include <unistd.h>, fix prototype. * libc/syscalls/sysunlink.c: Ditto. * libc/syscalls/sysstat.c: Add #include <sys/stat.h>, fix prototype. * libc/syscalls/syswait.c: Add #include <sys/wait.h>, fix prototype.
2008-12-12 01:27:56 +08:00
#define __lock_init(lock) (_CAST_VOID 0)
#define __lock_init_recursive(lock) (_CAST_VOID 0)
#define __lock_close(lock) (_CAST_VOID 0)
#define __lock_close_recursive(lock) (_CAST_VOID 0)
#define __lock_acquire(lock) (_CAST_VOID 0)
#define __lock_acquire_recursive(lock) (_CAST_VOID 0)
#define __lock_try_acquire(lock) (_CAST_VOID 0)
#define __lock_try_acquire_recursive(lock) (_CAST_VOID 0)
#define __lock_release(lock) (_CAST_VOID 0)
#define __lock_release_recursive(lock) (_CAST_VOID 0)
#else
#ifdef __cplusplus
extern "C" {
#endif
struct __lock;
typedef struct __lock * _LOCK_T;
#define _LOCK_RECURSIVE_T _LOCK_T
#define __LOCK_INIT(class,lock) extern struct __lock __lock_ ## lock; \
class _LOCK_T lock = &__lock_ ## lock
#define __LOCK_INIT_RECURSIVE(class,lock) __LOCK_INIT(class,lock)
extern void __retarget_lock_init(_LOCK_T *lock);
#define __lock_init(lock) __retarget_lock_init(&lock)
extern void __retarget_lock_init_recursive(_LOCK_T *lock);
#define __lock_init_recursive(lock) __retarget_lock_init_recursive(&lock)
extern void __retarget_lock_close(_LOCK_T lock);
#define __lock_close(lock) __retarget_lock_close(lock)
extern void __retarget_lock_close_recursive(_LOCK_T lock);
#define __lock_close_recursive(lock) __retarget_lock_close_recursive(lock)
extern void __retarget_lock_acquire(_LOCK_T lock);
#define __lock_acquire(lock) __retarget_lock_acquire(lock)
extern void __retarget_lock_acquire_recursive(_LOCK_T lock);
#define __lock_acquire_recursive(lock) __retarget_lock_acquire_recursive(lock)
extern int __retarget_lock_try_acquire(_LOCK_T lock);
#define __lock_try_acquire(lock) __retarget_lock_try_acquire(lock)
extern int __retarget_lock_try_acquire_recursive(_LOCK_T lock);
#define __lock_try_acquire_recursive(lock) \
__retarget_lock_try_acquire_recursive(lock)
extern void __retarget_lock_release(_LOCK_T lock);
#define __lock_release(lock) __retarget_lock_release(lock)
extern void __retarget_lock_release_recursive(_LOCK_T lock);
#define __lock_release_recursive(lock) __retarget_lock_release_recursive(lock)
#ifdef __cplusplus
}
#endif
#endif /* !defined(_RETARGETABLE_LOCKING) */
#endif /* __SYS_LOCK_H__ */