pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
I'm working on making the unix saved id c functions available in perl. (See Unix::SavedIDs.) The c interface when setting id values is:
setresuid(ruid,euid,suid);
I would like to accommodate the situation where a user only wants to set the suid, IE I want this to work:
setresuid(undef,undef,$suid);
But XS seems to take a bleak view of sending undef as a parameter. I can set default values, so:
setresuid($ruid,$euid)
Works, but that doesn't help the instance where someone specifically passes undef as an arg.
The C functions accept '-1' to leave a value unchanged, so what I need to do is change undef to -1. I'd rather not require my users to say '-1' in a perl script where the perlish thing to do would be to say undef.
Thanks!
--Pileofrogs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing undef to XSUB
by kyle (Abbot) on May 07, 2008 at 20:35 UTC | |
|
Re: Passing undef to XSUB
by educated_foo (Vicar) on May 07, 2008 at 21:21 UTC | |
by ikegami (Patriarch) on May 07, 2008 at 22:50 UTC | |
by syphilis (Archbishop) on May 08, 2008 at 00:49 UTC | |
by ikegami (Patriarch) on May 08, 2008 at 05:00 UTC | |
by syphilis (Archbishop) on May 08, 2008 at 07:32 UTC | |
by kyle (Abbot) on May 08, 2008 at 04:39 UTC | |
by syphilis (Archbishop) on May 08, 2008 at 07:57 UTC | |
by educated_foo (Vicar) on May 07, 2008 at 23:29 UTC | |
by ikegami (Patriarch) on May 07, 2008 at 23:31 UTC |