delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/05/03/10:04:23

Date: Sat, 03 May 2003 14:29:30 +0100
From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
Sender: rich AT phekda DOT freeserve DOT co DOT uk
To: djgpp-workers AT delorie DOT com
X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
Subject: Define __tb_size in <go32.h> and use it [PATCH]
Message-Id: <E19Bx0H-00019a-00@phekda.freeserve.co.uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Below is a patch to define __tb_size in <go32.h> and use it.
It will probably apply with a little fuzz in the fstat and
wc204.txi parts.

Quite a bit of code does the equivalent of:

    #define __tb_size _go32_info_block.size_of_transfer_buffer

or:

    int __tb_size = _go32_info_block.size_of_transfer_buffer;

This patch defines a __tb_size to go along with __tb, the linear
address of the transfer buffer, and then updates the code to use it.
All uses of _go32_info_block.size_of_transfer_buffer have been changed
to use __tb_size instead.

OK to commit?

Thanks, bye, Rich =]

Index: include/go32.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/go32.h,v
retrieving revision 1.5
diff -p -c -3 -r1.5 go32.h
*** include/go32.h	4 Feb 2003 20:23:33 -0000	1.5
--- include/go32.h	3 May 2003 13:18:13 -0000
*************** extern __Go32_Info_Block _go32_info_bloc
*** 62,67 ****
--- 62,68 ----
  #define _dos_ds _go32_info_block.selector_for_linear_memory
  
  #define __tb _go32_info_block.linear_address_of_transfer_buffer
+ #define __tb_size _go32_info_block.size_of_transfer_buffer
  
  /* returns number of times hit since last call. (zero first time) */
  unsigned _go32_was_ctrl_break_hit(void);
Index: src/debug/common/v2load.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/debug/common/v2load.c,v
retrieving revision 1.11
diff -p -c -3 -r1.11 v2load.c
*** src/debug/common/v2load.c	2 Sep 2001 17:05:21 -0000	1.11
--- src/debug/common/v2load.c	3 May 2003 13:18:14 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
***************
*** 23,30 ****
  #include <sys/stat.h>
  #include <ctype.h>
  #define SIMAGIC "go32stub"
- 
- #define __tb_size _go32_info_block.size_of_transfer_buffer
  
  AREAS areas[MAX_AREA];
  
--- 24,29 ----
Index: src/libc/ansi/stdio/flsbuf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/flsbuf.c,v
retrieving revision 1.11
diff -p -c -3 -r1.11 flsbuf.c
*** src/libc/ansi/stdio/flsbuf.c	29 Jan 2003 01:28:34 -0000	1.11
--- src/libc/ansi/stdio/flsbuf.c	3 May 2003 13:18:20 -0000
*************** _flsbuf(int c, FILE *f)
*** 39,45 ****
    /* if the buffer is not yet allocated, allocate it */
    if ((base = f->_base) == NULL && (f->_flag & _IONBF) == 0)
    {
!     size = _go32_info_block.size_of_transfer_buffer;
      if ((f->_base = base = malloc (size)) == NULL)
      {
        f->_flag |= _IONBF;
--- 39,45 ----
    /* if the buffer is not yet allocated, allocate it */
    if ((base = f->_base) == NULL && (f->_flag & _IONBF) == 0)
    {
!     size = __tb_size;
      if ((f->_base = base = malloc (size)) == NULL)
      {
        f->_flag |= _IONBF;
Index: src/libc/ansi/stdio/filbuf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/filbuf.c,v
retrieving revision 1.8
diff -p -c -3 -r1.8 filbuf.c
*** src/libc/ansi/stdio/filbuf.c	22 Dec 2002 04:42:28 -0000	1.8
--- src/libc/ansi/stdio/filbuf.c	3 May 2003 13:18:20 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
*************** _filbuf(FILE *f)
*** 41,47 ****
    f->_flag &= ~_IOUNGETC;
  
    if (f->_base==NULL && (f->_flag&_IONBF)==0) {
!     size = _go32_info_block.size_of_transfer_buffer;
      if ((f->_base = malloc(size)) == NULL)
      {
        f->_flag |= _IONBF;
--- 42,48 ----
    f->_flag &= ~_IOUNGETC;
  
    if (f->_base==NULL && (f->_flag&_IONBF)==0) {
!     size = __tb_size;
      if ((f->_base = malloc(size)) == NULL)
      {
        f->_flag |= _IONBF;
Index: src/libc/compat/ioctl/ioctl.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/ioctl/ioctl.c,v
retrieving revision 1.6
diff -p -c -3 -r1.6 ioctl.c
*** src/libc/compat/ioctl/ioctl.c	17 Oct 2002 23:00:24 -0000	1.6
--- src/libc/compat/ioctl/ioctl.c	3 May 2003 13:18:26 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
*************** import djgpp 2.02
*** 133,143 ****
  #include <sys/fsext.h>
  #include <dos.h>
  #include <libc/dosio.h>
- 
- /*
- ** This one might be added to <go32.h>
- */
- #define __tb_size _go32_info_block.size_of_transfer_buffer
  
  static int _dos_ioctl(int fd, int cmd, int argcx,int argdx,int argsi,int argdi,
                        int xarg)
--- 134,139 ----
Index: src/libc/compat/mntent/mntent.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/mntent/mntent.c,v
retrieving revision 1.8
diff -p -c -3 -r1.8 mntent.c
*** src/libc/compat/mntent/mntent.c	2 Oct 2001 03:22:50 -0000	1.8
--- src/libc/compat/mntent/mntent.c	3 May 2003 13:18:30 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
*************** get_jam_info(int drive_num)
*** 280,286 ****
    if (jam_version < 0x110)      /* version sanity check */
      return 0;
    /* Sanity check of the size of the JAMINFO structure.  */
!   if (r.x.cx < 0x115 || r.x.cx > _go32_info_block.size_of_transfer_buffer)
      return 0;
    if (jam_version >= 0x120 && r.x.cx < 0x124)
      return 0;
--- 281,287 ----
    if (jam_version < 0x110)      /* version sanity check */
      return 0;
    /* Sanity check of the size of the JAMINFO structure.  */
!   if (r.x.cx < 0x115 || r.x.cx > __tb_size)
      return 0;
    if (jam_version >= 0x120 && r.x.cx < 0x124)
      return 0;
Index: src/libc/crt0/crt1.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/crt0/crt1.c,v
retrieving revision 1.9
diff -p -c -3 -r1.9 crt1.c
*** src/libc/crt0/crt1.c	21 Dec 2002 20:22:34 -0000	1.9
--- src/libc/crt0/crt1.c	3 May 2003 13:18:36 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
*************** setup_go32_info_block(void)
*** 109,115 ****
  
    _go32_info_block.size_of_this_structure_in_bytes = sizeof(_go32_info_block);
    __tb = _stubinfo->ds_segment * 16;
!   _go32_info_block.size_of_transfer_buffer = _stubinfo->minkeep;
    _go32_info_block.pid = _stubinfo->psp_selector;
    _go32_info_block.master_interrupt_controller_base = ver.master_pic;
    _go32_info_block.slave_interrupt_controller_base = ver.slave_pic;
--- 110,116 ----
  
    _go32_info_block.size_of_this_structure_in_bytes = sizeof(_go32_info_block);
    __tb = _stubinfo->ds_segment * 16;
!   __tb_size = _stubinfo->minkeep;
    _go32_info_block.pid = _stubinfo->psp_selector;
    _go32_info_block.master_interrupt_controller_base = ver.master_pic;
    _go32_info_block.slave_interrupt_controller_base = ver.slave_pic;
Index: src/libc/dos/dos/int86.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/dos/int86.c,v
retrieving revision 1.2
diff -p -c -3 -r1.2 int86.c
*** src/libc/dos/dos/int86.c	3 Nov 1997 00:01:44 -0000	1.2
--- src/libc/dos/dos/int86.c	3 May 2003 13:18:36 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  #include <libc/stubs.h>
***************
*** 8,15 ****
  
  int _int86(int ivec, union REGS *in, union REGS *out);
  
- #define tbsize _go32_info_block.size_of_transfer_buffer
- 
  int int86(int ivec, union REGS *in, union REGS *out)
  {
    __dpmi_regs regs;
--- 9,14 ----
*************** int int86(int ivec, union REGS *in, unio
*** 65,71 ****
          unsigned total = 0;
          regs.x.dx = 0;
          while(count) {
!           regs.x.cx = (count <= tbsize) ? count : tbsize;
            __dpmi_int(0x21, &regs);
            if(regs.x.flags & 1)
              goto doexit;
--- 64,70 ----
          unsigned total = 0;
          regs.x.dx = 0;
          while(count) {
!           regs.x.cx = (count <= __tb_size) ? count : __tb_size;
            __dpmi_int(0x21, &regs);
            if(regs.x.flags & 1)
              goto doexit;
*************** int int86(int ivec, union REGS *in, unio
*** 89,95 ****
          unsigned total = 0;
          regs.x.dx = 0;
          do {
!           regs.x.cx = (count <= tbsize) ? count : tbsize;
            dosmemput(ptr, regs.x.cx, __tb);
            __dpmi_int(0x21, &regs);
            if(regs.x.flags & 1)
--- 88,94 ----
          unsigned total = 0;
          regs.x.dx = 0;
          do {
!           regs.x.cx = (count <= __tb_size) ? count : __tb_size;
            dosmemput(ptr, regs.x.cx, __tb);
            __dpmi_int(0x21, &regs);
            if(regs.x.flags & 1)
Index: src/libc/dos/io/_read.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_read.c,v
retrieving revision 1.3
diff -p -c -3 -r1.3 _read.c
*** src/libc/dos/io/_read.c	29 Jan 2003 01:19:45 -0000	1.3
--- src/libc/dos/io/_read.c	3 May 2003 13:18:41 -0000
*************** _read(int handle, void* buffer, size_t c
*** 18,24 ****
  {
    size_t j, k;
    int ngot;
-   unsigned long tbsize;
    __dpmi_regs r;
  
    __FSEXT_Function *func = __FSEXT_get_function(handle);
--- 18,23 ----
*************** _read(int handle, void* buffer, size_t c
*** 29,38 ****
        return rv;
    }
  
-   tbsize = _go32_info_block.size_of_transfer_buffer;
    ngot = 0;
    do {
!     j = (count <= tbsize) ? count : tbsize;
      r.x.ax = 0x3f00;
      r.x.bx = handle;
      r.x.cx = j;
--- 28,36 ----
        return rv;
    }
  
    ngot = 0;
    do {
!     j = (count <= __tb_size) ? count : __tb_size;
      r.x.ax = 0x3f00;
      r.x.bx = handle;
      r.x.cx = j;
Index: src/libc/dos/io/_write.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_write.c,v
retrieving revision 1.10
diff -p -c -3 -r1.10 _write.c
*** src/libc/dos/io/_write.c	8 Mar 2003 00:30:49 -0000	1.10
--- src/libc/dos/io/_write.c	3 May 2003 13:18:42 -0000
*************** int
*** 45,51 ****
  _write_fill_seek_gap(int fd)
  {
    offset_t eof_off, cur_off, fill_count;
!   unsigned long tbsize, buf_size;
    unsigned long i;
    short fd_info;
    
--- 45,51 ----
  _write_fill_seek_gap(int fd)
  {
    offset_t eof_off, cur_off, fill_count;
!   unsigned long buf_size;
    unsigned long i;
    short fd_info;
    
*************** _write_fill_seek_gap(int fd)
*** 87,96 ****
    __clear_fd_flags(fd, FILE_DESC_ZERO_FILL_EOF_GAP);
    
    /* Fill the transfer buffer with zeros.  */
-   tbsize = _go32_info_block.size_of_transfer_buffer;
    fill_count = cur_off - eof_off;
  
!   buf_size = (fill_count > tbsize) ? tbsize : fill_count;
  
    i = 0;
    _farsetsel(_dos_ds);
--- 87,95 ----
    __clear_fd_flags(fd, FILE_DESC_ZERO_FILL_EOF_GAP);
    
    /* Fill the transfer buffer with zeros.  */
    fill_count = cur_off - eof_off;
  
!   buf_size = (fill_count > __tb_size) ? __tb_size : fill_count;
  
    i = 0;
    _farsetsel(_dos_ds);
*************** _write_fill_seek_gap(int fd)
*** 115,128 ****
  int
  _write_int(int fd, const char *buffer, unsigned long long write_count)
  {
!   unsigned long buf_size, tb_size;
    unsigned long chunk_count;
    int total_written;
    unsigned short bytes_written;
    __dpmi_regs r;
  
!   tb_size = _go32_info_block.size_of_transfer_buffer;
!   buf_size = (write_count <= tb_size) ? write_count : tb_size;
    
    total_written = 0;
    do
--- 114,126 ----
  int
  _write_int(int fd, const char *buffer, unsigned long long write_count)
  {
!   unsigned long buf_size;
    unsigned long chunk_count;
    int total_written;
    unsigned short bytes_written;
    __dpmi_regs r;
  
!   buf_size = (write_count <= __tb_size) ? write_count : __tb_size;
    
    total_written = 0;
    do
Index: src/libc/dos/io/putpath.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/putpath.c,v
retrieving revision 1.9
diff -p -c -3 -r1.9 putpath.c
*** src/libc/dos/io/putpath.c	18 Dec 2002 06:52:55 -0000	1.9
--- src/libc/dos/io/putpath.c	3 May 2003 13:18:47 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
*************** int
*** 35,41 ****
  _put_path2(const char *path, int offset)
  {
    size_t o = __tb+offset;
!   int space = _go32_info_block.size_of_transfer_buffer - offset;
    const char *p = path;
  
    if (path == 0)
--- 36,42 ----
  _put_path2(const char *path, int offset)
  {
    size_t o = __tb+offset;
!   int space = __tb_size - offset;
    const char *p = path;
  
    if (path == 0)
Index: src/libc/dos/process/dosexec.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/process/dosexec.c,v
retrieving revision 1.20
diff -p -c -3 -r1.20 dosexec.c
*** src/libc/dos/process/dosexec.c	10 Jan 2003 10:09:02 -0000	1.20
--- src/libc/dos/process/dosexec.c	3 May 2003 13:18:52 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
*************** _dos_exec(const char *program, const cha
*** 558,564 ****
  	  const char *cmdline_var)
  {
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = _go32_info_block.size_of_transfer_buffer;
    tbuf_end = tbuf_beg + tbuf_len - 1;
    return direct_exec_tail(program, args, envp, 0, 2, cmdline_var);
  }
--- 559,565 ----
  	  const char *cmdline_var)
  {
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = __tb_size;
    tbuf_end = tbuf_beg + tbuf_len - 1;
    return direct_exec_tail(program, args, envp, 0, 2, cmdline_var);
  }
*************** static int direct_exec(const char *progr
*** 759,765 ****
      errno = E2BIG;
    
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = _go32_info_block.size_of_transfer_buffer;
    tbuf_end = tbuf_beg + tbuf_len - 1;
    return direct_exec_tail(program, args, envp, 0, 2, 0);
  }
--- 760,766 ----
      errno = E2BIG;
    
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = __tb_size;
    tbuf_end = tbuf_beg + tbuf_len - 1;
    return direct_exec_tail(program, args, envp, 0, 2, 0);
  }
*************** static int direct_pe_exec(const char *pr
*** 875,881 ****
      errno = E2BIG;
    
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = _go32_info_block.size_of_transfer_buffer;
    tbuf_end = tbuf_beg + tbuf_len - 1;
  
    /* If the command line is too long to pass directly, put the entire
--- 876,882 ----
      errno = E2BIG;
    
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = __tb_size;
    tbuf_end = tbuf_beg + tbuf_len - 1;
  
    /* If the command line is too long to pass directly, put the entire
*************** static int go32_exec(const char *program
*** 1001,1007 ****
       this point: they will overwrite the data already in __tb.  */
  
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = _go32_info_block.size_of_transfer_buffer;
    tbuf_end = tbuf_ptr + tbuf_len - 1;
  
    /* Starting from DJGPP v2.04, programs are always run through !proxy.
--- 1002,1008 ----
       this point: they will overwrite the data already in __tb.  */
  
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = __tb_size;
    tbuf_end = tbuf_ptr + tbuf_len - 1;
  
    /* Starting from DJGPP v2.04, programs are always run through !proxy.
*************** __dosexec_command_exec(const char *progr
*** 1218,1224 ****
    }
  
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = _go32_info_block.size_of_transfer_buffer;
    tbuf_end = tbuf_ptr + tbuf_len - 1;
    return direct_exec_tail(comspec, cmdline, envp, 0, 2, cmdline_var);
  }
--- 1219,1225 ----
    }
  
    tbuf_beg = tbuf_ptr = __tb;
!   tbuf_len = __tb_size;
    tbuf_end = tbuf_ptr + tbuf_len - 1;
    return direct_exec_tail(comspec, cmdline, envp, 0, 2, cmdline_var);
  }
Index: src/libc/bios/biosdisk.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/bios/biosdisk.c,v
retrieving revision 1.3
diff -p -c -3 -r1.3 biosdisk.c
*** src/libc/bios/biosdisk.c	17 Oct 2002 23:00:24 -0000	1.3
--- src/libc/bios/biosdisk.c	3 May 2003 13:18:58 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  /*
*************** biosdisk(int cmd, int drive, int head, i
*** 84,90 ****
    {
      if (xfer > 18*512)
        return 1;			/* bad command */
!     if (xfer > _go32_info_block.size_of_transfer_buffer)
      {
        alloc_dos_buffer();
        if (dos_segment == 0)
--- 85,91 ----
    {
      if (xfer > 18*512)
        return 1;			/* bad command */
!     if (xfer > __tb_size)
      {
        alloc_dos_buffer();
        if (dos_segment == 0)
*************** _bios_disk(unsigned _cmd, struct diskinf
*** 145,151 ****
    {
      if (xfer > 18*512)
        return 1;			/* bad command */
!     if (xfer > _go32_info_block.size_of_transfer_buffer)
      {
        alloc_dos_buffer();
        if (dos_segment == 0)
--- 146,152 ----
    {
      if (xfer > 18*512)
        return 1;			/* bad command */
!     if (xfer > __tb_size)
      {
        alloc_dos_buffer();
        if (dos_segment == 0)
Index: src/libc/posix/sys/stat/fstat.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/fstat.c,v
retrieving revision 1.12
diff -p -c -3 -r1.12 fstat.c
*** src/libc/posix/sys/stat/fstat.c	23 Apr 2003 19:13:26 -0000	1.12
--- src/libc/posix/sys/stat/fstat.c	3 May 2003 13:19:02 -0000
*************** fstat_assist(int fhandle, struct stat *s
*** 454,460 ****
      {
        /* Fall back on transfer buffer size, if we can't determine file name
         * (which gives the drive letter and then the drive's cluster size). */
!       stat_buf->st_blksize = _go32_info_block.size_of_transfer_buffer;
      }
  #endif
  
--- 464,470 ----
      {
        /* Fall back on transfer buffer size, if we can't determine file name
         * (which gives the drive letter and then the drive's cluster size). */
!       stat_buf->st_blksize = __tb_size;
      }
  #endif
  
Index: src/libc/posix/unistd/getcwd.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/getcwd.c,v
retrieving revision 1.6
diff -p -c -3 -r1.6 getcwd.c
*** src/libc/posix/unistd/getcwd.c	17 Oct 2001 05:08:39 -0000	1.6
--- src/libc/posix/unistd/getcwd.c	3 May 2003 13:19:07 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
*************** __getcwd(char *buf, size_t size)
*** 42,49 ****
    }
  
    /* make sure we don't overrun the TB */
!   if (size > _go32_info_block.size_of_transfer_buffer)
!     size = _go32_info_block.size_of_transfer_buffer;
  
    /* get the path into the transfer buffer at least */
    if(use_lfn)
--- 43,50 ----
    }
  
    /* make sure we don't overrun the TB */
!   if (size > __tb_size)
!     size = __tb_size;
  
    /* get the path into the transfer buffer at least */
    if(use_lfn)
Index: src/libc/posix/unistd/sysconf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/sysconf.c,v
retrieving revision 1.3
diff -p -c -3 -r1.3 sysconf.c
*** src/libc/posix/unistd/sysconf.c	18 Jun 2001 16:42:13 -0000	1.3
--- src/libc/posix/unistd/sysconf.c	3 May 2003 13:19:07 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
*************** sysconf(int name)
*** 12,18 ****
  {
    switch (name)
    {
!   case _SC_ARG_MAX:	return _go32_info_block.size_of_transfer_buffer;
    case _SC_CHILD_MAX:	return CHILD_MAX;
    case _SC_CLK_TCK:	return CLOCKS_PER_SEC;
    case _SC_NGROUPS_MAX:	return NGROUPS_MAX;
--- 13,19 ----
  {
    switch (name)
    {
!   case _SC_ARG_MAX:	return __tb_size;
    case _SC_CHILD_MAX:	return CHILD_MAX;
    case _SC_CLK_TCK:	return CLOCKS_PER_SEC;
    case _SC_NGROUPS_MAX:	return NGROUPS_MAX;
Index: src/libc/posix/unistd/write.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/write.c,v
retrieving revision 1.11
diff -p -c -3 -r1.11 write.c
*** src/libc/posix/unistd/write.c	26 Mar 2003 19:43:39 -0000	1.11
--- src/libc/posix/unistd/write.c	3 May 2003 13:19:14 -0000
***************
*** 19,26 ****
  #include <libc/ttyprvt.h>
  #include <libc/fd_props.h>
  
- #define tblen _go32_info_block.size_of_transfer_buffer
- 
  ssize_t
  write(int handle, const void* buffer, size_t count)
  {
--- 19,24 ----
*************** write(int handle, const void* buffer, si
*** 76,86 ****
    while (offset_into_buf < count)
    {
      _farsetsel(_dos_ds);
!     while (bytes_in_tb < tblen && offset_into_buf < count)
      {
        if (buf[offset_into_buf] == '\n')
        {
! 	if (bytes_in_tb == tblen - 1)
  	  break; /* can't fit two more */
  	_farnspokeb(__tb + bytes_in_tb, '\r');
  	bytes_in_tb++;
--- 74,84 ----
    while (offset_into_buf < count)
    {
      _farsetsel(_dos_ds);
!     while (bytes_in_tb < __tb_size && offset_into_buf < count)
      {
        if (buf[offset_into_buf] == '\n')
        {
! 	if (bytes_in_tb == __tb_size - 1)
  	  break; /* can't fit two more */
  	_farnspokeb(__tb + bytes_in_tb, '\r');
  	bytes_in_tb++;
Index: src/libc/go32/infostrc.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/go32/infostrc.txh,v
retrieving revision 1.5
diff -p -c -3 -r1.5 infostrc.txh
*** src/libc/go32/infostrc.txh	7 Feb 2003 18:13:54 -0000	1.5
--- src/libc/go32/infostrc.txh	3 May 2003 13:19:15 -0000
*************** This expands to _go32_info_block.selecto
*** 54,59 ****
--- 54,63 ----
  
  This expands to _go32_info_block.linear_address_of_transfer_buffer
  
+ @item __tb_size
+ 
+ This expands to _go32_info_block.size_of_transfer_buffer
+ 
  @end table
  
  The @code{run_mode} field indicates the mode that the program is running
Index: src/stub/stubify.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/stub/stubify.c,v
retrieving revision 1.9
diff -p -c -3 -r1.9 stubify.c
*** src/stub/stubify.c	8 Feb 2003 11:37:42 -0000	1.9
--- src/stub/stubify.c	3 May 2003 13:19:21 -0000
***************
*** 16,25 ****
  #include <errno.h>
  #endif
  
- #ifdef __DJGPP__
- #define tbsize _go32_info_block.size_of_transfer_buffer
- #endif
- 
  #ifndef O_BINARY
  #define O_BINARY 0
  #endif
--- 16,21 ----
*************** void coff2exe(char *fname)
*** 209,215 ****
       */
      r.x.ax = 0x3f00; /* dos read from file handle function */
      r.x.bx = ifile;
!     r.x.cx = tbsize; /* number of bytes to read */
      r.x.dx = __tb & 15; /* transfer buffer offset */
      r.x.ds = __tb / 16; /* transfer buffer segment */
      __dpmi_int(0x21, &r);
--- 205,211 ----
       */
      r.x.ax = 0x3f00; /* dos read from file handle function */
      r.x.bx = ifile;
!     r.x.cx = __tb_size; /* number of bytes to read */
      r.x.dx = __tb & 15; /* transfer buffer offset */
      r.x.ds = __tb / 16; /* transfer buffer segment */
      __dpmi_int(0x21, &r);
Index: src/docs/kb/wc204.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v
retrieving revision 1.154
diff -p -c -3 -r1.154 wc204.txi
*** src/docs/kb/wc204.txi	23 Apr 2003 19:20:39 -0000	1.154
--- src/docs/kb/wc204.txi	3 May 2003 13:19:26 -0000
*************** New enhanced dynamic module support has 
*** 968,970 ****
--- 974,981 ----
  interface.  You can now create complex DXEs which depend on each other
  and call code from the main image.  Converting libraries to standalone
  DXEs which can be linked via library is as simple as a single command.
+ 
+ @vindex __tb_size AT r{ added}
+ The macro @code{__tb_size} was added, to represent the size
+ of the transfer buffer.  This complements the macro @code{__tb},
+ which gives the linear address of the transfer buffer.

- Raw text -


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