03-12-2002
Sorry, it was with reference to the original post, where the semantics was
open! Did it work? No?
Then create ... and continue ...
That, of course, lead to a bug.
(1)
So, I tried to illustrate a point that was no directly related to just opening and creating files, but to calling functions that might return errors in general.
(2)
Sometimes, the course of action may be different when the file is already there.
(3)
Also, I have gotten the habit of doing it that way from some old, long forgotten systems.
Atle
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have 6 extra hard drives and want to install them in my boxes and run UNIX, LINUX andyes M$ Winblows. How do I make it so i have the choice of which HD to boot from? Also, which UNIX distribution should i run to get aquainted with it, and wheres the best place to get it? Thank you very much if... (5 Replies)
Discussion started by: r1sk
5 Replies
2. UNIX Desktop Questions & Answers
I am a long-time Windows NT, 2000 user at home and work. I want to learn Unix to broaden myself. What flavor do you recommend and how do you recommend practicing with it at home? how to get a copy of it to practice with? (1 Reply)
Discussion started by: robmaxfli
1 Replies
3. UNIX for Dummies Questions & Answers
Hello!
In my perpetual quest to learn Unix, I want to build a cheap Unix server for my personal use.
Do you guys have suggestions of web sites, vendors etc...where I could get info on things such as step-by-step instruction, 2nd hand hardware etc...
I would like to go preferably with a HP... (2 Replies)
Discussion started by: alan
2 Replies
4. UNIX for Dummies Questions & Answers
I learned Unix about 6 years ago, I think it was the System V version back then.
My course taught me, Unix commands, shell scripting, Vi editor, and probably more stuff.
I wanted to stick with Unix but life didn't allow me to, my college back then used Windows 95 and then my job as a... (8 Replies)
Discussion started by: thoughts
8 Replies
5. UNIX for Dummies Questions & Answers
I originally sent this as a PM to Neo, but I was ignorant towards the rule of PMing someone with technical information. Below is a copy / paste of the questions I asked. If anyone can help, I'd appreciate it tons. Thank you! :D
The first OS I ever encountered was DOS and Windows 3.1. Ever since... (1 Reply)
Discussion started by: ZeeSquared
1 Replies
6. UNIX for Dummies Questions & Answers
Firstly I do need to state that I am turning here as a last resort. Im in my first year of a Computer Networking and technical support course, and as a first year I must complete a Introductory Unix/Linux class. I have been doing well in the course so far however I have been stumped on the final... (1 Reply)
Discussion started by: setaylor5
1 Replies
7. Solaris
Hello,
I have recently completed my training for Solaris 10 and have a good understanding of the bases now. I am playing around with my system but can't do much since my knowledge is limited. I am looking for some projects or some threads where I can learn more and expand my knowledge step by... (16 Replies)
Discussion started by: saudsos
16 Replies
8. UNIX for Dummies Questions & Answers
I am a newbie Oracle DBA. All our oracle servers are hosted in AIX and Solaris Environment. I have no knowledge about this Unix O/S. So, it will be great if anyone here can suggest me any good book which will teach me the basics.
Any inputs/suggestions will be great for me. (1 Reply)
Discussion started by: sandip250382
1 Replies
9. Shell Programming and Scripting
I am working on UNIX AIX to Linux migration.
Does anybody know the good site for doing this?
Thanks for contribution (4 Replies)
Discussion started by: digioleg54
4 Replies
LEARN ABOUT MOJAVE
flopen
FLOPEN(3) BSD Library Functions Manual FLOPEN(3)
NAME
flopen -- reliably open and lock a file
LIBRARY
Utility functions from BSD systems (libbsd, -lbsd)
SYNOPSIS
#include <sys/fcntl.h>
#include <bsd/libutil.h>
int
flopen(const char *path, int flags);
int
flopen(const char *path, int flags, mode_t mode);
DESCRIPTION
The flopen() function opens or creates a file and acquires an exclusive lock on it. It is essentially equivalent with calling open() with
the same parameters followed by flock() with an operation argument of LOCK_EX, except that flopen() will attempt to detect and handle races
that may occur between opening / creating the file and locking it. Thus, it is well suited for opening lock files, PID files, spool files,
mailboxes and other kinds of files which are used for synchronization between processes.
If flags includes O_NONBLOCK and the file is already locked, flopen() will fail and set errno to EWOULDBLOCK.
As with open(), the additional mode argument is required if flags includes O_CREAT.
RETURN VALUES
If successful, flopen() returns a valid file descriptor. Otherwise, it returns -1, and sets errno as described in flock(2) and open(2).
SEE ALSO
errno(2), flock(2), open(2)
AUTHORS
The flopen function and this manual page were written by Dag-Erling Smorgrav <des@FreeBSD.org>.
BSD
June 6, 2009 BSD