VirtualBox

Changeset 2302 in kBuild for trunk


Ignore:
Timestamp:
Mar 1, 2009 5:42:54 AM (16 years ago)
Author:
bird
Message:

kash: Merged the SH_STUB_MODE and SH_FORKED_MODE stuff and use the latter name/define.

Location:
trunk/src/kash
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/Makefile.kmk

    r2299 r2302  
    3434kash_ASTOOL = YASM
    3535kash_DEFS = lint SHELL SMALL
    36 kash_DEFS += SH_STUB_MODE # for the time being.
     36kash_DEFS += SH_FORKED_MODE
    3737kash_DEFS.debug = DEBUG=2
    3838kash_DEFS.linux = BSD
  • trunk/src/kash/shfile.c

    r2301 r2302  
    5454 */
    5555#if K_OS == K_OS_WINDOWS \
    56  || (   !defined(SH_STUB_MODE) \
    57      && !defined(SH_FORKED_MODE))
     56 || !defined(SH_FORKED_MODE)
    5857# define SHFILE_IN_USE
    5958#endif
     
    600599# endif /* K_OS != K_OS_WINDOWS */
    601600
    602 #elif defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     601#elif defined(SH_FORKED_MODE)
    603602    fd = open(name, flags, mode);
    604603#endif
     
    681680    }
    682681
    683 #elif defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
    684 # ifdef _MSC_VER
    685     rc = _pipe(fds, PIPE_BUF, O_BINARY);
    686 # else
     682#elif defined(SH_FORKED_MODE)
    687683    rc = pipe(fds);
    688 # endif
    689684#endif
    690685
     
    696691{
    697692    int rc;
    698 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     693#if defined(SH_FORKED_MODE)
    699694    rc = dup(fd);
    700695
     
    729724        rc = -1;
    730725
    731 #elif defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     726#elif defined(SH_FORKED_MODE)
    732727    rc = close(fd);
    733728#endif
     
    763758        rc = -1;
    764759
    765 #elif defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
    766 # ifdef _MSC_VER
    767     rc = read(fd, buf, (unsigned)len);
    768 # else
     760#elif defined(SH_FORKED_MODE)
    769761    rc = read(fd, buf, len);
    770 # endif
    771762#endif
    772763    return rc;
     
    799790        rc = -1;
    800791
    801 #elif defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
    802 # ifdef _MSC_VER
    803     rc = write(fd, buf, (unsigned)len);
    804 # else
     792#elif defined(SH_FORKED_MODE)
    805793    rc = write(fd, buf, len);
    806 # endif
    807794#endif
    808795    return rc;
     
    836823        rc = -1;
    837824
    838 #elif defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     825#elif defined(SH_FORKED_MODE)
    839826    rc = lseek(fd, off, whench);
    840827#endif
     
    919906        rc = -1;
    920907
    921 #elif defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
    922 # ifdef _MSC_VER
    923     switch (cmd)
    924     {
    925         /* Just enough F_GETFL/F_SETFL to get along with. */
    926         case F_GETFL:
    927             errno = 0;
    928             rc = _isatty(fd);
    929             if (errno == EBADF)
    930                 rc = -1;
    931             break;
    932 
    933         case F_SETFL:
    934             errno = 0;
    935             rc = _isatty(fd);
    936             if (errno != EBADF)
    937             {
    938                 if (!arg)
    939                     rc = 0;
    940                 else
    941                 {
    942                     errno = EINVAL;
    943                     rc = -1;
    944                 }
    945             }
    946             else
    947                 rc = -1;
    948             break;
    949 
    950         case F_DUPFD:
    951         {
    952             /* the brute force approach. */
    953             int i = 0;
    954             int fds[256];
    955             for (i = 0; i < 256; i++)
    956             {
    957                 fds[i] = -1;
    958                 rc = _dup(fd);
    959                 if (rc >= arg)
    960                     break;
    961                 fds[i] = rc;
    962             }
    963             while (i-- > 0)
    964                 close(fds[i]);
    965             if (rc < arg)
    966             {
    967                 errno = EMFILE;
    968                 rc = -1;
    969             }
    970             break;
    971         }
    972     }
    973 # else
     908#elif defined(SH_FORKED_MODE)
    974909    rc = fcntl(fd, cmd, arg);
    975 # endif
    976910#endif
    977911
     
    988922int shfile_stat(shfdtab *pfdtab, const char *path, struct stat *pst)
    989923{
    990 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     924#if defined(SH_FORKED_MODE)
    991925    return stat(path, pst);
    992926
     
    997931int shfile_lstat(shfdtab *pfdtab, const char *link, struct stat *pst)
    998932{
    999 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     933#if defined(SH_FORKED_MODE)
    1000934# ifdef _MSC_VER
    1001935    return stat(link, pst);
     
    1010944int shfile_chdir(shfdtab *pfdtab, const char *path)
    1011945{
    1012 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     946#if defined(SH_FORKED_MODE)
    1013947# ifdef _MSC_VER //???
    1014948    return chdir(path);
     
    1023957char *shfile_getcwd(shfdtab *pfdtab, char *buf, int len)
    1024958{
    1025 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     959#if defined(SH_FORKED_MODE)
    1026960    return getcwd(buf, len);
    1027961
     
    1032966int shfile_access(shfdtab *pfdtab, const char *path, int type)
    1033967{
    1034 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     968#if defined(SH_FORKED_MODE)
    1035969# ifdef _MSC_VER
    1036970    type &= ~X_OK;
     
    1048982    int rc;
    1049983
    1050 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     984#if defined(SH_FORKED_MODE)
    1051985    rc = isatty(fd);
    1052986#else
     
    1062996    int rc;
    1063997
    1064 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     998#if defined(SH_FORKED_MODE)
    1065999# ifdef _MSC_VER
    10661000    errno = ENOSYS;
     
    10831017    int rc;
    10841018
    1085 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1019#if defined(SH_FORKED_MODE)
    10861020# ifdef _MSC_VER
    10871021    errno = ENOSYS;
     
    11011035mode_t shfile_get_umask(shfdtab *pfdtab)
    11021036{
    1103 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1037#if defined(SH_FORKED_MODE)
    11041038    return 022;
    11051039
     
    11161050shdir *shfile_opendir(shfdtab *pfdtab, const char *dir)
    11171051{
    1118 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1052#if defined(SH_FORKED_MODE)
    11191053# ifdef _MSC_VER
    11201054    errno = ENOSYS;
     
    11301064shdirent *shfile_readdir(struct shdir *pdir)
    11311065{
    1132 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1066#if defined(SH_FORKED_MODE)
    11331067# ifdef _MSC_VER
    11341068    errno = ENOSYS;
     
    11451079void shfile_closedir(struct shdir *pdir)
    11461080{
    1147 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1081#if defined(SH_FORKED_MODE)
    11481082# ifdef _MSC_VER
    11491083    errno = ENOSYS;
  • trunk/src/kash/shinstance.c

    r2301 r2302  
    697697    }
    698698
    699 #if (defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)) && !defined(_MSC_VER)
     699#if defined(SH_FORKED_MODE) && !defined(_MSC_VER)
    700700    rc = sigprocmask(operation, newp, oldp);
    701701    if (!rc && newp)
     
    726726        }
    727727
    728 # if defined(SH_STUB_MODE) || defined(_MSC_VER)
     728# if defined(_MSC_VER)
    729729        rc = 0;
    730730# else
     
    798798     * Some other process, call kill where possible
    799799     */
    800 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     800#if defined(SH_FORKED_MODE)
    801801# ifdef _MSC_VER
    802802    errno = ENOSYS;
     
    818818    int rc;
    819819
    820 #if defined(SH_STUB_MODE)
     820#if defined(SH_FORKED_MODE)
    821821# ifdef _MSC_VER
    822822    errno = ENOSYS;
     
    837837clock_t sh_times(shinstance *psh, shtms *tmsp)
    838838{
    839 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     839#if defined(SH_FORKED_MODE)
    840840    (void)psh;
    841841# ifdef _MSC_VER
     
    902902    pid = shfork_do_it(psh);
    903903
    904 #elif defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     904#elif defined(SH_FORKED_MODE)
    905905# ifdef _MSC_VER
    906906    pid = -1;
     
    10231023    }
    10241024
    1025 #elif defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1025#elif defined(SH_FORKED_MODE)
    10261026    *statusp = 0;
    10271027# ifdef _MSC_VER
     
    10461046    (void)psh;
    10471047
    1048 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1048#if defined(SH_FORKED_MODE)
    10491049    _exit(rc);
    10501050
     
    10711071        envp = sh_environ(psh);
    10721072
    1073 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1073#if defined(SH_FORKED_MODE)
    10741074    errno = 0;
    10751075# ifdef _MSC_VER
     
    10791079    {
    10801080        TRACE2((psh, "sh_execve: child exited, rc=%d. (errno=%d)\n", rc, errno));
    1081         exit(rc);
     1081        exit((int)rc);
    10821082    }
    10831083# else
     
    10951095uid_t sh_getuid(shinstance *psh)
    10961096{
    1097 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1097#if defined(SH_FORKED_MODE)
    10981098# ifdef _MSC_VER
    10991099    uid_t uid = 0;
     
    11121112uid_t sh_geteuid(shinstance *psh)
    11131113{
    1114 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1114#if defined(SH_FORKED_MODE)
    11151115# ifdef _MSC_VER
    11161116    uid_t euid = 0;
     
    11291129gid_t sh_getgid(shinstance *psh)
    11301130{
    1131 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1131#if defined(SH_FORKED_MODE)
    11321132# ifdef _MSC_VER
    11331133    gid_t gid = 0;
     
    11461146gid_t sh_getegid(shinstance *psh)
    11471147{
    1148 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1148#if defined(SH_FORKED_MODE)
    11491149# ifdef _MSC_VER
    11501150    gid_t egid = 0;
     
    11651165    pid_t pid;
    11661166
    1167 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1167#if defined(SH_FORKED_MODE)
    11681168# ifdef _MSC_VER
    11691169    pid = _getpid();
     
    11801180pid_t sh_getpgrp(shinstance *psh)
    11811181{
    1182 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1182#if defined(SH_FORKED_MODE)
    11831183# ifdef _MSC_VER
    11841184    pid_t pgrp = _getpid();
     
    11971197pid_t sh_getpgid(shinstance *psh, pid_t pid)
    11981198{
    1199 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1199#if defined(SH_FORKED_MODE)
    12001200# ifdef _MSC_VER
    12011201    pid_t pgid = pid;
     
    12141214int sh_setpgid(shinstance *psh, pid_t pid, pid_t pgid)
    12151215{
    1216 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1216#if defined(SH_FORKED_MODE)
    12171217# ifdef _MSC_VER
    12181218    int rc = -1;
     
    12341234    pid_t pgrp;
    12351235
    1236 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1236#if defined(SH_FORKED_MODE)
    12371237# ifdef _MSC_VER
    12381238    pgrp = -1;
     
    12551255    TRACE2((psh, "sh_tcsetpgrp(%d, %d)\n", fd, pgrp));
    12561256
    1257 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1257#if defined(SH_FORKED_MODE)
    12581258# ifdef _MSC_VER
    12591259    rc = -1;
     
    12731273int sh_getrlimit(shinstance *psh, int resid, shrlimit *limp)
    12741274{
    1275 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1275#if defined(SH_FORKED_MODE)
    12761276# ifdef _MSC_VER
    12771277    int rc = -1;
     
    12931293int sh_setrlimit(shinstance *psh, int resid, const shrlimit *limp)
    12941294{
    1295 #if defined(SH_STUB_MODE) || defined(SH_FORKED_MODE)
     1295#if defined(SH_FORKED_MODE)
    12961296# ifdef _MSC_VER
    12971297    int rc = -1;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette