Guest User

Untitled

a guest
May 16th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.42 KB | None | 0 0
  1. Index: Build.sh
  2. ===================================================================
  3. RCS file: /cvs/src/bin/mksh/Build.sh,v
  4. retrieving revision 1.508
  5. diff -u -r1.508 Build.sh
  6. --- Build.sh    4 Jan 2012 08:56:51 -0000   1.508
  7. +++ Build.sh    6 Jan 2012 01:19:57 -0000
  8. @@ -1327,6 +1327,8 @@
  9.  # Environment: library functions
  10.  #
  11.  ac_testn flock_ex '' 'flock and mmap' <<-'EOF'
  12. +   #define MKSH_INCLUDES_ONLY
  13. +   #include "sh.h"
  14.     #include <sys/types.h>
  15.     #if HAVE_SYS_FILE_H
  16.     #include <sys/file.h>
  17. Index: histrap.c
  18. ===================================================================
  19. RCS file: /cvs/src/bin/mksh/histrap.c,v
  20. retrieving revision 1.117
  21. diff -u -r1.117 histrap.c
  22. --- histrap.c   31 Dec 2011 00:48:09 -0000  1.117
  23. +++ histrap.c   6 Jan 2012 01:52:44 -0000
  24. @@ -26,6 +26,20 @@
  25.  #include <sys/file.h>
  26.  #endif
  27.  
  28. +#if defined(__sun) || defined(__MSYS__)
  29. +int emul_flock(int fd, int cmd)
  30. +{    struct flock f;
  31. +    memset(&f, 0, sizeof (f));
  32. +    if (cmd & LOCK_UN)
  33. +        f.l_type = F_UNLCK;
  34. +    if (cmd & LOCK_SH)
  35. +        f.l_type = F_RDLCK;
  36. +    if (cmd & LOCK_EX)
  37. +        f.l_type = F_WRLCK;
  38. +    return fcntl(fd, (cmd & LOCK_NB) ? F_SETLK : F_SETLKW, &f);
  39. +}
  40. +#endif
  41. +
  42.  __RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.117 2011/12/31 00:47:45 tg Exp $");
  43.  
  44.  Trap sigtraps[NSIG + 1];
  45. Index: sh.h
  46. ===================================================================
  47. RCS file: /cvs/src/bin/mksh/sh.h,v
  48. retrieving revision 1.519
  49. diff -u -r1.519 sh.h
  50. --- sh.h    4 Jan 2012 19:10:00 -0000   1.519
  51. +++ sh.h    6 Jan 2012 01:52:33 -0000
  52. @@ -151,6 +151,33 @@
  53.  #define __SCCSID(x)        __IDSTRING(sccsid,x)
  54.  #endif
  55.  
  56. +#ifndef LOCK_SH
  57. +#define   LOCK_SH   1    /* shared lock */
  58. +#define   LOCK_EX   2    /* exclusive lock */
  59. +#define   LOCK_NB   4    /* don't block when locking */
  60. +#define   LOCK_UN   8    /* unlock */
  61. +#endif
  62. +#if defined(__sun) || defined(__MSYS__)
  63. +#include <sys/fcntl.h>
  64. +int emul_flock(int fd, int cmd);
  65. +
  66. +#ifdef MKSH_INCLUDES_ONLY
  67. +int emul_flock(int fd, int cmd)
  68. +{    struct flock f;
  69. +    memset(&f, 0, sizeof (f));
  70. +    if (cmd & LOCK_UN)
  71. +        f.l_type = F_UNLCK;
  72. +    if (cmd & LOCK_SH)
  73. +        f.l_type = F_RDLCK;
  74. +    if (cmd & LOCK_EX)
  75. +        f.l_type = F_WRLCK;
  76. +    return fcntl(fd, (cmd & LOCK_NB) ? F_SETLK : F_SETLKW, &f);
  77. +}
  78. +#endif
  79. +
  80. +#define flock(f,c)      emul_flock(f,c)
  81. +#endif
  82. +
  83.  #ifdef EXTERN
  84.  __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.519 2012/01/04 19:09:36 tg Exp $");
  85.  #endif
Add Comment
Please, Sign In to add comment