aboutsummaryrefslogtreecommitdiff
path: root/man/man3/opentemp.3
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-03 06:40:20 +0000
committerrsc <devnull@localhost>2005-01-03 06:40:20 +0000
commit058b0118a52061ad57694c01fc8763b22b789c4d (patch)
tree6685f04dea5ed68edaa34998c976aed34c55fe94 /man/man3/opentemp.3
parent2600337aa704efbeba8201e88147a764b4fd2b90 (diff)
downloadplan9port-058b0118a52061ad57694c01fc8763b22b789c4d.tar.gz
plan9port-058b0118a52061ad57694c01fc8763b22b789c4d.tar.bz2
plan9port-058b0118a52061ad57694c01fc8763b22b789c4d.zip
Some man pages.
Diffstat (limited to 'man/man3/opentemp.3')
-rw-r--r--man/man3/opentemp.348
1 files changed, 48 insertions, 0 deletions
diff --git a/man/man3/opentemp.3 b/man/man3/opentemp.3
new file mode 100644
index 00000000..23e77d3d
--- /dev/null
+++ b/man/man3/opentemp.3
@@ -0,0 +1,48 @@
+.TH OPENTEMP 3
+.SH NAME
+opentemp \- create a uniquely-named file
+.SH SYNOPSIS
+.B #include <u.h>
+.br
+.B #include <libc.h>
+.PP
+.B
+int opentemp(char *template)
+.SH DESCRIPTION
+.I Opentemp
+replaces
+.I template
+by a unique file name, and returns the
+address of the template.
+The template should look like a file name with eleven trailing
+.LR X s.
+The
+.LR X s
+are replaced by a letter followed by the current process id.
+Letters from
+.L a
+to
+.L z
+are tried until the name of a file that does not yet exist
+(see
+.IR access (2))
+is generated.
+.I Opentemp
+then creates the file for reading and writing
+and returns the file descriptor.
+.PP
+If no such name can be generated,
+.I opentemp
+returns \-1.
+.PP
+.I Opentemp
+avoids races.
+Two simultaneous calls to
+.I opentemp
+will never return the same name.
+.SH SOURCE
+.B /usr/local/plan9/src/lib9/opentemp.c
+.SH "SEE ALSO
+.I create
+in
+.IR open (3)