threads/75795: applications linked with -lc_r can't close() fd opened by kqueue().

Roman Nikitchenko roman at trifle.net
Wed Jan 5 09:40:30 GMT 2005


The following reply was made to PR threads/75795; it has been noted by GNATS.

From: Roman Nikitchenko <roman at trifle.net>
To: freebsd-gnats-submit at FreeBSD.org, roman at trifle.net
Cc:  
Subject: Re: threads/75795: applications linked with -lc_r can't close() fd
 opened by kqueue().
Date: Wed, 05 Jan 2005 11:33:04 +0200

 The reason was in unimplemented kqueue_stat() call (libc_r close() 
 relays on fstat() ).
 Here is my own version (sys/kern/kern_event.c) i used to workaround problem:
 
 /*ARGSUSED*/
 static int
 kqueue_stat(struct file *fp, struct stat *st, struct ucred *active_cred,
 	struct thread *td)
 {
 	struct kqueue *kq;
 	int error;
 
 	if ((error = kqueue_aquire(fp, &kq)))
 		return ENOENT;
 	KQ_LOCK(kq);
 	bzero((void *)st, sizeof(*st));
 	st->st_size = kq->kq_count;
 	kqueue_release(kq, 1);
 	KQ_UNLOCK(kq);
 	st->st_blksize = sizeof(struct kevent);
 	st->st_mode = S_IFIFO;
         return (0);
 }
 
 Please check / apply this as soon as possible. Any binary transfered from 4.x system and using kevent() subsystem won't work until this will be done. Any application with kevent()'s linked against libc_r too.
 
 -- 
 
 WBR,
 Roman Nikitchenko, http://smartgate.wtelecom.net
 _,,,_|\_/|_,,,_
 


More information about the freebsd-threads mailing list