delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/09/17/13:47:37

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200009171747.TAA19977@father.ludd.luth.se>
Subject: FSEXT and write()
To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS)
Date: Sun, 17 Sep 2000 19:47:27 +0200 (MET DST)
X-Mailer: ELM [version 2.4ME+ PL54 (25)]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

In src/libc/posix/unistd/write.c I find this:

ssize_t
write(int handle, const void* buffer, size_t count)
{
  const char *buf = (const char *)buffer;
  int bytes_in_tb = 0;
  int offset_into_buf = 0;
  __dpmi_regs r;

  ssize_t rv;
  __FSEXT_Function *func = __FSEXT_get_function(handle);

  /* termios special hook */
  if (__libc_write_termios_hook != NULL)
      if (__libc_write_termios_hook(handle, buffer, count, &rv) != 0)
        return rv;

  if (count == 0)
    return 0; /* POSIX.1 requires this */

  if(__file_handle_modes[handle] & O_BINARY)
    return _write(handle, buf, count);

  /* Let's handle FSEXT_write ! */
  if(func &&                            /* if handler is installed, ...*/
     func(__FSEXT_write, &rv, &handle)) /* ... call extension ... */
      return rv;                        /* ... and exit if handled. */

This seems to mean that if a file is open()ed with O_BINARY, the FSEXT
won't be called.

Am I missing something? Perhaps __file_handle_modes isn't what I
thought it is?


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019