brennan@DG-RTP.DG.COM (Dave Brennan) (12/01/89)
I recently got bash (1.04) to work on an AT&T 3B2 running SYSV R3.2.
So, I'm sending along what I had to do to get it to work. I'm not sending
all diff files, because the changes aren't too complex.
Hope this is useful.
1) In order to get globbing to work I had to get the directory access
routines working on the 3B (these aren't part of the AT&T release).
I used a set of routines from comp.sources.unix (volume 9) by Douglas A. Gwyn.
I needed to define DIRENT in the makefile.
2) The 3B2 doesn't have dup2(), so I changed config.h to define NO_DUP2
if ATT3B is defined.
3) In the beginning of glob.c there's an #ifdef USG (line 37) to take
care of a few includes, bcopy, and rindex. I changed this to
#if defined(USG) || defined(SYSV).
4) The help strings for set and test in builtins.c cause the compiler
to complain "string token too long." I just edited them a bit to make
them shorter. I'm not sure if there's a simple fix for this that would
allow usage of the full help text.
5) The 3B ulimit function takes and returns limits in blocks, not
kilobytes. I just changed ULIMIT_BLOCK_SIZE to 1. This causes ulimit
to take and return the limit in terms of block like the 3B sh or ksh.
I also have some suggestions for the ulimit function:
- Typing "ulimit" without any arguments does nothing. In ksh and sh,
"ulimit" is the same as "ulimit -f." To make this work, I just
changed the ulimit_builtin() main "while (list)" loop to a do/while.
This way, with no args the function prints the current limit.
- The ulimit builtin doesn't let root increase the ulimit, although
it should. I just changed the limit check if to read
"if ((current_limit < (real_limit)) && (getuid() != 0) )"
6) The wait union in jobs.h doesn't work because wait returns an int,
not a short and on a 3B the byte order is high, low not low, high.
Here's what I changed it to:
union wait {
struct {
unsigned char b1, b2;
unsigned char high;
unsigned char low;
} bytes;
int word;
}
6) Here's a diff from nojobs.c.
- The first (and 3rd) change was made because the 3B doesn't have
sigignore or sigrelse. I'm not sure if this is correct - it seems
to work ok.
- The second change was made because w_termsig is defined as
an expression, rather than a single element.
- Finally, the last change adds bodies for the pid functions.
*** nojobs.c.orig Sun Nov 26 21:21:23 1989
--- nojobs.c Sun Nov 26 01:20:56 1989
***************
*** 156,162 ****
--- 156,166 ----
#endif
#ifdef SYSV
+ #ifdef ATT3B
+ oldmask = signal( SIGINT, SIG_IGN );
+ #else
oldmask = sigignore (SIGINT);
+ #endif
#else
oldmask = sigblock (sigmask (SIGINT));
#endif
***************
*** 165,171 ****
{
if (got_pid < 0 && errno == ECHILD)
{
! status.w_termsig = status.w_retcode = 0;
break;
}
else if (got_pid < 0 && errno != EINTR)
--- 169,175 ----
{
if (got_pid < 0 && errno == ECHILD)
{
! status.bytes.low = status.w_retcode = 0;
break;
}
else if (got_pid < 0 && errno != EINTR)
***************
*** 174,180 ****
--- 178,188 ----
#ifdef SYSV
+ #ifdef ATT3B
+ signal( SIGINT, oldmask );
+ #else
sigrelse (oldmask);
+ #endif
#else
sigsetmask (oldmask);
#endif
***************
*** 246,252 ****
}
wait_for_background_pids ()
! {}
! wait_for_single_pid ()
! {}
--- 254,280 ----
}
wait_for_background_pids ()
! {
! int got_pid;
! union wait status;
!
! while( (got_pid = wait(&status)) > 0 ) {
! if ( got_pid < 0 && (errno == ECHILD || errno == EINTR))
! break;
! }
! QUIT;
! }
! wait_for_single_pid ( pid )
! int pid;
! {
! int got_pid;
! union wait status;
!
! while ((got_pid = wait(&status)) != pid )
! {
! if (got_pid < 0 && (errno == ECHILD || errno == EINTR))
! break;
! }
! QUIT;
! }
_________
Dave Brennan, User Interfaces, Data General Corp. / brennan@dg-rtp.dg.com
Research Triangle Park, North Carolina, 27709 / ...mcnc!rti!dg-rtp!brennan
Hm: (919) 460-5725 Wk: (919) 248-6330 _________/ dave_brennan@rpitsmts.bitnet