The accept4 will available in glbic v2.10
# man accept4
...
The accept4() system call is available starting with Linux 2.6.28; support in 
glibc is available starting with version 2.10.
...
In v2.9, the function was be declared. So i do some changes like folw:
Signed-off-by: Gui Xiaohua <[email protected]>
--- a/kernel/syscalls/accept4/accept4_01.c      2009-05-05 16:58:49.000000000 
+0800
+++ b/kernel/syscalls/accept4/accept4_01.c      2009-05-11 12:05:45.000000000 
+0800
@@ -141,9 +141,9 @@ void setup()
        TEST_PAUSE;
        tst_tmpdir();
 }
-
+#if !(__GLIBC_PREREQ(2,10))
 static int
-accept4(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags)
+accept4_01(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags)
 {
 #ifdef DEBUG
        tst_resm(TINFO, "Calling accept4(): flags = %x", flags);
@@ -173,6 +173,7 @@ accept4(int fd, struct sockaddr *sockadd
        return syscall(__NR_accept4, fd, sockaddr, addrlen, flags);
 #endif
 }
+#endif
 
 /**********************************************************************/
 
@@ -197,8 +198,13 @@ do_test(int lfd, struct sockaddr_in *con
                die("Connect Error");
 
        addrlen = sizeof(struct sockaddr_in);
+       #if !(__GLIBC_PREREQ(2,10))
+       acceptfd = accept4_01(lfd, (struct sockaddr *)&claddr, &addrlen,
+                           closeonexec_flag | nonblock_flag);
+       #else
        acceptfd = accept4(lfd, (struct sockaddr *)&claddr, &addrlen,
                           closeonexec_flag | nonblock_flag);
+       #endif
        if (acceptfd == -1) {
                tst_resm(TCONF,
                         "syscall __NR_accept4 not supported on your arch");

CAI Qian wrote:

>> From: Gui Xiaohua <[email protected]>
>> Subject: [LTP] [PATCH]the function name conflict with libc in LTP
>> To: [email protected]
>> Date: Wednesday, May 6, 2009, 1:16 PM
>> There is an error occured during i
>> compiled ltp which was 
>> released in 20090430:
>>   accept4_01.c:146: error: static declaration of
>> ‘accept4’ 
>>   follows non-static declaration
>> /usr/include/sys/socket.h:222: 
>>   note: previous declaration of ‘accept4’ was
>> here.
>> Note:
>>   The OS is Fedora11Beta, the glibc version is 
>>   glibc-headers-2.9.90-8.1.x86_64.
>>

> 
> Well, if glibc has already provided accept4(), we can use it unless it is
> really necessary to use syscall(). In the future, we probably don't want 
> to maintain a separate version of accept4() here. Is it possible to check
> if the glibc version is available? If so, use the glibc one. Otherwise,
> use the static one here?
> 
> CAI Qian
> 



------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to