[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-bugs
Subject:    documentation/3382: select(2) does not mention needed #include <string.h>
From:       cjeker () diehard ! n-r-g ! com
Date:       2003-07-30 12:28:16
[Download RAW message or body]

> Number:         3382
> Category:       documentation
> Synopsis:       FD_ZERO needs #include <string.h> which is not mentioned in \
>                 select(2)
> Confidential:   yes
> Severity:       non-critical
> Priority:       low
> Responsible:    bugs
> State:          open
> Quarter:        
> Keywords:       
> Date-Required:
> Class:          doc-bug
> Submitter-Id:   net
> Arrival-Date:   Wed Jul 30 12:40:01 GMT 2003
> Closed-Date:
> Last-Modified:
> Originator:     Claudio Jeker
> Release:        -current
> Organization:
> Environment:
	
	System      : OpenBSD 3.3
	Architecture: OpenBSD.i386
	Machine     : i386
> Description:
	
The man page of select(2) lists sys/types.h, sys/time.h and unistd.h as needed
include files. FD_ZERO and FD_COPY use the functions memset and memcpy which are \
defined in string.h.
> How-To-Repeat:
	
compile this program:
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>

int main(int argc, char **argv)
{
        fd_set  testfd;

        FD_ZERO(&testfd);
}

> cc test.c 
test.c: In function `main':
test.c:9: warning: type mismatch in implicit declaration for built-in function \
`memset'
> Fix:
	
Following patch should do the trick:
diff -u -u -r1.21 select.2
--- select.2    19 Nov 2002 20:57:13 -0000      1.21
+++ select.2    30 Jul 2003 12:19:03 -0000
@@ -43,6 +43,7 @@
 .Sh SYNOPSIS
 .Fd #include <sys/types.h>
 .Fd #include <sys/time.h>
+.Fd #include <string.h>
 .Fd #include <unistd.h>
 .Ft int
 .Fn select "int nfds" "fd_set *readfds" "fd_set *writefds" "fd_set *exceptfds" \
"struct timeval *timeout" 


> Release-Note:
> Audit-Trail:
> Unformatted:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic