We help IT Professionals succeed at work.

Tring to find the source to connect in glibc-2.1

Anthony2000
Anthony2000 asked
on
Medium Priority
244 Views
Last Modified: 2010-04-21
I have glibc-2.1 source, my target is i386. Someone else built the libc.so, and I have access to the build tree. But I am having difficulty locating the source to connect. I can find the connect.o file in build-i386-linux/socket, but I am having diffculty located the file source for it. I have not looked through the make files yet to see if what target creates the connect. I thought I would ask here first.

Thanks
Comment
Watch Question

CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
khkremer:

I found the start of it. The main code I was looking for is in the kernel. If you follow through the glibc source to connect, accept, socket, etc., you will find that the kernel is entered through sys_socketcall (entry.S function number 102).
From there a call sys_connect (kernel/net/socket.c) brings you to (unix_stream_connect or unix_dgram_connect (kernel/net/unix/af_unix.c). This is what I was looking for.

Since you were the only one to take a stab, I am closing this question and giving you the points.

Thanks,

Anthony
CERTIFIED EXPERT

Commented:
All the system calls are implemented in the kernel (that's why they are called system calls). The glibc only provides the interface that a "normal" process uses. It does relay the call to the kernel. You did ask for the source in gllibc, and that's what I provided.
If you are not happy with the answer, you should have said so before giving a "C" grade. Are you familiar with the EE grading guidelines? You can find them here: https://www.experts-exchange.com/help.jsp#hi73
Given that I answered the question (the one you asked, maybe not the one you intended to ask), I think a "C" is not deserved. I'll request a grade review.

Author

Commented:
khkremer, I am sorry if I offended you. I gave you a "c" because when you look at the source to connect in glibc, it does nothing but make a call to the kernel.  I was hoping that someone would explain that the source to connect in glibc does nothing but pass the call onto the kernel to perform the majority of work. Would a "B" be more appropriate? I very much appreciate your help and again please forgive the grade. Let me know.
CERTIFIED EXPERT

Commented:
Why didn't you ask before closing the question?

Author

Commented:
I was trying to solve a problem where I was experiencing a lockup during boot. I found that the lockup was occurring during the rc.sysinit (I am using a version of RedHat version 6.2). The lockup was occurring in some code that I added. It turned out to be in a function called action. action calls initlog. Whenever the system locked up it was during this command. I added strace to the mix and discovered that it was happening during the call to connect. I should have explained all of this so that you could have better helped me. This at first seemed like a major problem.  If I run syslog, the problem goes away, but  syslog does not run until rc.sysinit  has completed. I searched the web looking for others who might have had the same problem, but could not find anything related.

For some reason, the connect locks up sometimes when syslog daemon is not running. I can duplicate this at a bash prompt on my embedded system.  I have not tried on my machine running 6.2 yet.  The more important thing was to correct my problem with booting.

I was almost going to retract the question, but I thought that since you took the time to try to help me and the points were only 50 that I would award them to you. Again, I am sorry for the way I handled this and I appreciate your time and help.

Author

Commented:
BTW: I closed the question because I had a work around and needed to move onto other work.

Author

Commented:
GhostMod can you please change the grade to "A".

khkremer did answer the question correctly.

Thanks,

Anthony
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.