HP3000-L Archives

July 2002, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Mark Bixby <[log in to unmask]>
Reply To:
Mark Bixby <[log in to unmask]>
Date:
Mon, 8 Jul 2002 09:40:02 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (71 lines)
A rename operation can be used instead of O_EXCL|O_CREAT to serve an a file
semaphore, i.e.:

1) Create a permanent file with a process-unique name, i.e. foobar.[mypin] or
somesuch.

2) Attempt to rename the above file to "foobar".

3) If the rename fails, foobar must already exist, and so somebody else has
control of the semaphore.

4) If the rename succeeded, you now have control of the semaphore.

Of course, you must also add in code to handle the case of what happens when
the process holding the semaphore file aborts and leaves the file laying around.

- Mark B. (catching up on HP3000-L backlog)

Jeff Woods wrote:

> Mark Bixby wrote:
>
>>Are you linking with MPE libc or POSIX libc?
>>
>>I definitely know this works with POSIX libc because I have
>>seen it in various ports of mine.  I have never tried to do
>>it with MPE libc though.
>>
>
> I'm using LIBCSHR.LIB.SYS, LIBCANSI.LIB.SYS (plus a few others including
> SOCKETRL.NET.SYS) all on MPE 7.0(Exp1).  It's my understanding that the
> POSIX routines only support bytestream files and this program needs to
> access (and create) non-bytestream (actually Variable-ASCII "VA") files
> and work smoothly from the CI in a jobstream.
>
> P.S.  I've already recoded the I/O to use sprintf() for formatting and
> HPFOPEN(), FWRITE() and FCLOSE() intrinsics for accessing the file, so I
> don't actually need an answer for this situation anymore.  (But if
> something comes along that lets me convert the couple of dozen printf()
> calls from something like this:
>
>         sprintf(log_buff, "Send(%s) errno=%d", buff, errno);
>         mpe_FWRITE(log_fnum, log_buff, -strlen(log_buff), 0);
>
> .... back to something like this:
>
>         printf(log_file, "Send(%s) errno=%d\n", buff, errno);
>
> .... I'd be inclined to spend the time.)
>
> Thanks.
> --
> Jeff Woods
> [log in to unmask]
> [log in to unmask]
> Quintessential School Systems
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>
>
>


--
[log in to unmask]
Remainder of .sig suppressed to conserve expensive California electrons...

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2