Changeset 5541

Show
Ignore:
Timestamp:
07/05/12 23:04:01 (7 years ago)
Author:
cmatthew
Message:

better handling of lower fd number.

Location:
seattle/branches/nacl_repy/seattlelib
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • seattle/branches/nacl_repy/seattlelib/fs_dup.repy

    r5336 r5541  
    4747 
    4848    # Make sure this is not one of the reserved handles we use for libraries 
    49     if handle <= 10: 
     49    if handle <= STARTINGFD: 
    5050        log("Warning: low file handles are not supported in Lind dup.") 
    5151 
  • seattle/branches/nacl_repy/seattlelib/fs_dup2.repy

    r5147 r5541  
    3232    handle2 = args[1] 
    3333 
    34     if handle <= 10 or handle2 <= 10: 
     34    if handle <= STARTINGFD or handle2 <= STARTINGFD: 
    3535        print "Warning: low file handles are not supported in Lind dup2(", \ 
    3636              handle, handle2, ")" 
  • seattle/branches/nacl_repy/seattlelib/lind_fs_calls.py

    r5533 r5541  
    934934 
    935935 
    936 STARTINGFD = 10 
    937 MAXFD = 1024 
    938  
    939936# get the next free file descriptor 
    940937def get_next_fd(): 
    941938  # let's get the next available fd number.   The standard says we need to  
    942939  # return the lowest open fd number. 
    943   for fd in range(STARTINGFD, MAXFD): 
     940  for fd in range(STARTINGFD, MAX_FD): 
    944941    if not fd in filedescriptortable: 
    945942      return fd 
     
    14441441  # NOTE: I want to support dup2 being used to replace STDERR, STDOUT, etc. 
    14451442  #      The Lind code may pass me descriptors less than STARTINGFD 
    1446   if newfd >= MAXFD or newfd < 0: 
     1443  if newfd >= MAX_FD or newfd < 0: 
    14471444    # BUG: the STARTINGFD isn't really too low.   It's just lower than we 
    14481445    # support 
     
    15031500 
    15041501  # check the fd 
    1505   if fd not in filedescriptortable and fd >= 10: 
     1502  if fd not in filedescriptortable and fd >= STARTINGFD: 
    15061503    raise SyscallError("dup_syscall","EBADF","Invalid old file descriptor.") 
    15071504 
  • seattle/branches/nacl_repy/seattlelib/lind_fs_constants.py

    r5532 r5541  
    101101#largest file descriptor 
    102102MAX_FD = 1024 
     103STARTINGFD = 10 
     104 
    103105 
    104106# for dirents... 
  • seattle/branches/nacl_repy/seattlelib/lind_parsers.repy

    r5523 r5541  
    6565    result = map(lambda x: {'fd': x[0], 
    6666                            'events': x[1], 
    67                             'revents': x[2]}, 
     67                            'revents': x[2]}xo, 
    6868                 result) 
    6969    return result