]> sourceware.org Git - glibc.git/blame - posix/unistd.h
Recognize hppa-next as a valid CPU-COMPANY combination.
[glibc.git] / posix / unistd.h
CommitLineData
52e9a9d1 1/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
28f540f4
RM
2This file is part of the GNU C Library.
3
4The GNU C Library is free software; you can redistribute it and/or
5modify it under the terms of the GNU Library General Public License as
6published by the Free Software Foundation; either version 2 of the
7License, or (at your option) any later version.
8
9The GNU C Library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12Library General Public License for more details.
13
14You should have received a copy of the GNU Library General Public
15License along with the GNU C Library; see the file COPYING.LIB. If
16not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17Cambridge, MA 02139, USA. */
18
19/*
20 * POSIX Standard: 2.10 Symbolic Constants <unistd.h>
21 */
22
23#ifndef _UNISTD_H
24
25#define _UNISTD_H 1
26#include <features.h>
27
28__BEGIN_DECLS
29
30/* These may be used to determine what facilities are present at compile time.
31 Their values can be obtained at run time from sysconf. */
32
75cd5204
RM
33/* POSIX Standard approved as IEEE Std 1003.1 as of August, 1988 and
34 extended by P1003.1b (aka POSIX.4). */
35#define _POSIX_VERSION 199309L
28f540f4
RM
36
37/* These are not #ifdef __USE_POSIX2 because they are
38 in the theoretically application-owned namespace. */
39
40#define _POSIX2_C_VERSION 199912L /* Invalid until 1003.2 is done. */
41
42/* If defined, the implementation supports the
43 C Language Bindings Option. */
44#define _POSIX2_C_BIND 1
45
46/* If defined, the implementation supports the
47 C Language Development Utilities Option. */
48#define _POSIX2_C_DEV 1
49
50/* If defined, the implementation supports the
51 Software Development Utilities Option. */
52#define _POSIX2_SW_DEV 1
53
19bc17a9
RM
54/* If defined, the implementation supports the
55 creation of locales with the localedef utility. */
56#define _POSIX2_LOCALEDEF 1
57
845dcb57
UD
58/* Library is conformant to X/Open version 4. */
59#define _XOPEN_VERSION 4
60
28f540f4
RM
61
62/* Get values of POSIX options:
63
64 If these symbols are defined, the corresponding features are
65 always available. If not, they may be available sometimes.
66 The current values can be obtained with `sysconf'.
67
7b3547eb
RM
68 _POSIX_JOB_CONTROL Job control is supported.
69 _POSIX_SAVED_IDS Processes have a saved set-user-ID
70 and a saved set-group-ID.
71 _POSIX_REALTIME_SIGNALS Real-time, queued signals are supported.
72 _POSIX_PRIORITY_SCHEDULING Priority scheduling is supported.
73 _POSIX_TIMERS POSIX.4 clocks and timers are supported.
74 _POSIX_ASYNCHRONOUS_IO Asynchronous I/O is supported.
75 _POSIX_PRIORITIZED_IO Prioritized asynchronous I/O is supported.
76 _POSIX_SYNCHRONIZED_IO Synchronizing file data is supported.
77 _POSIX_FSYNC The fsync function is present.
78 _POSIX_MAPPED_FILES Mapping of files to memory is supported.
79 _POSIX_MEMLOCK Locking of all memory is supported.
80 _POSIX_MEMLOCK_RANGE Locking of ranges of memory is supported.
81 _POSIX_MEMORY_PROTECTION Setting of memory protections is supported.
82 _POSIX_MESSAGE_PASSING POSIX.4 message queues are supported.
83 _POSIX_SEMAPHORES POSIX.4 counting semaphores are supported.
84 _POSIX_SHARED_MEMORY_OBJECTS POSIX.4 shared memory objects are supported.
503054c0
RM
85 _POSIX_PII Protocol-independent interfaces are supported.
86 _POSIX_PII_XTI XTI protocol-indep. interfaces are supported.
87 _POSIX_PII_SOCKET Socket protocol-indep. interfaces are supported.
88 _POSIX_PII_INTERNET Internet family of protocols supported.
89 _POSIX_PII_INTERNET_STREAM Connection-mode Internet protocol supported.
90 _POSIX_PII_INTERNET_DGRAM Connectionless Internet protocol supported.
91 _POSIX_PII_OSI ISO/OSI family of protocols supported.
92 _POSIX_PII_OSI_COTS Connection-mode ISO/OSI service supported.
93 _POSIX_PII_OSI_CLTS Connectionless ISO/OSI service supported.
94 _POSIX_POLL Implementation supports `poll' function.
95 _POSIX_SELECT Implementation supports `select' and `pselect'.
28f540f4
RM
96
97 If any of these symbols is defined as -1, the corresponding option is not
98 true for any file. If any is defined as other than -1, the corresponding
99 option is true for all files. If a symbol is not defined at all, the value
100 for a specific file can be obtained from `pathconf' and `fpathconf'.
101
102 _POSIX_CHOWN_RESTRICTED Only the super user can use `chown' to change
103 the owner of a file. `chown' can only be used
104 to change the group ID of a file to a group of
105 which the calling process is a member.
106 _POSIX_NO_TRUNC Pathname components longer than
107 NAME_MAX generate an error.
108 _POSIX_VDISABLE If defined, if the value of an element of the
109 `c_cc' member of `struct termios' is
110 _POSIX_VDISABLE, no character will have the
111 effect associated with that element.
75cd5204
RM
112 _POSIX_SYNC_IO Synchronous I/O may be performed.
113 _POSIX_ASYNC_IO Asynchronous I/O may be performed.
114 _POSIX_PRIO_IO Prioritized Asynchronous I/O may be performed.
28f540f4
RM
115 */
116
117#include <posix_opt.h>
118
119
120/* Standard file descriptors. */
121#define STDIN_FILENO 0 /* Standard input. */
122#define STDOUT_FILENO 1 /* Standard output. */
123#define STDERR_FILENO 2 /* Standard error output. */
124
125
126/* All functions that are not declared anywhere else. */
127
128#include <gnu/types.h>
129
130#ifndef ssize_t
a68b0d31
UD
131typedef __ssize_t ssize_t;
132#define ssize_t ssize_t
28f540f4
RM
133#endif
134
135#define __need_size_t
136#define __need_NULL
137#include <stddef.h>
138
139
140/* Values for the second argument to access.
141 These may be OR'd together. */
142#define R_OK 4 /* Test for read permission. */
143#define W_OK 2 /* Test for write permission. */
144#define X_OK 1 /* Test for execute permission. */
145#define F_OK 0 /* Test for existence. */
146
22a1292a 147/* Test for access to NAME using the real UID and real GID. */
28f540f4
RM
148extern int __access __P ((__const char *__name, int __type));
149extern int access __P ((__const char *__name, int __type));
150
22a1292a
RM
151#ifdef __USE_GNU
152/* Test for access to NAME using the effective UID and GID
153 (as normal file operations use). */
154extern int euidaccess __P ((__const char *__name, int __type));
155#endif
156
28f540f4
RM
157
158/* Values for the WHENCE argument to lseek. */
159#ifndef _STDIO_H /* <stdio.h> has the same definitions. */
160#define SEEK_SET 0 /* Seek from beginning of file. */
161#define SEEK_CUR 1 /* Seek from current position. */
162#define SEEK_END 2 /* Seek from end of file. */
163#endif
164
1474b80f
RM
165#if defined (__USE_BSD) && !defined (L_SET)
166/* Old BSD names for the same constants; just for compatibility. */
167#define L_SET SEEK_SET
168#define L_INCR SEEK_CUR
169#define L_XTND SEEK_END
170#endif
171
172
28f540f4
RM
173/* Move FD's file position to OFFSET bytes from the
174 beginning of the file (if WHENCE is SEEK_SET),
175 the current position (if WHENCE is SEEK_CUR),
176 or the end of the file (if WHENCE is SEEK_END).
177 Return the new file position. */
178extern __off_t __lseek __P ((int __fd, __off_t __offset, int __whence));
179extern __off_t lseek __P ((int __fd, __off_t __offset, int __whence));
180
181/* Close the file descriptor FD. */
182extern int __close __P ((int __fd));
183extern int close __P ((int __fd));
184
185/* Read NBYTES into BUF from FD. Return the
186 number read, -1 for errors or 0 for EOF. */
187extern ssize_t __read __P ((int __fd, __ptr_t __buf, size_t __nbytes));
188extern ssize_t read __P ((int __fd, __ptr_t __buf, size_t __nbytes));
189
190/* Write N bytes of BUF to FD. Return the number written, or -1. */
191extern ssize_t __write __P ((int __fd, __const __ptr_t __buf, size_t __n));
192extern ssize_t write __P ((int __fd, __const __ptr_t __buf, size_t __n));
193
194
195/* Create a one-way communication channel (pipe).
196 If successul, two file descriptors are stored in PIPEDES;
197 bytes written on PIPEDES[1] can be read from PIPEDES[0].
198 Returns 0 if successful, -1 if not. */
199extern int __pipe __P ((int __pipedes[2]));
200extern int pipe __P ((int __pipedes[2]));
201
202/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM.
203 If SECONDS is zero, any currently scheduled alarm will be cancelled.
204 The function returns the number of seconds remaining until the last
205 alarm scheduled would have signaled, or zero if there wasn't one.
206 There is no return value to indicate an error, but you can set `errno'
207 to 0 and check its value after calling `alarm', and this might tell you.
208 The signal may come late due to processor scheduling. */
209extern unsigned int alarm __P ((unsigned int __seconds));
210
211/* Make the process sleep for SECONDS seconds, or until a signal arrives
212 and is not ignored. The function returns the number of seconds less
213 than SECONDS which it actually slept (thus zero if it slept the full time).
214 If a signal handler does a `longjmp' or modifies the handling of the
215 SIGALRM signal while inside `sleep' call, the handling of the SIGALRM
216 signal afterwards is undefined. There is no return value to indicate
217 error, but if `sleep' returns SECONDS, it probably didn't work. */
218extern unsigned int sleep __P ((unsigned int __seconds));
219
52e9a9d1
RM
220#ifdef __USE_BSD
221/* Sleep USECONDS microseconds, or until a signal arrives that is not blocked
222 or ignored. Return value is not necessarily useful. */
036cc82f 223extern unsigned int usleep __P ((unsigned int __useconds));
52e9a9d1
RM
224#endif
225
28f540f4
RM
226
227/* Suspend the process until a signal arrives.
228 This always returns -1 and sets `errno' to EINTR. */
229extern int pause __P ((void));
230
231
232/* Change the owner and group of FILE. */
233extern int __chown __P ((__const char *__file,
234 __uid_t __owner, __gid_t __group));
235extern int chown __P ((__const char *__file,
236 __uid_t __owner, __gid_t __group));
237
238#ifdef __USE_BSD
239/* Change the owner and group of the file that FD is open on. */
240extern int __fchown __P ((int __fd,
241 __uid_t __owner, __gid_t __group));
242extern int fchown __P ((int __fd,
243 __uid_t __owner, __gid_t __group));
244#endif /* Use BSD. */
245
246/* Change the process's working directory to PATH. */
247extern int __chdir __P ((__const char *__path));
248extern int chdir __P ((__const char *__path));
249
250#ifdef __USE_BSD
251/* Change the process's working directory to the one FD is open on. */
252extern int fchdir __P ((int __fd));
253#endif
254
255/* Get the pathname of the current working directory,
256 and put it in SIZE bytes of BUF. Returns NULL if the
257 directory couldn't be determined or SIZE was too small.
258 If successful, returns BUF. In GNU, if BUF is NULL,
259 an array is allocated with `malloc'; the array is SIZE
260 bytes long, unless SIZE <= 0, in which case it is as
261 big as necessary. */
3ec41e03 262extern char *__getcwd __P ((char *__buf, size_t __size));
28f540f4
RM
263extern char *getcwd __P ((char *__buf, size_t __size));
264
265#ifdef __USE_GNU
266/* Return a malloc'd string containing the current directory name.
267 If the environment variable `PWD' is set, and its value is correct,
268 that value is used. */
269extern char *get_current_dir_name __P ((void));
fa0bc87c
RM
270
271/* Get the canonical absolute name of the named directory, and put it in SIZE
272 bytes of BUF. Returns NULL if the directory couldn't be determined or
273 SIZE was too small. If successful, returns BUF. In GNU, if BUF is
274 NULL, an array is allocated with `malloc'; the array is SIZE bytes long,
275 unless SIZE <= 0, in which case it is as big as necessary. */
276
036cc82f 277char *__canonicalize_directory_name_internal __P ((__const char *__thisdir,
fa0bc87c
RM
278 char *__buf,
279 size_t __size));
28f540f4
RM
280#endif
281
282#ifdef __USE_BSD
283/* Put the absolute pathname of the current working directory in BUF.
284 If successful, return BUF. If not, put an error message in
285 BUF and return NULL. BUF should be at least PATH_MAX bytes long. */
286extern char *getwd __P ((char *__buf));
287#endif
288
289
290/* Duplicate FD, returning a new file descriptor on the same file. */
291extern int __dup __P ((int __fd));
292extern int dup __P ((int __fd));
293
294/* Duplicate FD to FD2, closing FD2 and making it open on the same file. */
295extern int __dup2 __P ((int __fd, int __fd2));
296extern int dup2 __P ((int __fd, int __fd2));
297
298/* NULL-terminated array of "NAME=VALUE" environment variables. */
299extern char **__environ;
300extern char **environ;
301
302
303/* Replace the current process, executing PATH with arguments ARGV and
304 environment ENVP. ARGV and ENVP are terminated by NULL pointers. */
305extern int __execve __P ((__const char *__path, char *__const __argv[],
306 char *__const __envp[]));
307extern int execve __P ((__const char *__path, char *__const __argv[],
308 char *__const __envp[]));
309
310#ifdef __USE_GNU
311/* Execute the file FD refers to, overlaying the running program image.
312 ARGV and ENVP are passed to the new program, as for `execve'. */
313extern int fexecve __P ((int __fd,
036cc82f 314 char *__const __argv[], char *__const __envp[]));
28f540f4
RM
315
316#endif
317
318
319/* Execute PATH with arguments ARGV and environment from `environ'. */
320extern int execv __P ((__const char *__path, char *__const __argv[]));
321
322/* Execute PATH with all arguments after PATH until a NULL pointer,
323 and the argument after that for environment. */
036cc82f 324extern int execle __P ((__const char *__path, __const char *__arg, ...));
28f540f4
RM
325
326/* Execute PATH with all arguments after PATH until
327 a NULL pointer and environment from `environ'. */
036cc82f 328extern int execl __P ((__const char *__path, __const char *__arg, ...));
28f540f4
RM
329
330/* Execute FILE, searching in the `PATH' environment variable if it contains
331 no slashes, with arguments ARGV and environment from `environ'. */
332extern int execvp __P ((__const char *__file, char *__const __argv[]));
333
334/* Execute FILE, searching in the `PATH' environment variable if
335 it contains no slashes, with all arguments after FILE until a
336 NULL pointer and environment from `environ'. */
11336c16 337extern int execlp __P ((__const char *__file, __const char *__arg, ...));
28f540f4
RM
338
339
a3e59be8
UD
340#ifdef __USE_MISC
341/* Add INC to priority of the current process. */
342extern int nice __P ((int __inc));
343#endif
344
345
28f540f4
RM
346/* Terminate program execution with the low-order 8 bits of STATUS. */
347extern void _exit __P ((int __status)) __attribute__ ((__noreturn__));
348
349
350/* Get the `_PC_*' symbols for the NAME argument to `pathconf' and `fpathconf';
351 the `_SC_*' symbols for the NAME argument to `sysconf';
352 and the `_CS_*' symbols for the NAME argument to `confstr'. */
353#include <confname.h>
354
355/* Get file-specific configuration information about PATH. */
356extern long int __pathconf __P ((__const char *__path, int __name));
357extern long int pathconf __P ((__const char *__path, int __name));
358
359/* Get file-specific configuration about descriptor FD. */
360extern long int __fpathconf __P ((int __fd, int __name));
361extern long int fpathconf __P ((int __fd, int __name));
362
363/* Get the value of the system variable NAME. */
364extern long int __sysconf __P ((int __name));
365extern long int sysconf __P ((int __name));
366
367#ifdef __USE_POSIX2
368/* Get the value of the string-valued system variable NAME. */
369extern size_t confstr __P ((int __name, char *__buf, size_t __len));
370#endif
371
372
373/* Get the process ID of the calling process. */
374extern __pid_t __getpid __P ((void));
375extern __pid_t getpid __P ((void));
376
377/* Get the process ID of the calling process's parent. */
378extern __pid_t __getppid __P ((void));
379extern __pid_t getppid __P ((void));
380
381/* Get the process group ID of the calling process. */
382extern __pid_t getpgrp __P ((void));
383
384/* Set the process group ID of the process matching PID to PGID.
385 If PID is zero, the current process's process group ID is set.
386 If PGID is zero, the process ID of the process is used. */
387extern int setpgid __P ((__pid_t __pid, __pid_t __pgid));
388
389/* Get the process group ID of process PID. */
390extern __pid_t __getpgid __P ((__pid_t __pid));
391#ifdef __USE_GNU
392extern __pid_t getpgid __P ((__pid_t __pid));
393#endif
394
b20e47cb
RM
395#if defined (__USE_SVID) || defined (__USE_BSD)
396/* Both System V and BSD have `setpgrp' functions, but with different
397 calling conventions. The BSD function is the same as POSIX.1 `setpgid'
398 (above). The System V function takes no arguments and puts the calling
399 process in its on group like `setpgid (0, 0)'.
400
401 New programs should always use `setpgid' instead.
402
403 The default in GNU is to provide the System V function. The BSD
404 function is available under -D_BSD_SOURCE with -lbsd-compat. */
405
406#ifndef __FAVOR_BSD
407
408/* Set the process group ID of the calling process to its own PID.
409 This is exactly the same as `setpgid (0, 0)'. */
410extern int setpgrp __P ((void));
411
412#else
413
414/* Another name for `setpgid' (above). */
28f540f4 415extern int setpgrp __P ((__pid_t __pid, __pid_t __pgrp));
b20e47cb
RM
416
417#endif /* Favor BSD. */
418#endif /* Use SVID or BSD. */
28f540f4
RM
419
420/* Create a new session with the calling process as its leader.
421 The process group IDs of the session and the calling process
422 are set to the process ID of the calling process, which is returned. */
423extern __pid_t __setsid __P ((void));
424extern __pid_t setsid __P ((void));
425
b7843ea9
RM
426#ifdef __USE_GNU
427/* Return the session ID of the given process. */
036cc82f 428extern __pid_t getsid __P ((__pid_t __pid));
b7843ea9
RM
429#endif
430
28f540f4
RM
431/* Get the real user ID of the calling process. */
432extern __uid_t __getuid __P ((void));
433extern __uid_t getuid __P ((void));
434
435/* Get the effective user ID of the calling process. */
436extern __uid_t __geteuid __P ((void));
437extern __uid_t geteuid __P ((void));
438
439/* Get the real group ID of the calling process. */
440extern __gid_t __getgid __P ((void));
441extern __gid_t getgid __P ((void));
442
443/* Get the effective group ID of the calling process. */
444extern __gid_t __getegid __P ((void));
445extern __gid_t getegid __P ((void));
446
447/* If SIZE is zero, return the number of supplementary groups
448 the calling process is in. Otherwise, fill in the group IDs
449 of its supplementary groups in LIST and return the number written. */
450extern int __getgroups __P ((int __size, __gid_t __list[]));
451extern int getgroups __P ((int __size, __gid_t __list[]));
452
3bbceb12
RM
453#ifdef __USE_GNU
454/* Return nonzero iff the calling process is in group GID. */
455extern int __group_member __P ((__gid_t __gid));
456extern int group_member __P ((__gid_t __gid));
457#endif
458
28f540f4
RM
459/* Set the user ID of the calling process to UID.
460 If the calling process is the super-user, set the real
461 and effective user IDs, and the saved set-user-ID to UID;
462 if not, the effective user ID is set to UID. */
463extern int __setuid __P ((__uid_t __uid));
464extern int setuid __P ((__uid_t __uid));
465
466#ifdef __USE_BSD
467/* Set the real user ID of the calling process to RUID,
468 and the effective user ID of the calling process to EUID. */
469extern int __setreuid __P ((__uid_t __ruid, __uid_t __euid));
470extern int setreuid __P ((__uid_t __ruid, __uid_t __euid));
471
472/* Set the effective user ID of the calling process to UID. */
473extern int seteuid __P ((__uid_t __uid));
474#endif /* Use BSD. */
475
476/* Set the group ID of the calling process to GID.
477 If the calling process is the super-user, set the real
478 and effective group IDs, and the saved set-group-ID to GID;
479 if not, the effective group ID is set to GID. */
480extern int __setgid __P ((__gid_t __gid));
481extern int setgid __P ((__gid_t __gid));
482
483#ifdef __USE_BSD
484/* Set the real group ID of the calling process to RGID,
485 and the effective group ID of the calling process to EGID. */
486extern int __setregid __P ((__gid_t __rgid, __gid_t __egid));
487extern int setregid __P ((__gid_t __rgid, __gid_t __egid));
488
489/* Set the effective group ID of the calling process to GID. */
490extern int setegid __P ((__gid_t __gid));
491#endif /* Use BSD. */
492
493
494/* Clone the calling process, creating an exact copy.
495 Return -1 for errors, 0 to the new process,
496 and the process ID of the new process to the old process. */
497extern __pid_t __fork __P ((void));
498extern __pid_t fork __P ((void));
499
500#ifdef __USE_BSD
501/* Clone the calling process, but without copying the whole address space.
502 The the calling process is suspended until the the new process exits or is
503 replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
504 and the process ID of the new process to the old process. */
505extern __pid_t __vfork __P ((void));
506extern __pid_t vfork __P ((void));
507#endif /* Use BSD. */
508
509
510/* Return the pathname of the terminal FD is open on, or NULL on errors.
511 The returned storage is good only until the next call to this function. */
512extern char *ttyname __P ((int __fd));
60478656
RM
513#ifdef __USE_REENTRANT
514/* Store at most BUFLEN characters of the pathname of the terminal FD is
515 open on in BUF. Return 0 on success, -1 otherwise. */
23396375 516extern int __ttyname_r __P ((int __fd, char *__buf, int __buflen));
60478656
RM
517extern int ttyname_r __P ((int __fd, char *__buf, int __buflen));
518#endif
28f540f4
RM
519
520/* Return 1 if FD is a valid descriptor associated
521 with a terminal, zero if not. */
522extern int __isatty __P ((int __fd));
523extern int isatty __P ((int __fd));
524
1474b80f
RM
525#ifdef __USE_BSD
526/* Return the index into the active-logins file (utmp) for
a9df8829
RM
527 the controlling terminal. */
528extern int ttyslot __P ((void));
1474b80f
RM
529#endif
530
28f540f4
RM
531
532/* Make a link to FROM named TO. */
533extern int __link __P ((__const char *__from, __const char *__to));
534extern int link __P ((__const char *__from, __const char *__to));
535
536#ifdef __USE_BSD
537/* Make a symbolic link to FROM named TO. */
538extern int __symlink __P ((__const char *__from, __const char *__to));
539extern int symlink __P ((__const char *__from, __const char *__to));
540
541/* Read the contents of the symbolic link PATH into no more than
542 LEN bytes of BUF. The contents are not null-terminated.
543 Returns the number of characters read, or -1 for errors. */
544extern int __readlink __P ((__const char *__path, char *__buf, size_t __len));
545extern int readlink __P ((__const char *__path, char *__buf, size_t __len));
546#endif /* Use BSD. */
547
548/* Remove the link NAME. */
549extern int __unlink __P ((__const char *__name));
550extern int unlink __P ((__const char *__name));
551
552/* Remove the directory PATH. */
553extern int __rmdir __P ((__const char *__path));
554extern int rmdir __P ((__const char *__path));
555
556
557/* Return the foreground process group ID of FD. */
558extern __pid_t tcgetpgrp __P ((int __fd));
559
560/* Set the foreground process group ID of FD set PGRP_ID. */
561extern int tcsetpgrp __P ((int __fd, __pid_t __pgrp_id));
562
563
564/* Return the login name of the user. */
565extern char *getlogin __P ((void));
ee188d55
RM
566#ifdef __USE_REENTRANT
567/* Return at most NAME_LEN characters of the login name of the user in NAME.
568 If it cannot be determined or some other error occured, return the error
569 code. Otherwise return 0. */
570extern int getlogin_r __P ((char *__name, size_t __name_len));
571#endif
28f540f4
RM
572
573#ifdef __USE_BSD
574/* Set the login name returned by `getlogin'. */
575extern int setlogin __P ((__const char *__name));
576#endif
577
578
579#ifdef __USE_POSIX2
580/* Process the arguments in ARGV (ARGC of them, minus
581 the program name) for options given in OPTS.
582
583 If `opterr' is zero, no messages are generated
584 for invalid options; it defaults to 1.
585 `optind' is the current index into ARGV.
586 `optarg' is the argument corresponding to the current option.
587 Return the option character from OPTS just read.
588 Return -1 when there are no more options.
589 For unrecognized options, or options missing arguments,
590 `optopt' is set to the option letter, and '?' is returned.
591
592 The OPTS string is a list of characters which are recognized option
593 letters, optionally followed by colons, specifying that that letter
594 takes an argument, to be placed in `optarg'.
595
596 If a letter in OPTS is followed by two colons, its argument is optional.
597 This behavior is specific to the GNU `getopt'.
598
599 The argument `--' causes premature termination of argument scanning,
600 explicitly telling `getopt' that there are no more options.
601
602 If OPTS begins with `--', then non-option arguments
603 are treated as arguments to the option '\0'.
604 This behavior is specific to the GNU `getopt'. */
605extern int getopt __P ((int __argc, char *__const * __argv,
606 __const char *__opts));
607extern int opterr;
608extern int optind;
609extern int optopt;
610extern char *optarg;
611#endif
612
613
614#ifdef __USE_BSD
615
616/* Put the name of the current host in no more than LEN bytes of NAME.
617 The result is null-terminated if LEN is large enough for the full
618 name and the terminator. */
619extern int __gethostname __P ((char *__name, size_t __len));
620extern int gethostname __P ((char *__name, size_t __len));
621
622/* Set the name of the current host to NAME, which is LEN bytes long.
623 This call is restricted to the super-user. */
624extern int sethostname __P ((__const char *__name, size_t __len));
625
626/* Return the current machine's Internet number. */
627extern long int gethostid __P ((void));
628
629/* Set the current machine's Internet number to ID.
630 This call is restricted to the super-user. */
631extern int sethostid __P ((long int __id));
632
633
f5348425
RM
634/* Get and set the NIS (aka YP) domain name, if any.
635 Called just like `gethostname' and `sethostname'.
636 The NIS domain name is usually the empty string when not using NIS. */
637extern int getdomainname __P ((char *__name, size_t __len));
638extern int setdomainname __P ((__const char *__name, size_t __len));
639
640
28f540f4
RM
641/* Return the number of bytes in a page. This is the system's page size,
642 which is not necessarily the same as the hardware page size. */
643extern size_t __getpagesize __P ((void));
644extern size_t getpagesize __P ((void));
645
646
647/* Return the maximum number of file descriptors
648 the current process could possibly have. */
649extern int __getdtablesize __P ((void));
650extern int getdtablesize __P ((void));
651
652
653/* Truncate FILE to LENGTH bytes. */
654extern int truncate __P ((__const char *__file, __off_t __length));
655
656/* Truncate the file FD is open on to LENGTH bytes. */
657extern int ftruncate __P ((int __fd, __off_t __length));
658
659
660/* Make all changes done to FD actually appear on disk. */
661extern int fsync __P ((int __fd));
662
663/* Make all changes done to all files actually appear on disk. */
664extern int sync __P ((void));
665
666
667/* Revoke access permissions to all processes currently communicating
668 with the control terminal, and then send a SIGHUP signal to the process
669 group of the control terminal. */
670extern int vhangup __P ((void));
671
342414a6 672/* Revoke the access of all descriptors currently open on FILE. */
036cc82f 673extern int revoke __P ((__const char *__file));
342414a6 674
28f540f4 675
ea03559a
RM
676/* Enable statistical profiling, writing samples of the PC into at most
677 SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
678 is enabled, the system examines the user PC and increments
679 SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero,
680 disable profiling. Returns zero on success, -1 on error. */
681extern int profil __P ((unsigned short int *__sample_buffer, size_t __size,
682 size_t __offset, unsigned int __scale));
683
684
28f540f4
RM
685/* Turn accounting on if NAME is an existing file. The system will then write
686 a record for each process as it terminates, to this file. If NAME is NULL,
687 turn accounting off. This call is restricted to the super-user. */
688extern int acct __P ((__const char *__name));
689
690/* Make PATH be the root directory (the starting point for absolute paths).
691 This call is restricted to the super-user. */
692extern int chroot __P ((__const char *__path));
693
28f540f4
RM
694
695/* Successive calls return the shells listed in `/etc/shells'. */
696extern char *getusershell __P ((void));
697extern void endusershell __P ((void)); /* Discard cached info. */
698extern void setusershell __P ((void)); /* Rewind and re-read the file. */
699
700
701/* Prompt with PROMPT and read a string from the terminal without echoing.
702 Uses /dev/tty if possible; otherwise stderr and stdin. */
036cc82f 703extern char *getpass __P ((__const char *__prompt));
28f540f4
RM
704
705/* Put the program in the background, and dissociate from the controlling
706 terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero,
707 redirects stdin, stdout, and stderr to /dev/null. */
708extern int daemon __P ((int __nochdir, int __noclose));
709
710#endif /* Use BSD. */
711
712
713#ifdef __USE_MISC
714
715/* Generate a unique temporary file name from TEMPLATE.
716 The last six characters of TEMPLATE must be "XXXXXX";
717 they are replaced with a string that makes the file name unique.
718 Returns TEMPLATE, or a null pointer if it cannot get a unique file name. */
719extern char *mktemp __P ((char *__template));
720
721/* Generate a unique temporary file name from TEMPLATE.
722 The last six characters of TEMPLATE must be "XXXXXX";
723 they are replaced with a string that makes the filename unique.
724 Returns a file descriptor open on the file for reading and writing,
725 or -1 if it cannot create a uniquely-named file. */
726extern int mkstemp __P ((char *__template));
727
728
196980f5
RM
729/* Set the end of accessible data space (aka "the break") to ADDR.
730 Returns zero on success and -1 for errors (with errno set). */
731extern int __brk __P ((__ptr_t __addr));
732extern int brk __P ((__ptr_t __addr));
733
734#define __need_ptrdiff_t
735#include <stddef.h>
736
737/* Increase or decrease the end of accessible data space by DELTA bytes.
738 If successful, returns the address the previous end of data space
739 (i.e. the beginning of the new space, if DELTA > 0);
740 returns (void *) -1 for errors (with errno set). */
741extern __ptr_t __sbrk __P ((ptrdiff_t __delta));
742extern __ptr_t sbrk __P ((ptrdiff_t __delta));
743
744
28f540f4
RM
745/* Invoke `system call' number SYSNO, passing it the remaining arguments.
746 This is completely system-dependent, and not often useful.
747
748 In Unix, `syscall' sets `errno' for all errors and most calls return -1
749 for errors; in many systems you cannot pass arguments or get return
750 values for all system calls (`pipe', `fork', and `getppid' typically
751 among them).
752
753 In Mach, all system calls take normal arguments and always return an
754 error code (zero for success). */
7f811679 755extern long int syscall __P ((long int __sysno, ...));
28f540f4
RM
756
757#endif /* Use misc. */
758
759
760#if defined (__USE_MISC) && !defined (F_LOCK)
761/* NOTE: These declarations also appear in <fcntl.h>; be sure to keep both
762 files consistent. Some systems have them there and some here, and some
763 software depends on the macros being defined without including both. */
764
765/* `lockf' is a simpler interface to the locking facilities of `fcntl'.
766 LEN is always relative to the current file position.
767 The CMD argument is one of the following. */
768
769#define F_ULOCK 0 /* Unlock a previously locked region. */
b7843ea9 770#define F_LOCK 1 /* Lock a region for exclusive use. */
28f540f4
RM
771#define F_TLOCK 2 /* Test and lock a region for exclusive use. */
772#define F_TEST 3 /* Test a region for other processes locks. */
773
774extern int lockf __P ((int __fd, int __cmd, __off_t __len));
775#endif /* Use misc and F_LOCK not already defined. */
776
777
778#ifdef __USE_GNU
779
780/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno'
781 set to EINTR. */
782
783#define TEMP_FAILURE_RETRY(expression) \
036cc82f
RM
784 (__extension__ \
785 ({ long int __result; \
28f540f4
RM
786 do __result = (long int) (expression); \
787 while (__result == -1L && errno == EINTR); \
036cc82f 788 __result; })) \
b7843ea9 789
cddcfecf
RM
790
791/* This variable is set nonzero at startup if the process's effective IDs
792 differ from its real IDs, or it is otherwise indicated that extra
793 security should be used. When this is set the dynamic linker ignores
794 the various environment variables that normally affect it. */
795
796extern int __libc_enable_secure;
797
28f540f4
RM
798#endif
799
7b3547eb
RM
800#ifdef __USE_POSIX
801/* Synchronize at least the data part of a file with the underlying
802 media. */
803extern int fdatasync __P ((int __fildes));
804#endif /* Use POSIX */
805
28f540f4
RM
806__END_DECLS
807
808#endif /* unistd.h */
This page took 0.132724 seconds and 5 git commands to generate.