* nanosleep ?
@ 1999-08-20 4:00 Andreas Schnorr ATS/AT #47493
1999-08-20 4:00 ` linnartz
1999-08-23 4:00 ` Mark Koennecke
0 siblings, 2 replies; 14+ messages in thread
From: Andreas Schnorr ATS/AT #47493 @ 1999-08-20 4:00 UTC (permalink / raw)
I'm using a OSF1 sca1000a V4.0 878 alpha and the
DIGITAL C++ V6.1-029 on DIGITAL UNIX V4.0 (Rev. 878) compiler.
Porting from Solaris to DEC I got problems to link 'nanosleep'.
I hav'nt found this function in the POSIX Guide. Whats about this
function on DEC ? Is there a similar function ?
Thanx
--
--- O =(O)
-- <^_ __/__,
-- \/\ _' /
--- \ \/\
\_
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: nanosleep ? 1999-08-20 4:00 nanosleep ? Andreas Schnorr ATS/AT #47493 @ 1999-08-20 4:00 ` linnartz 1999-08-23 4:00 ` Mark Koennecke 1 sibling, 0 replies; 14+ messages in thread From: linnartz @ 1999-08-20 4:00 UTC (permalink / raw) As the man page mentions, nanosleep belongs to 1003.1b. Due to this you have to add the -lrt (librt.so) to your compile/link line. Pit Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: nanosleep ? 1999-08-20 4:00 nanosleep ? Andreas Schnorr ATS/AT #47493 1999-08-20 4:00 ` linnartz @ 1999-08-23 4:00 ` Mark Koennecke 1999-08-23 4:00 ` Dave Butenhof 1 sibling, 1 reply; 14+ messages in thread From: Mark Koennecke @ 1999-08-23 4:00 UTC (permalink / raw) Andreas, It is in the man pages as nanosleep for DU4.0D. But for some reason I call the function as nanosleep_d9. I solve this a long time ago, so I do not remember how I came to that conclusion....... But it is in my code and working fine... Mark Koennecke ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: nanosleep ? 1999-08-23 4:00 ` Mark Koennecke @ 1999-08-23 4:00 ` Dave Butenhof 1999-08-23 4:00 ` David T. Blake 1999-08-24 4:00 ` Mark Koennecke 0 siblings, 2 replies; 14+ messages in thread From: Dave Butenhof @ 1999-08-23 4:00 UTC (permalink / raw) Mark Koennecke wrote: > It is in the man pages as nanosleep for DU4.0D. But for some reason I > call the function as nanosleep_d9. The "_d9" identifies that version of nanosleep with the long-since obsolete "draft 9" of the document that eventually (that is, 6 years ago) became the POSIX 1003.1b-1993 "realtime" standard. You shouldn't be using that obsolete (and undocumented) function, as it may be removed "at any time". The POSIX 1003.1b-1993 nanosleep() function can be found, as someone already said, in the librt library. You must use -lrt when linking any program that uses it. /---------------------------[ Dave Butenhof ]--------------------------\ | Compaq Computer Corporation David.Butenhof@compaq.com | | 110 Spit Brook Rd ZKO2-3/Q18 http://members.aol.com/drbutenhof | | Nashua NH 03062-2698 http://www.awl.com/cseng/titles/0-201-63392-2/ | \-----------------[ Better Living Through Concurrency ]----------------/ ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: nanosleep ? 1999-08-23 4:00 ` Dave Butenhof @ 1999-08-23 4:00 ` David T. Blake 1999-08-25 4:00 ` wordexp (not Re: nanosleep ?) Daniel S. Riley 1999-08-25 4:00 ` nanosleep ? Dave Butenhof 1999-08-24 4:00 ` Mark Koennecke 1 sibling, 2 replies; 14+ messages in thread From: David T. Blake @ 1999-08-23 4:00 UTC (permalink / raw) Dave Butenhof <David.Butenhof@compaq.com> wrote: > Mark Koennecke wrote: > > > It is in the man pages as nanosleep for DU4.0D. But for some reason I > > call the function as nanosleep_d9. > > The "_d9" identifies that version of nanosleep with the long-since > obsolete "draft 9" of the document that eventually (that is, 6 years > ago) became the POSIX 1003.1b-1993 "realtime" standard. You shouldn't be > using that obsolete (and undocumented) function, as it may be removed > "at any time". > > The POSIX 1003.1b-1993 nanosleep() function can be found, as someone > already said, in the librt library. You must use -lrt when linking any > program that uses it. I have a question for someone knowledgable on Dec's libc library. I tried to use the wordexp function in a C program only to have it fail. I compiled with debugging symbols and ran dbx only to find the problem. The wordexp function in the c library makes a call to ksh -c set -- ~/.Xdef*; echo $#; while [ $# -gt 0 ]; do \ echo "${#1}"; echo "$1"; shift; done So that if the environment is not what ksh wants, you get a return value of zero. What do I need to do in my program to ensure that the above ksh call works properly ? On a second note, it is pretty messed up to have your C library functions rely on ksh expansions. It really ought to go the other way. -- Dave Blake dblake@phy.ucsf.edu ^ permalink raw reply [flat|nested] 14+ messages in thread
* wordexp (not Re: nanosleep ?) 1999-08-23 4:00 ` David T. Blake @ 1999-08-25 4:00 ` Daniel S. Riley 1999-08-25 4:00 ` David T. Blake 1999-08-25 4:00 ` nanosleep ? Dave Butenhof 1 sibling, 1 reply; 14+ messages in thread From: Daniel S. Riley @ 1999-08-25 4:00 UTC (permalink / raw) dblake@popper.ucsf.edu (David T. Blake) writes: > So that if the environment is not what ksh wants, you get a return > value of zero. What do I need to do in my program to ensure that > the above ksh call works properly ? Have you set WRDE_SHOWERR to see if anything prints to stderr? > On a second note, it is pretty messed up to have your C library > functions rely on ksh expansions. It really ought to go the other > way. POSIX Std 1003.2-1992, section E.9.9 (Rationale and Notes): While wordexp() could be implemented entirely as a library routine, it is expected that most implimentations will run a shell in a subprocess to do the expansion. wordexp() is not even close to what I would consdider a core C library routine, sh and ksh predate wordexp() considerably, and, given all the weird parsing they do, getting wordexp() into a form actually usable by the various shells would be next to impossible. In context, forking a shell to do shell word expansion is a reasonable implimentation, as the POSIX committee acknowledged. -- Dan Riley dsr@mail.lns.cornell.edu Wilson Lab, Cornell University <URL:http://www.lns.cornell.edu/~dsr/> "History teaches us that days like this are best spent in bed" ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: wordexp (not Re: nanosleep ?) 1999-08-25 4:00 ` wordexp (not Re: nanosleep ?) Daniel S. Riley @ 1999-08-25 4:00 ` David T. Blake 1999-08-25 4:00 ` David T. Blake 0 siblings, 1 reply; 14+ messages in thread From: David T. Blake @ 1999-08-25 4:00 UTC (permalink / raw) Daniel S. Riley <dsr@mail.lns.cornell.edu> wrote: > dblake@popper.ucsf.edu (David T. Blake) writes: > > So that if the environment is not what ksh wants, you get a return > > value of zero. What do I need to do in my program to ensure that > > the above ksh call works properly ? > > Have you set WRDE_SHOWERR to see if anything prints to stderr? Yes. It fails without error, which is exactly the problem. > > On a second note, it is pretty messed up to have your C library > > functions rely on ksh expansions. It really ought to go the other > > way. > > POSIX Std 1003.2-1992, section E.9.9 (Rationale and Notes): > > While wordexp() could be implemented entirely as a library routine, > it is expected that most implimentations will run a shell in a > subprocess to do the expansion. > > wordexp() is not even close to what I would consdider a core C > library routine, sh and ksh predate wordexp() considerably, and, > given all the weird parsing they do, getting wordexp() into a > form actually usable by the various shells would be next to > impossible. In context, forking a shell to do shell word > expansion is a reasonable implimentation, as the POSIX committee > acknowledged. sh and ksh HAVE to implement the routine in C anyway, or in whatever language used to contruct them. The GNU C library has a full implementation of the word expansion, and does NOT fork a system call to do globbing, tilde expansion, or variable expansion. About the only thing you NEED the shell for is a command expansion (ie: such as $(which .Xdefaults) in bash ) Besides, sh doesn't perform full word expansion anyway. The issue really arises if ksh considers the environment from which you call wordexp a restricted one, in which case ksh simply does not do the expansion. That means the C library fails in a miserable and confused way leaving you without word expansion at all, and no errors reported by the routine. -- Dave Blake dblake@phy.ucsf.edu ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: wordexp (not Re: nanosleep ?) 1999-08-25 4:00 ` David T. Blake @ 1999-08-25 4:00 ` David T. Blake 1999-08-26 4:00 ` Peter da Silva 0 siblings, 1 reply; 14+ messages in thread From: David T. Blake @ 1999-08-25 4:00 UTC (permalink / raw) David T. Blake <dblake@popper.ucsf.edu> wrote: > The issue really arises if ksh considers the environment from > which you call wordexp a restricted one, in which case ksh simply > does not do the expansion. That means the C library fails in a > miserable and confused way leaving you without word expansion > at all, and no errors reported by the routine. Hate to followup on my own post, but I realized that the real issue I wish to address is not clear in my posting. I really don't care too much how libc does the wordexp function as long as it works properly. It seems to work by executing the command ksh -c set -- ~/.Xdef*; echo $#; while [ $# -gt 0 ]; \ do echo "${#1}"; echo "$1"; shift; done Where ~/.Xdef* is the argument you wish to expand. Under some circumstances this fails, and I THINK this is due to ksh considering the shell environment restricted. I wish to know how to make the word expansion work all the time irrespective of the environment and program that call it. Any ideas ?? -- Dave Blake dblake@phy.ucsf.edu ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: wordexp (not Re: nanosleep ?) 1999-08-25 4:00 ` David T. Blake @ 1999-08-26 4:00 ` Peter da Silva 1999-08-26 4:00 ` David T. Blake 0 siblings, 1 reply; 14+ messages in thread From: Peter da Silva @ 1999-08-26 4:00 UTC (permalink / raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 488 bytes --] In article <slrn7s8snf.gh6.dblake@popper.ucsf.edu>, David T. Blake <dblake@phy.ucsf.edu> wrote: >I wish to know >how to make the word expansion work all the time irrespective >of the environment and program that call it. man opendir man regexp or man re_exec -- In hoc signo hack, Peter da Silva <peter@baileynm.com> `-_-' Ar rug t� barr�g ar do mhact�re inniu? 'U` << <KH> you did technical support for Hell ? <susan> Didn't we all, in our youth? >:) >> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: wordexp (not Re: nanosleep ?) 1999-08-26 4:00 ` Peter da Silva @ 1999-08-26 4:00 ` David T. Blake 1999-08-26 4:00 ` Peter da Silva 0 siblings, 1 reply; 14+ messages in thread From: David T. Blake @ 1999-08-26 4:00 UTC (permalink / raw) Peter da Silva <peter@baileynm.com> wrote: > In article <slrn7s8snf.gh6.dblake@popper.ucsf.edu>, > David T. Blake <dblake@phy.ucsf.edu> wrote: > >I wish to know > >how to make the word expansion work all the time irrespective > >of the environment and program that call it. > > man opendir > man regexp or man re_exec Of course writing my own is an option. Regexp and opendir would not be as useful as getpwname, getenv, and glob/globfree though. However, it seems pretty silly to duplicate functionality that exists in libc already. I mean, what would be the point of even having anything other than read and write in libc if you have to write all higher level functions yourself ?? -- Dave Blake dblake@phy.ucsf.edu ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: wordexp (not Re: nanosleep ?) 1999-08-26 4:00 ` David T. Blake @ 1999-08-26 4:00 ` Peter da Silva 0 siblings, 0 replies; 14+ messages in thread From: Peter da Silva @ 1999-08-26 4:00 UTC (permalink / raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 877 bytes --] In article <slrn7sb4b1.hkf.dblake@popper.ucsf.edu>, David T. Blake <dblake@phy.ucsf.edu> wrote: >However, it seems pretty silly to duplicate functionality that >exists in libc already. This function is apparently a neologism invented by POSIX that's not widely implemented in a reliable way, so I would avoid using it in code I intended to be portable. >I mean, what would be the point of even having anything other than >read and write in libc if you have to write all higher level >functions yourself ?? Some of the subroutines in libc should be avoided or used only with care. System, popen, gets, scanf, fscanf, and sprintf also come to mind. -- In hoc signo hack, Peter da Silva <peter@baileynm.com> `-_-' Ar rug t� barr�g ar do mhact�re inniu? 'U` << <KH> you did technical support for Hell ? <susan> Didn't we all, in our youth? >:) >> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: nanosleep ? 1999-08-23 4:00 ` David T. Blake 1999-08-25 4:00 ` wordexp (not Re: nanosleep ?) Daniel S. Riley @ 1999-08-25 4:00 ` Dave Butenhof 1999-08-25 4:00 ` David T. Blake 1 sibling, 1 reply; 14+ messages in thread From: Dave Butenhof @ 1999-08-25 4:00 UTC (permalink / raw) "David T. Blake" wrote: > Dave Butenhof <David.Butenhof@compaq.com> wrote: > > > The POSIX 1003.1b-1993 nanosleep() function can be found, as someone > > already said, in the librt library. You must use -lrt when linking any > > program that uses it. > > I have a question for someone knowledgable on Dec's libc library. > I tried to use the wordexp function in a C program only to have > it fail. It's quite likely that anyone capable of answering your question will not bother to read your posting. (A title of "Re: nanosleep ?" is not likely to interest an expert in wordexp who doesn't care about nanosleep.) It's also extraneous and possibly a bit annoying to those who ARE trying to follow this thread. Don't "reply" when you mean to write a new message. It doesn't help anyone. More pragmatically, I might conclude that you're simply replying to my posting because, from the fact that I answered a question about libc, you inferred that I must be an expert on all possible uses of libc. Untrue. I've never used wordexp, and I know nothing of the implementation. While I could figure it out as well as anyone else with access to the sources, I'm afraid I must decline the invitation and do some work, instead. Good luck; but you'll improve your luck with a more appropriately placed (and titled) question. /---------------------------[ Dave Butenhof ]--------------------------\ | Compaq Computer Corporation David.Butenhof@compaq.com | | 110 Spit Brook Rd ZKO2-3/Q18 http://members.aol.com/drbutenhof | | Nashua NH 03062-2698 http://www.awl.com/cseng/titles/0-201-63392-2/ | \-----------------[ Better Living Through Concurrency ]----------------/ ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: nanosleep ? 1999-08-25 4:00 ` nanosleep ? Dave Butenhof @ 1999-08-25 4:00 ` David T. Blake 0 siblings, 0 replies; 14+ messages in thread From: David T. Blake @ 1999-08-25 4:00 UTC (permalink / raw) Dave Butenhof <David.Butenhof@compaq.com> wrote: > More pragmatically, I might conclude that you're simply > replying to my posting because, from the fact that I answered a > question about libc, you inferred that I must be an expert on all > possible uses of libc. Untrue. I've never used wordexp, and I > know nothing of the implementation. While I could figure it out > as well as anyone else with access to the sources, That there becomes the key. Dec's libc is closed, and I have absolutely no way to solve my problem. Emails to technical support have been a bust, as have previously postings about a week ago in this newsgroup about the use of wordexp in Dec libc. It is kind of like debugging against a brick wall. It works right under some conditions, and not under others, and all I have to go by is the shell line it forks that only works SOMETIMES. And I want to know how to make it work ALL THE TIME. As a point of curiousity, I am also interested in the general pragmatics of making libc dependent on the integrity of ksh. I would think libc above all should be standalone as much as possible. If you can't trust libc functions to be able to work as advertised in the man page, where does that leave you as a developer ?? -- Dave Blake dblake@phy.ucsf.edu ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: nanosleep ? 1999-08-23 4:00 ` Dave Butenhof 1999-08-23 4:00 ` David T. Blake @ 1999-08-24 4:00 ` Mark Koennecke 1 sibling, 0 replies; 14+ messages in thread From: Mark Koennecke @ 1999-08-24 4:00 UTC (permalink / raw) Dave Butenhof wrote: > Mark Koennecke wrote: > > > It is in the man pages as nanosleep for DU4.0D. But for some reason I > > call the function as nanosleep_d9. > > The "_d9" identifies that version of nanosleep with the long-since > obsolete "draft 9" of the document that eventually (that is, 6 years Thanks, that is a helpful clarification. I did not knew that.......... MK ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~1999-08-26 4:00 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1999-08-20 4:00 nanosleep ? Andreas Schnorr ATS/AT #47493 1999-08-20 4:00 ` linnartz 1999-08-23 4:00 ` Mark Koennecke 1999-08-23 4:00 ` Dave Butenhof 1999-08-23 4:00 ` David T. Blake 1999-08-25 4:00 ` wordexp (not Re: nanosleep ?) Daniel S. Riley 1999-08-25 4:00 ` David T. Blake 1999-08-25 4:00 ` David T. Blake 1999-08-26 4:00 ` Peter da Silva 1999-08-26 4:00 ` David T. Blake 1999-08-26 4:00 ` Peter da Silva 1999-08-25 4:00 ` nanosleep ? Dave Butenhof 1999-08-25 4:00 ` David T. Blake 1999-08-24 4:00 ` Mark Koennecke
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox