From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1829 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: capset() capget() syscalls Date: Wed, 5 Sep 2012 10:24:41 -0400 Message-ID: <20120905142441.GT27715@brightrain.aerifal.cx> References: <20120905061905.GQ27715@brightrain.aerifal.cx> <50471B56.8040804@palsenberg.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1346854942 4318 80.91.229.3 (5 Sep 2012 14:22:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Sep 2012 14:22:22 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1830-gllmg-musl=m.gmane.org@lists.openwall.com Wed Sep 05 16:22:24 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1T9GUo-00079g-Bl for gllmg-musl@plane.gmane.org; Wed, 05 Sep 2012 16:22:22 +0200 Original-Received: (qmail 7375 invoked by uid 550); 5 Sep 2012 14:22:19 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 7367 invoked from network); 5 Sep 2012 14:22:19 -0000 Content-Disposition: inline In-Reply-To: <50471B56.8040804@palsenberg.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1829 Archived-At: On Wed, Sep 05, 2012 at 11:28:54AM +0200, Igmar Palsenberg wrote: > > >> Hi, > >> > >> Attached patch adds types to the existing syscalls, and defines the > >> types in the header. All CAP_* defines are also added. > > I'm curious what applications expect this header and definitions. > > glibc does not have such a header. My impression is that it might have > > existed at some point but that it was removed a long time ago, and > > that any use of capabilities without libcap (which presumably contains > > its own copy of the definitions for interfacing with the kernel) was > > long ago deprecated. > > > > Can you clear these issues up? > My own. Those definitions are part of the kernel syscall. While glibc > does support structure definitions for most syscalls, > capabilities seem to be an exception. (they are in linux/capabilities.h > to be exact). Oh, and I really dislike the interfaces libcap provides. I found them pretty ugly too, but I can't say I like the kernel API any better... And the API in linux/capabilities.h is just horrible. The typedefs are pointer types and there's no way to actually declare the objects they point to without using the _-prefixed struct tag. I don't see why they needed this hideous struct-pointer-based interface rather than just passing a few words as syscall arguments... > I pull those definitions in myself now, because pulling in kernel header > files is considered a bad practice (c) Linus Torvalds > Since these won't add a byte of code, it might be a good idea. > I'm open for suggestions however. There are a lot of direct-kernel-interface-usage situations that require pulling in the associated kernel headers, such as fb.h, kb.h, etc. One issue is that the kernel headers presumably lack prototypes for the functions, but the most portable way to do what you're doing is probably going to be: #include #include ... syscall(SYS_capset, x, y); At least this will work on every Linux libc I know of, and it's hard for them to break it. If you really want to see the header in musl, I'm not opposed to further consideration of the matter, but right now I don't think adding it promotes portable software; rather it seems to promote writing software that works on musl and breaks on glibc. Rich