Where to find the source code of _IO_putc_unlocked (c, _IO_stdout); ?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Where to find the source code of _IO_putc_unlocked (c, _IO_stdout); ?
Hi, I'm new here, and well, I thought I might as well just cut to the chase regarding my own programming questions about linux. I am sorry if this strikes someone as rude and I'll try my best to answer other peoples questios to be proactive with this website.
Anyway, I posted this same question a while ago at yahoo answers (http://answers.yahoo.com/question/in...1163451AAjo5Xl) and still am waiting for a response, but I thought that might not have been the best place to put is so, the matter is this:
I was browsing for the source code of printf() from glibc ( http://ftp.gnu.org/gnu/glibc/glibc-2.8.tar.gz ) and in the file printf.c I discovered printf uses putc to print characters on screen, well, I checked the source code of putc in putc.c and found out it uses some strange function _IO_putc_unlocked (c, _IO_stdout); but I can't seem to find the source code for this function. Could anyone please tell me where to find this so I can finally understand the ultimate inner workings of printf?
BTW, here are the source codes of printf.c
Quote:
/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#undef _IO_printf
ldbl_strong_alias (__printf, printf);
/* This is for libg++. */
ldbl_strong_alias (__printf, _IO_printf);
and of putc.c
Quote:
/* Copyright (C) 1991, 1995, 1996, 1997, 1998, 2002, 2003
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "libioP.h"
#include "stdio.h"
#undef _IO_putc
int
_IO_putc (c, fp)
int c;
_IO_FILE *fp;
{
int result;
CHECK_FILE (fp, EOF);
_IO_acquire_lock (fp);
result = _IO_putc_unlocked (c, fp);
_IO_release_lock (fp);
return result;
}
INTDEF(_IO_putc)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.