summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorTim Bunce <Tim.Bunce@ig.co.uk>1997-06-11 12:00:00 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-06-11 12:00:00 +1200
commit3e3baf6d63945cb64e829d6e5c70a7d00f3d3d03 (patch)
tree0143be655536dc428f4fa3cc7d01f6bcffe14c01 /doio.c
parent08aa1457cd52a368c210ab76a3da91cfadabea1a (diff)
parent3458556dd685b1767b760a72bd2e9007b5c4575e (diff)
downloadperl-3e3baf6d63945cb64e829d6e5c70a7d00f3d3d03.tar.gz
[differences between cumulative patch application and perl5.004_01]perl-5.004_01
[editor's note: The changes between this and 5.004 were processed from the m1t2 release, which was a bad idea as it was the _01 release which had the final corrected attributions. The differences between the various m*t* releases do that; I considered it most valuable just to look at the _NN releases. Many patches have been separated out and/or applied from the p5p archives nonetheless.]
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/doio.c b/doio.c
index 0d57425269..62b7de9fb5 100644
--- a/doio.c
+++ b/doio.c
@@ -34,7 +34,7 @@
#endif
#ifdef I_UTIME
-# ifdef WIN32
+# ifdef _MSC_VER
# include <sys/utime.h>
# else
# include <utime.h>
@@ -481,7 +481,10 @@ register GV *gv;
#ifdef HAS_FCHMOD
(void)fchmod(lastfd,filemode);
#else
+# if !(defined(WIN32) && defined(__BORLANDC__))
+ /* Borland runtime creates a readonly file! */
(void)chmod(oldname,filemode);
+# endif
#endif
if (fileuid != statbuf.st_uid || filegid != statbuf.st_gid) {
#ifdef HAS_FCHOWN
@@ -722,7 +725,6 @@ I32 my_chsize(fd, length)
I32 fd; /* file descriptor */
Off_t length; /* length to set file to */
{
- extern long lseek();
struct flock fl;
struct stat filebuf;
@@ -1331,6 +1333,9 @@ SV **sp;
char *a;
I32 id, n, cmd, infosize, getinfo;
I32 ret = -1;
+#ifdef __linux__ /* XXX Need metaconfig test */
+ union semun unsemds;
+#endif
id = SvIVx(*++mark);
n = (optype == OP_SEMCTL) ? SvIVx(*++mark) : 0;
@@ -1359,11 +1364,29 @@ SV **sp;
infosize = sizeof(struct semid_ds);
else if (cmd == GETALL || cmd == SETALL)
{
+#ifdef __linux__ /* XXX Need metaconfig test */
+/* linux uses :
+ int semctl (int semid, int semnun, int cmd, union semun arg)
+
+ union semun {
+ int val;
+ struct semid_ds *buf;
+ ushort *array;
+ };
+*/
+ union semun semds;
+ if (semctl(id, 0, IPC_STAT, semds) == -1)
+#else
struct semid_ds semds;
if (semctl(id, 0, IPC_STAT, &semds) == -1)
+#endif
return -1;
getinfo = (cmd == GETALL);
+#ifdef __linux__ /* XXX Need metaconfig test */
+ infosize = semds.buf->sem_nsems * sizeof(short);
+#else
infosize = semds.sem_nsems * sizeof(short);
+#endif
/* "short" is technically wrong but much more portable
than guessing about u_?short(_t)? */
}
@@ -1406,7 +1429,12 @@ SV **sp;
#endif
#ifdef HAS_SEM
case OP_SEMCTL:
+#ifdef __linux__ /* XXX Need metaconfig test */
+ unsemds.buf = (struct semid_ds *)a;
+ ret = semctl(id, n, cmd, unsemds);
+#else
ret = semctl(id, n, cmd, (struct semid_ds *)a);
+#endif
break;
#endif
#ifdef HAS_SHM