[comp.unix.programmer] Troubles opening the same file on 2 nodes

u715@JSP.UMontreal.CA (Beliveau Steeve) (03/25/91)

Hi!
	Here's a little program that will well explain my problem :

#include <sys/file.h>

main()
{
	int fd;

	if (open("test", O_RDWR, 0777) == -1)
		perror("THE error:");
	for(;;);
}

	And the error is: Text file busy.

If I execute this program on the same node, on two different shell there is no errors. 
  
So what is the difference between excuting on the same or on two nodes?
 
I'm doing this on Apollo sr-10.2+ with BSD4.3.
	
	Thanks for any help you can give me!

	
-- 
----------------------------------------------------------------------------
	Steeve Beliveau          | Allen's Axiom:  When all else fails,
email : u715@jsp.umontreal.ca    |                 follow the instructions.
----------------------------------------------------------------------------

jik@athena.mit.edu (Jonathan I. Kamens) (03/25/91)

In article <1991Mar24.191011.14552@IRO.UMontreal.CA>, u715@JSP.UMontreal.CA (Beliveau Steeve) writes:
|> Hi!
|> 	Here's a little program that will well explain my problem :

  No, actually, it doesn't explain it very well at all, at least not as far as
I can tell.

|> #include <sys/file.h>
|> 
|> main()
|> {
|> 	int fd;
|> 
|> 	if (open("test", O_RDWR, 0777) == -1)
|> 		perror("THE error:");
|> 	for(;;);
|> }

  What is the "test" file you're trying to open?  Is it a text file, or is it
the binary you have compiled from the source code above?  Or something else?

  Is the file on the local hard disk, or is it on a network file system disk? 
If so, what kind of network file system?  NFS?  AFS?  Something else?

|> 	And the error is: Text file busy.
|> 
|> If I execute this program on the same node, on two different shell there is no errors. 
|>   
|> So what is the difference between excuting on the same or on two nodes?

  If you're talking about a network file system, then is the file local on
either of the machines you're running it on, or is it on a third-party
fileserver?

  And I'm assuming that when you say "node," you mean machine on the network. 
Is that correct?

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710

bhoughto@pima.intel.com (Blair P. Houghton) (03/25/91)

In article <1991Mar25.113854.6560@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:
>In article <1991Mar24.191011.14552@IRO.UMontreal.CA>, u715@JSP.UMontreal.CA (Beliveau Steeve) writes:
>|> Hi!
>|> 	Here's a little program that will well explain my problem :
>
>  No, actually, it doesn't explain it very well at all, at least not as far as
>I can tell.

It's a mite clearer if you actually use Apollo machinery;
I'm lucky (sic) enough to, myself, so I understand what
he's saying, but I'm no Apollo-wizzie, so I refrained
(miracle of miracles! :) from responding.

>  What is the "test" file you're trying to open?  Is it a text file, or is it
>the binary you have compiled from the source code above?  Or something else?

Irrelevant to the situation; we can be sure here that
it's related to the OS and not the data.

>  Is the file on the local hard disk, or is it on a network file system disk? 
>If so, what kind of network file system?  NFS?  AFS?  Something else?

Something else, most definitely.

On an Apollo Domain/OS system, a "node" is a machine; ostensibly,
all Apollos can be connected all over the world; each has a unique
node_name built into it; this makes software licensing (especially
license timeouts) something of a cake-walk (though fiddling with
date(1) is always available).

Generally they're connected in a "ring" and very tightly
so; it's possible to access files on any node on the ring
simply by prefacing a pathname with "//node_name".  You could
get the same effect in NFS by making a directory /node_name
and nfs-mounting the root-directory from node_name onto it.
(Domain/OS, however, maintains links dynamically, apparently
using some sort of refresh system, and has a table-of-contents
database to cut down on file-retrieval time.  It's much niftier
than I can say adequately.  It's the networked fs NFS dreams
of becoming).

The ring is also a tighly coupled processing facility, allowing
somewhat transparent remote-cpu activity, but it's more like
rsh(1) than it should be, given the connectivity.

The system also implements a rather tight-fisted locking
system, which usually surprises me with its ability to
prevent access to a file.  Here we have a situation where
multiple read/write accesses from the local node are
permitted, but trying it simultaneously from different
nodes blows chunks.  (Just to say it "blows chunks" pretty
much stretches the depth of my understanding of the
network-locking-mechanism, so don't take my word for it).

>|> 	And the error is: Text file busy.
>|> 
>|> If I execute this program on the same node, on two different shell there is no errors. 
>|>   
>|> So what is the difference between excuting on the same or on two nodes?
>
>  If you're talking about a network file system, then is the file local on
>either of the machines you're running it on, or is it on a third-party
>fileserver?

That's entirely possible, too.

>  And I'm assuming that when you say "node," you mean machine on the network. 
>Is that correct?

On "a" network, but not necessarily the Internet.


My suggestion here is that our Canadian Friend take a look
over on comp.sys.apollo for the answer.  (I'd crosspost,
but something's wedged our nntp server, and half the groups
got blown away)


				--Blair
				  "I bet it was the number of
				   inodes being sucked-down by
				   alt.romance.chat..."

goehring@gnu.ai.mit.edu (Not Marc Spencer) (03/26/91)

In article <1991Mar24.191011.14552@IRO.UMontreal.CA> u715@JSP.UMontreal.CA (Beliveau Steeve) writes:

   Here's a little program that will well explain my problem :

   [program deleted]

not in the slightest.  i have no idea what you are trying to do.  care
to try again?
--
		  Help stamp out vi in our lifetime!
	Scott Goehring			goehring@gnu.ai.mit.edu
	On exile in Indianapolis, IN

bill@bilver.uucp (Bill Vermillion) (03/29/91)

In article <1991Mar24.191011.14552@IRO.UMontreal.CA> u715@JSP.UMontreal.CA (Beliveau Steeve) writes:
>Hi!
>	Here's a little program that will well explain my problem :
.....
>	if (open("test", O_RDWR, 0777) == -1)
                 ^^^^^^
Could it be that your program is opening the file "/bin/test".  Are
you really using a file name called test?

-- 
Bill Vermillion - UUCP: uunet!tarpit!bilver!bill
                      : bill@bilver.UUCP