Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Jun 1998 20:52:05 +1000 (EST)
From:      Simon Coggins <chaos@oz.org>
To:        John Birrell <jb@cimlogic.com.au>, freebsd-current@FreeBSD.ORG
Subject:   More problems with Threads on -current.
Message-ID:  <XFMail.980607205205.chaos@oz.org>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]

Got another one for you :)

Seems with threads there is something wrong with how fcntl() works, fcntl(fd,
F_SETFD, 1) doesn't work when you compile against libc_r.

I've included the program that shows this.


[simon@totally]:/tmp/thread/b> gcc -o t threads_test.c                         
[simon@totally]:/tmp/thread/b> ./t                                             
Before fcntl is 0
Before fcntl is 1
[simon@totally]:/tmp/thread/b> gcc -o t threads_test.c -pthread                
[simon@totally]:/tmp/thread/b> ./t                                             
Before fcntl is 0
Before fcntl is 0




Regards
Simon

      +---------------------------------------------------------------+
      |  Email: chaos@ultra.net.au, chaos@oz.org, simon@bofh.com.au   |
      |   http://www.ultra.net.au/~chaos   Ultranet Technical Admin.  |
      |       Chaos on IRC,    IRC Operator for the OzORG Network     |
      +---------------------------------------------------------------+
---
As long as the answer is right, who cares if the question is wrong?


[-- Attachment #2 --]
#include <stdio.h>
#include <fcntl.h>

void main()
{
	int fd;
	
	fd=open("/dev/zero", O_RDONLY);
	if(fd<3)
	{
		perror("open()");
		exit(0);
	}
	printf("Before fcntl is %d\n", fcntl(fd, F_GETFD, 0));
	fcntl(fd, F_SETFD, 1);
	printf("Before fcntl is %d\n", fcntl(fd, F_GETFD, 0));
	close(fd);
}

	

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.980607205205.chaos>