Cygwin: pinfo: raise MAX_PID to 4194304
[newlib-cygwin.git] / libgloss / arc / libcfunc.c
blob78bd76deffbad966e2f4f4a186eafed2f2af2f51
1 /*
2 Copyright (c) 2015-2023, Synopsys, Inc. All rights reserved.
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
7 1) Redistributions of source code must retain the above copyright notice,
8 this list of conditions and the following disclaimer.
10 2) Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
14 3) Neither the name of the Synopsys, Inc., nor the names of its contributors
15 may be used to endorse or promote products derived from this software
16 without specific prior written permission.
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 POSSIBILITY OF SUCH DAMAGE.
31 /* This file has been copied from libgloss/arm/libcfuncs.c.
33 Support files for GNU libc. Files in the C namespace go here.
34 Files in the system namespace (ie those that start with an underscore)
35 go in syscalls.c.
37 Note: These functions are in a seperate file so that OS providers can
38 overrride the system call stubs (defined in syscalls.c) without having
39 to provide libc functions as well. */
41 #include <errno.h>
42 #include <sys/types.h>
43 #include <time.h>
44 #include <unistd.h>
46 unsigned __attribute__((weak))
47 alarm (unsigned seconds)
49 (void)seconds;
50 return 0;
53 clock_t _clock (void);
54 clock_t __attribute__((weak))
55 clock (void)
57 return _clock ();
60 int _isatty (int fildes);
61 int __attribute__((weak))
62 isatty (int fildes)
64 return _isatty (fildes);
67 int __attribute__((weak))
68 pause (void)
70 errno = ENOSYS;
71 return -1;
74 unsigned __attribute__((weak))
75 sleep (unsigned seconds)
77 clock_t t0 = _clock ();
78 clock_t dt = (clock_t) seconds * CLOCKS_PER_SEC;
80 while (_clock () - t0 < dt);
81 return 0;
84 int __attribute__((weak))
85 usleep (useconds_t useconds)
87 clock_t t0 = _clock ();
88 clock_t dt = (clock_t) useconds / (1000000/CLOCKS_PER_SEC);
90 while (_clock () - t0 < dt);
91 return 0;