Jelajahi Sumber

Mark some functions as BSD only

Peter S. Mazinger 18 tahun lalu
induk
melakukan
64b8d39133

+ 2 - 0
libc/inet/hostid.c

@@ -27,6 +27,7 @@ libc_hidden_proto(gethostname)
 
 #define HOSTID "/etc/hostid"
 
+#ifdef __USE_BSD
 int sethostid(long int new_id)
 {
 	int fd;
@@ -39,6 +40,7 @@ int sethostid(long int new_id)
 	close (fd);
 	return ret;
 }
+#endif
 
 long int gethostid(void)
 {

+ 5 - 1
libc/pwd_grp/pwd_grp.c

@@ -42,7 +42,6 @@ libc_hidden_proto(strchr)
 libc_hidden_proto(strcmp)
 libc_hidden_proto(strcpy)
 libc_hidden_proto(strlen)
-libc_hidden_proto(setgroups)
 libc_hidden_proto(strtoul)
 libc_hidden_proto(rewind)
 libc_hidden_proto(fgets_unlocked)
@@ -702,6 +701,10 @@ struct spwd *sgetspent(const char *string)
 /**********************************************************************/
 #ifdef L_initgroups
 
+#ifdef __USE_BSD
+
+libc_hidden_proto(setgroups)
+
 int initgroups(const char *user, gid_t gid)
 {
 	FILE *grfile;
@@ -755,6 +758,7 @@ int initgroups(const char *user, gid_t gid)
 	free(group_list);
 	return rv;
 }
+#endif
 
 #endif
 /**********************************************************************/

+ 3 - 0
libc/stdio/setbuffer.c

@@ -7,6 +7,8 @@
 
 #include "_stdio.h"
 
+#ifdef __USE_BSD
+
 libc_hidden_proto(setvbuf)
 
 /* A BSD function.  The implementation matches the linux man page,
@@ -21,3 +23,4 @@ void setbuffer(FILE * __restrict stream, register char * __restrict buf,
 	setvbuf(stream, buf, (buf ? _IOFBF : _IONBF), size);
 #endif
 }
+#endif

+ 3 - 0
libc/stdio/setlinebuf.c

@@ -7,6 +7,8 @@
 
 #include "_stdio.h"
 
+#ifdef __USE_BSD
+
 libc_hidden_proto(setvbuf)
 
 /* A BSD function.  The implementation matches the linux man page,
@@ -20,3 +22,4 @@ void setlinebuf(FILE * __restrict stream)
 	setvbuf(stream, NULL, _IOLBF, (size_t) 0);
 #endif
 }
+#endif

+ 2 - 0
libc/stdlib/mkdtemp.c

@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include "../misc/internals/tempname.h"
 
+#ifdef __USE_BSD
 /* Generate a unique temporary directory name from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the filename unique.
@@ -34,3 +35,4 @@ char * mkdtemp (char *template)
 
     return template;
 }
+#endif

+ 4 - 1
libc/string/generic/strsep.c

@@ -18,10 +18,12 @@
 
 #include <string.h>
 
-libc_hidden_proto(strsep)
+#ifdef __USE_BSD
+
 libc_hidden_proto(strchr)
 libc_hidden_proto(strpbrk)
 
+libc_hidden_proto(strsep)
 char *strsep (char **stringp, const char *delim)
 {
   char *begin, *end;
@@ -66,3 +68,4 @@ char *strsep (char **stringp, const char *delim)
   return begin;
 }
 libc_hidden_def(strsep)
+#endif

+ 4 - 1
libc/string/strsep.c

@@ -7,10 +7,12 @@
 
 #include "_string.h"
 
-libc_hidden_proto(strsep)
+#ifdef __USE_BSD
+
 libc_hidden_proto(strpbrk)
 libc_hidden_proto(strcspn)
 
+libc_hidden_proto(strsep)
 char *strsep(char ** __restrict s1, const char * __restrict s2)
 {
 	register char *s = *s1;
@@ -32,3 +34,4 @@ char *strsep(char ** __restrict s1, const char * __restrict s2)
 	return s;
 }
 libc_hidden_def(strsep)
+#endif

+ 2 - 0
libc/sysdeps/linux/common/acct.c

@@ -9,4 +9,6 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
 _syscall1(int, acct, const char *, filename);
+#endif

+ 2 - 0
libc/sysdeps/linux/common/chroot.c

@@ -12,6 +12,7 @@
 #include <string.h>
 #include <sys/param.h>
 
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
 #define __NR___syscall_chroot __NR_chroot
 static inline _syscall1(int, __syscall_chroot, const char *, path);
 
@@ -19,3 +20,4 @@ int chroot(const char *path)
 {
 	return __syscall_chroot(path);
 }
+#endif

+ 4 - 4
libc/sysdeps/linux/common/getdnnm.c

@@ -11,14 +11,13 @@
 #include <errno.h>
 #include <sys/utsname.h>
 
-libc_hidden_proto(getdomainname)
-
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
 libc_hidden_proto(strlen)
 libc_hidden_proto(strcpy)
 libc_hidden_proto(uname)
 
-int
-getdomainname(char *name, size_t len)
+libc_hidden_proto(getdomainname)
+int getdomainname(char *name, size_t len)
 {
   struct utsname uts;
 
@@ -45,3 +44,4 @@ getdomainname(char *name, size_t len)
   return 0;
 }
 libc_hidden_def(getdomainname)
+#endif

+ 1 - 1
libc/sysdeps/linux/common/madvise.c

@@ -9,6 +9,6 @@
 
 #include "syscalls.h"
 #include <sys/mman.h>
-#ifdef __NR_madvise
+#if defined __NR_madvise && defined __USE_BSD
 _syscall3(int, madvise, void *, __addr, size_t, __len, int, __advice);
 #endif

+ 2 - 0
libc/sysdeps/linux/common/setdomainname.c

@@ -9,4 +9,6 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
 _syscall2(int, setdomainname, const char *, name, size_t, len);
+#endif

+ 3 - 0
libc/sysdeps/linux/common/setgroups.c

@@ -12,6 +12,8 @@
 #include <unistd.h>
 #include <grp.h>
 
+#ifdef __USE_BSD
+
 libc_hidden_proto(setgroups)
 
 #if defined(__NR_setgroups32)
@@ -62,3 +64,4 @@ ret_error:
 #endif
 
 libc_hidden_def(setgroups)
+#endif

+ 2 - 0
libc/sysdeps/linux/common/sethostname.c

@@ -9,4 +9,6 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
 _syscall2(int, sethostname, const char *, name, size_t, len);
+#endif

+ 3 - 0
libc/sysdeps/linux/common/settimeofday.c

@@ -10,8 +10,11 @@
 #include "syscalls.h"
 #include <sys/time.h>
 
+#ifdef __USE_BSD
+
 libc_hidden_proto(settimeofday)
 
 _syscall2(int, settimeofday, const struct timeval *, tv,
 		  const struct timezone *, tz);
 libc_hidden_def(settimeofday)
+#endif

+ 2 - 0
libc/sysdeps/linux/common/vhangup.c

@@ -9,4 +9,6 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
 _syscall0(int, vhangup);
+#endif

+ 2 - 0
libc/termios/cfmakeraw.c

@@ -18,6 +18,7 @@
 
 #include <termios.h>
 
+#ifdef __USE_BSD
 /* Set *T to indicate raw mode.  */
 void cfmakeraw (struct termios *t)
 {
@@ -29,3 +30,4 @@ void cfmakeraw (struct termios *t)
   t->c_cc[VMIN] = 1;		/* read returns when one char is available.  */
   t->c_cc[VTIME] = 0;
 }
+#endif

+ 3 - 0
libc/termios/cfsetspeed.c

@@ -20,6 +20,8 @@
 #include <errno.h>
 #include <stddef.h>
 
+#ifdef __USE_BSD
+
 libc_hidden_proto(cfsetispeed)
 libc_hidden_proto(cfsetospeed)
 
@@ -171,3 +173,4 @@ int cfsetspeed (struct termios *termios_p, speed_t speed)
 
   return -1;
 }
+#endif

+ 3 - 0
libc/unistd/daemon.c

@@ -46,6 +46,8 @@
 #include <paths.h>
 #include <unistd.h>
 
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
+
 libc_hidden_proto(open)
 libc_hidden_proto(close)
 libc_hidden_proto(_exit)
@@ -87,3 +89,4 @@ int daemon( int nochdir, int noclose )
 	}
 	return(0);
 }
+#endif

+ 3 - 0
libc/unistd/getpass.c

@@ -22,6 +22,8 @@
 #include <unistd.h>
 #include <string.h>
 
+#if defined __USE_BSD && (defined __USE_XOPEN && !defined __USE_XOPEN2K)
+
 libc_hidden_proto(strlen)
 libc_hidden_proto(tcsetattr)
 libc_hidden_proto(tcgetattr)
@@ -118,3 +120,4 @@ getpass (prompt)
 
   return buf;
 }
+#endif

+ 3 - 0
libc/unistd/usershell.c

@@ -40,6 +40,8 @@
 #include <unistd.h>
 #include <paths.h>
 
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
+
 libc_hidden_proto(fstat)
 libc_hidden_proto(fopen)
 libc_hidden_proto(fclose)
@@ -146,3 +148,4 @@ cleanup:
     fclose(fp);
     return (char **) validsh;
 }
+#endif