digitalmars.D.learn - Why no setuid in linux.d?
- 0ffh (10/10) Nov 19 2010 Hi,
- Lars T. Kyllingstad (4/13) Nov 19 2010 All the POSIX headers are in the core.sys.posix package. In your case,
- 0ffh (5/17) Nov 19 2010 Thanks Lars, but "import core.sys.posix.unistd;" gives me
- Lars T. Kyllingstad (3/21) Nov 19 2010 Ah, then you can't use core.*. Sorry for the confusion.
- Steven Schveighoffer (8/18) Nov 19 2010 You are not required to modify phobos to prototype a C function, just do...
- 0ffh (4/10) Nov 19 2010 So am I! =)
Hi, I've written a programme that serves port 80, which usually requires root access. Therefore, after acquiring the socket I want to relinquish root by setting the uid to nonzero. I needed to add "int setuid(uid_t uid);" to linux.d and recompile Phobos in order to do so. I there a specific reason that setuid (and the related commands setgid, getuid, geteuid, getgid and getegid) is/are missing in the standard version of linux.d? Regards, Frank
Nov 19 2010
On Fri, 19 Nov 2010 12:33:02 +0100, 0ffh wrote:Hi, I've written a programme that serves port 80, which usually requires root access. Therefore, after acquiring the socket I want to relinquish root by setting the uid to nonzero. I needed to add "int setuid(uid_t uid);" to linux.d and recompile Phobos in order to do so. I there a specific reason that setuid (and the related commands setgid, getuid, geteuid, getgid and getegid) is/are missing in the standard version of linux.d?All the POSIX headers are in the core.sys.posix package. In your case, what you need is to import core.sys.posix.unistd. -Lars
Nov 19 2010
Lars T. Kyllingstad wrote:On Fri, 19 Nov 2010 12:33:02 +0100, 0ffh wrote:Thanks Lars, but "import core.sys.posix.unistd;" gives me "Error: module posix cannot read file 'core/sys/posix.d'". I'm on D1 btw with no intention at all to switch to D2. Regards, FrankHi, [...] I there a specific reason that setuid (and the related commands setgid, getuid, geteuid, getgid and getegid) is/are missing in the standard version of linux.d?All the POSIX headers are in the core.sys.posix package. In your case, what you need is to import core.sys.posix.unistd. -Lars
Nov 19 2010
On Fri, 19 Nov 2010 13:02:42 +0100, 0ffh wrote:Lars T. Kyllingstad wrote:Ah, then you can't use core.*. Sorry for the confusion. -LarsOn Fri, 19 Nov 2010 12:33:02 +0100, 0ffh wrote:Thanks Lars, but "import core.sys.posix.unistd;" gives me "Error: module posix cannot read file 'core/sys/posix.d'". I'm on D1 btw with no intention at all to switch to D2.Hi, [...] I there a specific reason that setuid (and the related commands setgid, getuid, geteuid, getgid and getegid) is/are missing in the standard version of linux.d?All the POSIX headers are in the core.sys.posix package. In your case, what you need is to import core.sys.posix.unistd. -Lars
Nov 19 2010
On Fri, 19 Nov 2010 06:33:02 -0500, 0ffh <frank youknow.what.todo.internetz> wrote:Hi, I've written a programme that serves port 80, which usually requires root access. Therefore, after acquiring the socket I want to relinquish root by setting the uid to nonzero. I needed to add "int setuid(uid_t uid);" to linux.d and recompile Phobos in order to do so. I there a specific reason that setuid (and the related commands setgid, getuid, geteuid, getgid and getegid) is/are missing in the standard version of linux.d? Regards, FrankYou are not required to modify phobos to prototype a C function, just do this: extern(C) int setuid(uid_t uid); to your file that calls the function, and you are good to go. As to why it was omitted, I'm unsure. -Steve
Nov 19 2010
Steven Schveighoffer wrote:[...] You are not required to modify phobos to prototype a C function, just do this: extern(C) int setuid(uid_t uid); [...]Yeah I know, and you're right! It's just I felt that it belonged there...As to why it was omitted, I'm unsure.So am I! =) -Frank
Nov 19 2010