Skip to contentSkip to conversation

ELDK glibc fcntl(socketFd, F_SETFL, flags) causes Seg Fault

DISCUSSION Christopher Dumoulin 1 participant 1 message Feb 2, 2007 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

If that's your exact code, I notice you're not checking if the socket() call succeeded. You may be calling fcntl with an invalid socket handle.

The first place I'd look is to make sure you've included 'Networking Support', 'Unix domain sockets', maybe 'TCP/IP networking', and whatever else you might need, when you configure your kernel.

---------------------------------------------------------------------
Message: 6
Date: Fri, 02 Feb 2007 08:30:18 +0100
From: Wolfgang Denk <[email protected]>
Subject: Re: ELDK glibc fcntl(socketFd, F_SETFL, flags) causes Seg
Fault
To: Daniel Ng <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

Quoted 8 lines · In message <[email protected]> you wrote:

My application Seg Faults when I try to set flags for my socket fd.

First, I get the fd by calling socket():
fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);

Then I try getting the fd flags:
fcntl(fd, F_GETFL, flags)

Provide some working / crashing test code, i. e. a complete C program with declarations etc.

Best regards,

Wolfgang Denk

Signature · 10 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
There's an old story about the person who wished his computer were as
easy to use as his telephone. That wish has come  true,  since  I  no
longer know how to use my telephone.


------------------------------

_______________________________________________