unistd.h: Declare SUSv3 functions unconditionally

Shaun Jackman sjackman@gmail.com
Wed Jun 7 01:47:00 GMT 2006


This patch declares a number of SUSv3 functions found in sys/unistd.h
unconditionally. It also changes the prototype of usleep and sync to
match SUSv3. Does any target need to override the standard prototype,
or can this be fixed globally?

Cheers,
Shaun

2006-06-06  Shaun Jackman  <sjackman@gmail.com>

	* libc/include/sys/unistd.h (ftruncate, truncate, ualarm, usleep,
	gethostname, mktemp, sync): Declare these SUSv3 functions
	unconditionally.
	(usleep): Change the prototype to match SUSv3.
	(sync) [!__rtems__]: Ditto.

Index: libc/include/sys/unistd.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/unistd.h,v
retrieving revision 1.56
diff -u -r1.56 unistd.h
--- libc/include/sys/unistd.h	3 Nov 2005 16:52:15 -0000	1.56
+++ libc/include/sys/unistd.h	6 Jun 2006 20:32:37 -0000
@@ -190,28 +190,26 @@
  int     _EXFUN(_execve, (const char *__path, char * const __argv[],
char * const __envp[] ));
  #endif

-#if defined(__CYGWIN__) || defined(__rtems__) || defined(__sh__)
 #if !defined(__INSIDE_CYGWIN__)
  int     _EXFUN(ftruncate, (int __fd, off_t __length));
  int     _EXFUN(truncate, (const char *, off_t __length));
  #endif
-#endif
 #if defined(__CYGWIN__) || defined(__rtems__)
  int	_EXFUN(getdtablesize, (void));
  int	_EXFUN(setdtablesize, (int));
+#endif
  useconds_t _EXFUN(ualarm, (useconds_t __useconds, useconds_t __interval));
-unsigned _EXFUN(usleep, (unsigned int __useconds));
+int _EXFUN(usleep, (useconds_t __useconds));
 #if !(defined  (_WINSOCK_H) || defined (__USE_W32_SOCKETS))
  /* winsock[2].h defines as __stdcall, and with int as 2nd arg */
  int	_EXFUN(gethostname, (char *__name, size_t __len));
  #endif
  char *	_EXFUN(mktemp, (char *));
-#if defined(__CYGWIN__)
+#ifndef __rtems__
 void    _EXFUN(sync, (void));
-#else /* defined(__rtems__) */
+#else
 int     _EXFUN(sync, (void));
  #endif
-#endif
  int     _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
  int     _EXFUN(symlink, (const char *__name1, const char *__name2));
-------------- next part --------------
2006-06-06  Shaun Jackman  <sjackman@gmail.com>

	* libc/include/sys/unistd.h (ftruncate, truncate, ualarm, usleep,
	gethostname, mktemp, sync): Declare these SUSv3 functions
	unconditionally.
	(usleep): Change the prototype to match SUSv3.
	(sync) [!__rtems__]: Ditto.

Index: libc/include/sys/unistd.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/unistd.h,v
retrieving revision 1.56
diff -u -r1.56 unistd.h
--- libc/include/sys/unistd.h	3 Nov 2005 16:52:15 -0000	1.56
+++ libc/include/sys/unistd.h	6 Jun 2006 20:32:37 -0000
@@ -190,28 +190,26 @@
 int     _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] ));
 #endif
 
-#if defined(__CYGWIN__) || defined(__rtems__) || defined(__sh__)
 #if !defined(__INSIDE_CYGWIN__)
 int     _EXFUN(ftruncate, (int __fd, off_t __length));
 int     _EXFUN(truncate, (const char *, off_t __length));
 #endif
-#endif
 #if defined(__CYGWIN__) || defined(__rtems__)
 int	_EXFUN(getdtablesize, (void));
 int	_EXFUN(setdtablesize, (int));
+#endif
 useconds_t _EXFUN(ualarm, (useconds_t __useconds, useconds_t __interval));
-unsigned _EXFUN(usleep, (unsigned int __useconds));
+int _EXFUN(usleep, (useconds_t __useconds));
 #if !(defined  (_WINSOCK_H) || defined (__USE_W32_SOCKETS))
 /* winsock[2].h defines as __stdcall, and with int as 2nd arg */
  int	_EXFUN(gethostname, (char *__name, size_t __len));
 #endif
 char *	_EXFUN(mktemp, (char *));
-#if defined(__CYGWIN__)
+#ifndef __rtems__
 void    _EXFUN(sync, (void));
-#else /* defined(__rtems__) */
+#else
 int     _EXFUN(sync, (void));
 #endif
-#endif
 int     _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
 int     _EXFUN(symlink, (const char *__name1, const char *__name2));
 


More information about the Newlib mailing list