public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Simultaneous open of same file under JNI
@ 1999-08-10  7:52 John Fralinger
  1999-08-31 23:49 ` John Fralinger
  0 siblings, 1 reply; 2+ messages in thread
From: John Fralinger @ 1999-08-10  7:52 UTC (permalink / raw)
  To: cygwin

The following code demonstrates where System V shared memory
is breaking.

It uses Mumit Khan's JNI example environment.

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <jni.h>
#include "HelloWorld.h"

JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld (JNIEnv *env, jobject obj)
{
  char *home;
  int fd;
  char resp[256];

  printf("Java JNI\n");
  home = getenv ("HOME");
  printf("HOME = %s\n", (home) ? home : "(NULL)");
  printf("Enter any existing file name (complete path) to open\n");
  gets( resp );
  if ( ( fd = open( resp, O_RDWR ) ) == -1 )
	  perror( "open failed" );
  printf("Run again from another window BEFORE Enter to exit\n");
  printf("(Use the same file name to demonstrate problem)\n");
  gets( resp );
  return;
}

Shouldn't this work the same way when called from JNI????
When I run 2 of these to the same file I get Permission denied!
John H. Fralinger         |
SW Contract Engineer      |      1-610-255-5607
Research & Development    |

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

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

* Simultaneous open of same file under JNI
  1999-08-10  7:52 Simultaneous open of same file under JNI John Fralinger
@ 1999-08-31 23:49 ` John Fralinger
  0 siblings, 0 replies; 2+ messages in thread
From: John Fralinger @ 1999-08-31 23:49 UTC (permalink / raw)
  To: cygwin

The following code demonstrates where System V shared memory
is breaking.

It uses Mumit Khan's JNI example environment.

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <jni.h>
#include "HelloWorld.h"

JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld (JNIEnv *env, jobject obj)
{
  char *home;
  int fd;
  char resp[256];

  printf("Java JNI\n");
  home = getenv ("HOME");
  printf("HOME = %s\n", (home) ? home : "(NULL)");
  printf("Enter any existing file name (complete path) to open\n");
  gets( resp );
  if ( ( fd = open( resp, O_RDWR ) ) == -1 )
	  perror( "open failed" );
  printf("Run again from another window BEFORE Enter to exit\n");
  printf("(Use the same file name to demonstrate problem)\n");
  gets( resp );
  return;
}

Shouldn't this work the same way when called from JNI????
When I run 2 of these to the same file I get Permission denied!
John H. Fralinger         |
SW Contract Engineer      |      1-610-255-5607
Research & Development    |

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

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

end of thread, other threads:[~1999-08-31 23:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-10  7:52 Simultaneous open of same file under JNI John Fralinger
1999-08-31 23:49 ` John Fralinger

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 read-only IMAP folder(s) and NNTP newsgroup(s).