From owner-freebsd-questions@freebsd.org Wed Jan 16 10:17:43 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 072461482293 for ; Wed, 16 Jan 2019 10:17:43 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 110FE951EA for ; Wed, 16 Jan 2019 10:17:41 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([92.193.226.69]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPA (Nemesis) id 1MEUaQ-1gTpH22Izy-00G2aD; Wed, 16 Jan 2019 11:17:34 +0100 Date: Wed, 16 Jan 2019 11:17:33 +0100 From: Polytropon To: iam@sdf.org Cc: freebsd-questions@freebsd.org Subject: Re: libc : non-c specific functions! Message-Id: <20190116111733.43ada98d.freebsd@edvax.de> In-Reply-To: <201901160505.x0G558X1004475@sdf.org> References: <201901160505.x0G558X1004475@sdf.org> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:DXaP26kKkP/oti+0881kFtiimogl3NnE176g/g5jcrrxG4kH1lx mpw17dwDSJs+qBHu+CGD07hddTqaTaNsQFCRaAWx7EoUqmwXSMCjTRttB/wVo6m14F1kYgb 14YXaHPLQgVVwAzoagDy158u2SAPqZb58thact/bPR/RGlf01LH8TELn1f9VddDYcV43Jq1 hRhqCFcQBhVF2qogCTvtw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:B+XuQU0BRM4=:wTCRRk3iLF1SKl7fkWbpQE lQnWcY8+Hec+40ghr3mzCuF10s56iWtz0OzM2PzGMFyr3+IujPzJBIPJNDE7cXyp4kNaPmLxi YhPXR/ev/WMkkymrQk0UxTFO640YbtoGnnZOBJqNYx2xQCObgncRmTeLFGtEeQQJlNsUzindR d9Qsu07uX1OAqsHk/53BDyGuYYjibcjMuBM94Tb8B9SyIjLb4TzJaZmwtEmyTd92IAWrqap47 JBPmwUCsH/5RQ421YCSCBfWRiCxaA25zYi4X6YJ55vccPLzTp8drcZDgk+R2LM1I/5jSdEw3o qj1QddsCGIrd91s0SG1SzuS9aShdvjV1tTRFR8S8XHiwh55YSTzfgqWXGvqGkYLvRhXh3VFFm e82/kKzM9Ov6WqMTNyrHvmxDS5bp2u5aBQpvqAlWaBulM6KXPUZzI+8a9eQScNL0q4hGEvVU3 SlHvLqJEcVTKBYmnWtaZk30D4WEyLiETpmQSJ5kAkLsG57HXSyxnoqjVRv9ehbczeUTxC4nEO sJ1Ij0fqDqcLE8vNsJcyn0TmQx3LOs5chGS8IxaZi6Lgy1JhGCw5xyACgWFRMmgxhQDyosSOe I9+TsBb+lfdQuw/WNjxcW7d0nAyFYAL7hWQzeUcm7Y+xOr+yBSJUo7w++EA6d6n3a6HQIWy0h nbtQ2Z3lIidH7FuIEIzvGgPEd0m0chA2hw679mZEl6za/+xH4FQPEGz6kw96BoF98nazq0hsC yCRbiZGFrYp0/fR80mqSo7KKPsgznYROyrj/6czeQ/kNTrTdBA7j0XUvTtA= X-Rspamd-Queue-Id: 110FE951EA X-Spamd-Bar: ++++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [6.12 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; HAS_ORG_HEADER(0.00)[]; MX_GOOD(-0.01)[cached: mx01.schlund.de]; RCPT_COUNT_TWO(0.00)[2]; SUBJECT_ENDS_EXCLAIM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[69.226.193.92.zen.spamhaus.org : 127.0.0.10]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.91)[0.907,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[0.999,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[1.000,0]; RCVD_IN_DNSWL_NONE(0.00)[130.126.227.212.list.dnswl.org : 127.0.5.0]; MID_CONTAINS_FROM(1.00)[]; R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE(0.83)[ip: (4.15), ipnet: 212.227.0.0/16(-0.65), asn: 8560(0.63), country: DE(-0.01)] X-Spam: Yes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2019 10:17:43 -0000 On Wed, 16 Jan 2019 05:05:08 GMT, iam@sdf.org wrote: > is there any way to find out which functions in libc are non-c > specific, so for example if i had to implement a syslib in > assembly language, i could just avoid the "c" parts as they > would be irrelevant. Everything that's in the standard C library is stuff required by the C standard. It doesn't actually matter _how_ it is implemented, even though it's commonly implemented in C. So "nothing and everything is C-specific". ;-) Your question is a bit strange (or I'm just too stupid to understand it correctly). Allow me to explain: The libc isn't there for its own good. It's a library used by other programs which call functions from that library using those function names, after linking to that library, simplified speaking. If you would implement your alternative system library, let's say libsys, and let's say you do this in assembly, then no other program could use it _except_ you implement the calling interface (i. e., its API) in the exact same way. This is the only way other programs could use it instead of libc. Example: You want a non-libc equivalent of dmesg. You start by examining /usr/src/sbin/dmesg/dmesg.c, which header files does it include? Which libc calls does it make? Your libsys would heed to implement them - _how_ it does that is of no interest to the compiler / linker. So after you've done that, you could recompile "cc -lsys -o dmesg dmesg.c" and it would no longer need libc. On the other hand, if you're going to develop your own (!) userland tools, based upon your own libsys written in assembly, you can create your own new universe, as long as compatibility is not required. FreeBSD's implementation of libc is in /usr/src/lib/libc and its subdirectories. Even though the standard C library is a very common thing, it's implemented differently on the many existing operating systems, and even its name can be different, for example glibc (GNU libc) on Linux. The content can also be different, as the C standard requires certain things, but the library maintainer could decide to add other things, for example POSIX extensions (which are not required by the C standard). -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...