summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-09-30 15:11:07 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-09-30 15:11:07 +0000
commit8206a063cdc1c193b12df1a45cb3a0ee430b5077 (patch)
tree45fb29ee11703ddeadeb8fa6d9673bc12d51394b /doio.c
parent2ddcc7aa6c936ba8e7a9703319dfd8959bb54574 (diff)
parent3e3baf6d63945cb64e829d6e5c70a7d00f3d3d03 (diff)
downloadperl-8206a063cdc1c193b12df1a45cb3a0ee430b5077.tar.gz
Merge maint-5.004 branch (5.004_01) with mainline.
p4raw-id: //depot/perl@84
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 9ffe37007c..d905af1e40 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>
@@ -482,7 +482,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
@@ -724,7 +727,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;
@@ -1337,6 +1339,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;
@@ -1365,11 +1370,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)? */
}
@@ -1412,7 +1435,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