From owner-freebsd-questions@freebsd.org Sun Apr 28 18:12:38 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 A72DA1585586 for ; Sun, 28 Apr 2019 18:12:38 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2F166F681 for ; Sun, 28 Apr 2019 18:12:37 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([92.195.97.73]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPA (Nemesis) id 1MvrRB-1gSyoU1gk3-00ssPH; Sun, 28 Apr 2019 20:12:29 +0200 Date: Sun, 28 Apr 2019 20:12:28 +0200 From: Polytropon To: Mayuresh Kathe Cc: freebsd-questions@freebsd.org Subject: Re: system calls in a library Message-Id: <20190428201228.b847e00a.freebsd@edvax.de> In-Reply-To: <201904280337.x3S3bR25017504@sdf.org> References: <201904280337.x3S3bR25017504@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:h/xiIiWzEXbHkxHn+RlRPPdXgQLPyoGstLVp2vGy3EeWKrJmu8P 5dE5Wy9hvJfKOKXxuipDSf6QWTgNr6div3ftqYbCk60dgH2Xo+TBsQvl9twIPUyuRVwJMeu LLqoLQ3FOm+qq9PmnymOcsnDroSa35cJ3/HSJ9J4WquYja6dvVDVVDEHfD+B4BNeI/5Z8L+ w+G6Bbd0wtMdupgLcyLgw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:NkETCi8Q5ms=:mSmRRPG6TTZsWDuJSDVsyX 0T5JijFw5FfQR06qWYx+UU7xSMMdTS5L+xEd0MUb88SZ6pSDVpc66nFXlpiw3gvEpuKsUA8j0 grUgbLkWTw9w2a6QBH+Ksx0N2hPCAvMECRa83AQk693HbL5OEqZz1gcUcuXH+kMk3fU/3u6n+ 6kBaEn2E5by5ScpYviIuy41QZWTzKyoEiRqfVwgEh7/Dk8rIhRa/ioMYcv545nRBiL7YGdq9s FAIXdmjtAS7OW7UFPNueqI7YVhJqYXX/u66gCvsF/R9Gkf5gJkR7f82ZZxiUMZz3lA9pUzbfC 0pg6rmX+9930UAvBSarRhkiM6W4AwYCFhn9oxJrCux+6mS4YyC4F6KbPbx//ablDL/5Fg1YSi 6wCKdcisVTkZOi3bEqmX2+oqH6TVE2k5icDiM4zrPuXSJ2KZc0AS27EBmAnllRz0dtS1YzX0t 0tt4f6gcRT4SWEokMoBaRExXYwO6VItd1DFC0k0tr3VbNQZobXaBZzkac3FptDB/77g00OYb3 oMJQo2mXZe3C8n1Hb+aldnPATgvOkM5C0eD7S1vP6GC/PneClU9W45KAVtE8e2oDZ3betEsMN 2HLW8auXsv67qhdn9bxckHMfXzx5GFQg+pFCamnRIFL68mSx2GNSeHv79ivjfaX2cv4BywykM S7ilsuUyFtLkqpcCNN74TAm7CGQaSouPVHQr46J/4fxUr+Fos7YaWa9PV6mu/1mc4nzphWrYO f9SWRmEztWc1t47MdD5d6cTeGvqzs92lA8iNjcZkPSRqxs0VLBVJwD6DBUM= X-Rspamd-Queue-Id: C2F166F681 X-Spamd-Bar: ++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [4.04 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; MX_GOOD(-0.01)[cached: mx00.schlund.de]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[73.97.195.92.zen.spamhaus.org : 127.0.0.10]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.55)[0.552,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.02)[0.020,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.99)[0.987,0]; RCVD_IN_DNSWL_NONE(0.00)[13.17.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.10)[ipnet: 212.227.0.0/16(-1.38), asn: 8560(1.87), country: DE(-0.01)] 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: Sun, 28 Apr 2019 18:12:39 -0000 On Sun, 28 Apr 2019 03:37:27 GMT, Mayuresh Kathe wrote: > from previous discussions on this list, i know that the system interfaces > exposed by the freebsd kernel are also included and exposed via libc, in > addition to the standard c library functions. did i get that right? More or less, the system calls (kernel calls) translate 1:1 to system call (call number, set of arguments, syscall / int 80h). Their prototypes are listed in the corresponding header files. The implementation itself is found in the kernel sources, and many of them are written in assembly. The libc interface makes it easy to call, for example, write() without requiring the setup in assembly or a C-equivalent. As per the C standard, libc adds more convenient wrappers to the kernel interfaces, for example fopen() as an extension of open(), simplified speaking. > if yes, is it possible to expose those kernel system interfaces via a c++ > library? but one which is devoid of c++ library functions? Sure it is. The could be "lifted" into the "OO space", providing objects that don't do more than the system call would do, but that completely defeats the high-level purpose and approach of C++, which relates to C as lung cancer relates to lung. ;-) > which in the > case of freebsd is included in something like libstdcpp? FreeBSD's libstdc++ is the Standard C++ Library (as per the language definitions and requirements) which contains the higher-level stuff as mentioned above. I don't know if it's even intended to expose the lower-level interfaces directly in C++, as even libc provides a more convenient interface to what the system calls can do, and the "syscall level" is usually reserved for use in device drivers and kernel-internal code, and most of it is written in assembly. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...