linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* About getopt()
@ 2002-08-08 14:48 William N. Zanatta
  2002-08-08 17:41 ` Glynn Clements
  2002-08-15 14:32 ` finer grained threading? Christopher Quinn
  0 siblings, 2 replies; 5+ messages in thread
From: William N. Zanatta @ 2002-08-08 14:48 UTC (permalink / raw)
  To: linux-c-programming

Hey,

   getopt() does memory allocation for the optarg pointer it sets when a 
value for it is found, right?
   ok, thus if I'm making something like

   char *str;
   ...

   str = optarg;


   I'll have to free() str later.

   Is that right???

   Thanks,

william

-- 
Perl combines all of the worst aspects of BASIC, C and line noise.
                 -- Keith Packard


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: About getopt()
  2002-08-08 14:48 About getopt() William N. Zanatta
@ 2002-08-08 17:41 ` Glynn Clements
  2002-08-15 14:32 ` finer grained threading? Christopher Quinn
  1 sibling, 0 replies; 5+ messages in thread
From: Glynn Clements @ 2002-08-08 17:41 UTC (permalink / raw)
  To: William N. Zanatta; +Cc: linux-c-programming


William N. Zanatta wrote:

>    getopt() does memory allocation for the optarg pointer it sets when a 
> value for it is found, right?

No. optarg will point at or into one of the elements of argv.

E.g. for "./foo -a hello", optarg will be equal to argv[2], while for
"./foo -ahello", optarg will be equal to argv[1]+2.

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* finer grained threading?
  2002-08-08 14:48 About getopt() William N. Zanatta
  2002-08-08 17:41 ` Glynn Clements
@ 2002-08-15 14:32 ` Christopher Quinn
  2002-08-15 15:00   ` Christopher Quinn
  1 sibling, 1 reply; 5+ messages in thread
From: Christopher Quinn @ 2002-08-15 14:32 UTC (permalink / raw)
  To: linux-c-programming

hi list,

I have been wondering about what happens to a locked resource within a 
set of kernel threads when the holding thread causes a page fault, say 
via touching a page of a mmap'ed file.

As far as I can see, there is no system call API means for the 
thread/process to take remedial action when this I/O delay occurs -
ie. it could be useful for the holding thread to yield its lock on the 
resource, allowing other threads to progress while it sleeps.

Does anyone know otherwise?

Is there any mechanism in the kernel allowing notification of a page 
fault event (or indeed other I/O related events) to be received by, say, 
some code encapsulated in a kernel module? ie. would writing a kernel 
module be any sort of option for me?

hope that's clear.
thanks,
chris Q.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: finer grained threading?
  2002-08-15 14:32 ` finer grained threading? Christopher Quinn
@ 2002-08-15 15:00   ` Christopher Quinn
  2002-08-15 15:37     ` Christopher Quinn
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Quinn @ 2002-08-15 15:00 UTC (permalink / raw)
  To: Christopher Quinn; +Cc: linux-c-programming

Ah!  As suspected I am not the first to think about this!  I have just 
found a DECthreads page mentioning upcalls and the ability to switch 
threads on a page fault event.

Is it correct to say LinuxThreads(pthreads impl.) cannot offer this feature?
Any suggestions for alternative thread packages for linux that do?

cheers,
chris Q.


Christopher Quinn wrote:
> hi list,
> 
> I have been wondering about what happens to a locked resource within a 
> set of kernel threads when the holding thread causes a page fault, say 
> via touching a page of a mmap'ed file.
> 
> As far as I can see, there is no system call API means for the 
> thread/process to take remedial action when this I/O delay occurs -
> ie. it could be useful for the holding thread to yield its lock on the 
> resource, allowing other threads to progress while it sleeps.
> 
> Does anyone know otherwise?
> 
> Is there any mechanism in the kernel allowing notification of a page 
> fault event (or indeed other I/O related events) to be received by, say, 
> some code encapsulated in a kernel module? ie. would writing a kernel 
> module be any sort of option for me?
> 
> hope that's clear.
> thanks,
> chris Q.
> 
> -
> To unsubscribe from this list: send the line "unsubscribe 
> linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



-- 
rgrds,
Chris Quinn


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: finer grained threading?
  2002-08-15 15:00   ` Christopher Quinn
@ 2002-08-15 15:37     ` Christopher Quinn
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Quinn @ 2002-08-15 15:37 UTC (permalink / raw)
  To: Christopher Quinn; +Cc: linux-c-programming

I'm tripping over myself...
the 'feature' I'm after is as originally stated, not as might or might 
not be fulfilled by DECthreads/LinuxThreads
ie. ability to register interest in/ receive noticification of, 
page-fault events.

sorry,
chris

Christopher Quinn wrote:
> Ah!  As suspected I am not the first to think about this!  I have just 
> found a DECthreads page mentioning upcalls and the ability to switch 
> threads on a page fault event.
> 
> Is it correct to say LinuxThreads(pthreads impl.) cannot offer this 
> feature?
> Any suggestions for alternative thread packages for linux that do?
> 
> cheers,
> chris Q.
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-08-15 15:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-08 14:48 About getopt() William N. Zanatta
2002-08-08 17:41 ` Glynn Clements
2002-08-15 14:32 ` finer grained threading? Christopher Quinn
2002-08-15 15:00   ` Christopher Quinn
2002-08-15 15:37     ` Christopher Quinn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).