standards/74751: swab() should be declared in <unistd.h>, not
<string.h>
Craig Rodrigues
rodrigc at crodrigues.org
Sun Dec 5 17:50:16 PST 2004
>Number: 74751
>Category: standards
>Synopsis: swab() should be declared in <unistd.h>, not <string.h>
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-standards
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Dec 06 01:50:15 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Craig Rodrigues
>Release: FreeBSD 6.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD dibbler.crodrigues.org 6.0-CURRENT FreeBSD 6.0-CURRENT #44: Sun Dec 5 14:16:56 EST 2004 rodrigc at dibbler.crodrigues.org:/usr/obj/usr/src/sys/MYKERNEL1 i386
>Description:
I was trying to compile the ACE library, which follows
the Single Unix Specification fairly closesly, and compilation
failed because our swab() is declared in <string.h>, not in <unistd.h>.
The prototype for swab() should be in <unistd.h>, not in <string.h>,
according to:
http://www.opengroup.org/onlinepubs/009695399/functions/swab.html
>How-To-Repeat:
>Fix:
--- include/string.h.orig Sun Dec 5 20:24:50 2004
+++ include/string.h Sun Dec 5 20:34:09 2004
@@ -108,8 +108,13 @@
#endif
size_t strxfrm(char * __restrict, const char * __restrict, size_t);
#if __BSD_VISIBLE
-void swab(const void *, void *, size_t);
-#endif
+
+#ifndef _SWAB_DECLARED
+#define _SWAB_DECLARED
+void swab(const void * __restrict, void * __restrict, ssize_t);
+#endif /* _SWAB_DECLARED */
+
+#endif /* __BSD_VISIBLE */
__END_DECLS
#endif /* _STRING_H_ */
--- include/unistd.h.orig Sun Dec 5 20:29:04 2004
+++ include/unistd.h Sun Dec 5 20:32:11 2004
@@ -436,7 +436,12 @@
int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t);
-/* void swab(const void * __restrict, void * __restrict, ssize_t); */
+
+#ifndef _SWAB_DECLARED
+#define _SWAB_DECLARED
+void swab(const void * __restrict, void * __restrict, ssize_t);
+#endif /* _SWAB_DECLARED */
+
void sync(void);
useconds_t ualarm(useconds_t, useconds_t);
int usleep(useconds_t);
--- lib/libc/string/swab.c.orig Sun Dec 5 20:21:03 2004
+++ lib/libc/string/swab.c Sun Dec 5 20:21:18 2004
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/lib/libc/string/swab.c,v 1.5 2002/08/30 20:33:05 robert Exp $");
-#include <string.h>
+#include <unistd.h>
void
swab(const void * __restrict from, void * __restrict to, size_t len)
--- lib/libc/string/swab.3.orig Sun Dec 5 20:22:22 2004
+++ lib/libc/string/swab.3 Sun Dec 5 20:23:46 2004
@@ -41,7 +41,7 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In string.h
+.In unistd.h
.Ft void
.Fn swab "const void * restrict src" "void * restrict dst" "size_t len"
.Sh DESCRIPTION
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-standards
mailing list