1 | Process Environment Manager |
---|
2 | ########################### |
---|
3 | |
---|
4 | Introduction |
---|
5 | ============ |
---|
6 | |
---|
7 | The process environment manager is responsible for providing the |
---|
8 | functions related to user and group Id management. |
---|
9 | |
---|
10 | The directives provided by the process environment manager are: |
---|
11 | |
---|
12 | - ``getpid`` - Get Process ID |
---|
13 | |
---|
14 | - ``getppid`` - Get Parent Process ID |
---|
15 | |
---|
16 | - ``getuid`` - Get User ID |
---|
17 | |
---|
18 | - ``geteuid`` - Get Effective User ID |
---|
19 | |
---|
20 | - ``getgid`` - Get Real Group ID |
---|
21 | |
---|
22 | - ``getegid`` - Get Effective Group ID |
---|
23 | |
---|
24 | - ``setuid`` - Set User ID |
---|
25 | |
---|
26 | - ``setgid`` - Set Group ID |
---|
27 | |
---|
28 | - ``getgroups`` - Get Supplementary Group IDs |
---|
29 | |
---|
30 | - ``getlogin`` - Get User Name |
---|
31 | |
---|
32 | - ``getlogin_r`` - Reentrant Get User Name |
---|
33 | |
---|
34 | - ``getpgrp`` - Get Process Group ID |
---|
35 | |
---|
36 | - ``setsid`` - Create Session and Set Process Group ID |
---|
37 | |
---|
38 | - ``setpgid`` - Set Process Group ID for Job Control |
---|
39 | |
---|
40 | - ``uname`` - Get System Name |
---|
41 | |
---|
42 | - ``times`` - Get Process Times |
---|
43 | |
---|
44 | - ``getenv`` - Get Environment Variables |
---|
45 | |
---|
46 | - ``setenv`` - Set Environment Variables |
---|
47 | |
---|
48 | - ``ctermid`` - Generate Terminal Pathname |
---|
49 | |
---|
50 | - ``ttyname`` - Determine Terminal Device Name |
---|
51 | |
---|
52 | - ``ttyname_r`` - Reentrant Determine Terminal Device Name |
---|
53 | |
---|
54 | - ``isatty`` - Determine if File Descriptor is Terminal |
---|
55 | |
---|
56 | - ``sysconf`` - Get Configurable System Variables |
---|
57 | |
---|
58 | Background |
---|
59 | ========== |
---|
60 | |
---|
61 | Users and Groups |
---|
62 | ---------------- |
---|
63 | |
---|
64 | RTEMS provides a single process, multi-threaded execution environment. |
---|
65 | In this light, the notion of user and group is somewhat without meaning. |
---|
66 | But RTEMS does provide services to provide a synthetic version of |
---|
67 | user and group. By default, a single user and group is associated |
---|
68 | with the application. Thus unless special actions are taken, |
---|
69 | every thread in the application shares the same user and group Id. |
---|
70 | The initial rationale for providing user and group Id functionality |
---|
71 | in RTEMS was for the filesystem infrastructure to implement |
---|
72 | file permission checks. The effective user/group Id capability |
---|
73 | has since been used to implement permissions checking by |
---|
74 | the ``ftpd`` server. |
---|
75 | |
---|
76 | In addition to the "real" user and group Ids, a process may |
---|
77 | have an effective user/group Id. This allows a process to |
---|
78 | function using a more limited permission set for certain operations. |
---|
79 | |
---|
80 | User and Group Names |
---|
81 | -------------------- |
---|
82 | |
---|
83 | POSIX considers user and group Ids to be a unique integer that |
---|
84 | may be associated with a name. This is usually accomplished |
---|
85 | via a file named ``/etc/passwd`` for user Id mapping and``/etc/groups`` for group Id mapping. Again, although |
---|
86 | RTEMS is effectively a single process and thus single user |
---|
87 | system, it provides limited support for user and group |
---|
88 | names. When configured with an appropriate filesystem, RTEMS |
---|
89 | will access the appropriate files to map user and group Ids |
---|
90 | to names. |
---|
91 | |
---|
92 | If these files do not exist, then RTEMS will synthesize |
---|
93 | a minimal version so this family of services return without |
---|
94 | error. It is important to remember that a design goal of |
---|
95 | the RTEMS POSIX services is to provide useable and |
---|
96 | meaningful results even though a full process model |
---|
97 | is not available. |
---|
98 | |
---|
99 | Environment Variables |
---|
100 | --------------------- |
---|
101 | |
---|
102 | POSIX allows for variables in the run-time environment. These are |
---|
103 | name/value pairs that make be dynamically set and obtained by |
---|
104 | programs. In a full POSIX environment with command line shell |
---|
105 | and multiple processes, environment variables may be set in |
---|
106 | one process - such as the shell - and inherited by child |
---|
107 | processes. In RTEMS, there is only one process and thus |
---|
108 | only one set of environment variables across all processes. |
---|
109 | |
---|
110 | Operations |
---|
111 | ========== |
---|
112 | |
---|
113 | Accessing User and Group Ids |
---|
114 | ---------------------------- |
---|
115 | |
---|
116 | The user Id associated with the current thread may be obtain |
---|
117 | using the ``getuid()`` service. Similarly, the group Id |
---|
118 | may be obtained using the ``getgid()`` service. |
---|
119 | |
---|
120 | Accessing Environment Variables |
---|
121 | ------------------------------- |
---|
122 | |
---|
123 | The value associated with an environment variable may be |
---|
124 | obtained using the ``getenv()`` service and set using |
---|
125 | the ``putenv()`` service. |
---|
126 | |
---|
127 | Directives |
---|
128 | ========== |
---|
129 | |
---|
130 | This section details the process environment manager's directives. |
---|
131 | A subsection is dedicated to each of this manager's directives |
---|
132 | and describes the calling sequence, related constants, usage, |
---|
133 | and status codes. |
---|
134 | |
---|
135 | getpid - Get Process ID |
---|
136 | ----------------------- |
---|
137 | .. index:: getpid |
---|
138 | .. index:: get process id |
---|
139 | |
---|
140 | **CALLING SEQUENCE:** |
---|
141 | |
---|
142 | .. code:: c |
---|
143 | |
---|
144 | int getpid( void ); |
---|
145 | |
---|
146 | **STATUS CODES:** |
---|
147 | |
---|
148 | The process Id is returned. |
---|
149 | |
---|
150 | **DESCRIPTION:** |
---|
151 | |
---|
152 | This service returns the process Id. |
---|
153 | |
---|
154 | **NOTES:** |
---|
155 | |
---|
156 | NONE |
---|
157 | |
---|
158 | getppid - Get Parent Process ID |
---|
159 | ------------------------------- |
---|
160 | .. index:: getppid |
---|
161 | .. index:: get parent process id |
---|
162 | |
---|
163 | **CALLING SEQUENCE:** |
---|
164 | |
---|
165 | .. code:: c |
---|
166 | |
---|
167 | int getppid( void ); |
---|
168 | |
---|
169 | **STATUS CODES:** |
---|
170 | |
---|
171 | The parent process Id is returned. |
---|
172 | |
---|
173 | **DESCRIPTION:** |
---|
174 | |
---|
175 | This service returns the parent process Id. |
---|
176 | |
---|
177 | **NOTES:** |
---|
178 | |
---|
179 | NONE |
---|
180 | |
---|
181 | getuid - Get User ID |
---|
182 | -------------------- |
---|
183 | .. index:: getuid |
---|
184 | .. index:: get user id |
---|
185 | |
---|
186 | **CALLING SEQUENCE:** |
---|
187 | |
---|
188 | .. code:: c |
---|
189 | |
---|
190 | int getuid( void ); |
---|
191 | |
---|
192 | **STATUS CODES:** |
---|
193 | |
---|
194 | The effective user Id is returned. |
---|
195 | |
---|
196 | **DESCRIPTION:** |
---|
197 | |
---|
198 | This service returns the effective user Id. |
---|
199 | |
---|
200 | **NOTES:** |
---|
201 | |
---|
202 | NONE |
---|
203 | |
---|
204 | geteuid - Get Effective User ID |
---|
205 | ------------------------------- |
---|
206 | .. index:: geteuid |
---|
207 | .. index:: get effective user id |
---|
208 | |
---|
209 | **CALLING SEQUENCE:** |
---|
210 | |
---|
211 | .. code:: c |
---|
212 | |
---|
213 | int geteuid( void ); |
---|
214 | |
---|
215 | **STATUS CODES:** |
---|
216 | |
---|
217 | The effective group Id is returned. |
---|
218 | |
---|
219 | **DESCRIPTION:** |
---|
220 | |
---|
221 | This service returns the effective group Id. |
---|
222 | |
---|
223 | **NOTES:** |
---|
224 | |
---|
225 | NONE |
---|
226 | |
---|
227 | getgid - Get Real Group ID |
---|
228 | -------------------------- |
---|
229 | .. index:: getgid |
---|
230 | .. index:: get real group id |
---|
231 | |
---|
232 | **CALLING SEQUENCE:** |
---|
233 | |
---|
234 | .. code:: c |
---|
235 | |
---|
236 | int getgid( void ); |
---|
237 | |
---|
238 | **STATUS CODES:** |
---|
239 | |
---|
240 | The group Id is returned. |
---|
241 | |
---|
242 | **DESCRIPTION:** |
---|
243 | |
---|
244 | This service returns the group Id. |
---|
245 | |
---|
246 | **NOTES:** |
---|
247 | |
---|
248 | NONE |
---|
249 | |
---|
250 | getegid - Get Effective Group ID |
---|
251 | -------------------------------- |
---|
252 | .. index:: getegid |
---|
253 | .. index:: get effective group id |
---|
254 | |
---|
255 | **CALLING SEQUENCE:** |
---|
256 | |
---|
257 | .. code:: c |
---|
258 | |
---|
259 | int getegid( void ); |
---|
260 | |
---|
261 | **STATUS CODES:** |
---|
262 | |
---|
263 | The effective group Id is returned. |
---|
264 | |
---|
265 | **DESCRIPTION:** |
---|
266 | |
---|
267 | This service returns the effective group Id. |
---|
268 | |
---|
269 | **NOTES:** |
---|
270 | |
---|
271 | NONE |
---|
272 | |
---|
273 | setuid - Set User ID |
---|
274 | -------------------- |
---|
275 | .. index:: setuid |
---|
276 | .. index:: set user id |
---|
277 | |
---|
278 | **CALLING SEQUENCE:** |
---|
279 | |
---|
280 | .. code:: c |
---|
281 | |
---|
282 | int setuid( |
---|
283 | uid_t uid |
---|
284 | ); |
---|
285 | |
---|
286 | **STATUS CODES:** |
---|
287 | |
---|
288 | This service returns 0. |
---|
289 | |
---|
290 | **DESCRIPTION:** |
---|
291 | |
---|
292 | This service sets the user Id to ``uid``. |
---|
293 | |
---|
294 | **NOTES:** |
---|
295 | |
---|
296 | NONE |
---|
297 | |
---|
298 | setgid - Set Group ID |
---|
299 | --------------------- |
---|
300 | .. index:: setgid |
---|
301 | .. index:: set group id |
---|
302 | |
---|
303 | **CALLING SEQUENCE:** |
---|
304 | |
---|
305 | .. code:: c |
---|
306 | |
---|
307 | int setgid( |
---|
308 | gid_t gid |
---|
309 | ); |
---|
310 | |
---|
311 | **STATUS CODES:** |
---|
312 | |
---|
313 | This service returns 0. |
---|
314 | |
---|
315 | **DESCRIPTION:** |
---|
316 | |
---|
317 | This service sets the group Id to ``gid``. |
---|
318 | |
---|
319 | **NOTES:** |
---|
320 | |
---|
321 | NONE |
---|
322 | |
---|
323 | getgroups - Get Supplementary Group IDs |
---|
324 | --------------------------------------- |
---|
325 | .. index:: getgroups |
---|
326 | .. index:: get supplementary group ids |
---|
327 | |
---|
328 | **CALLING SEQUENCE:** |
---|
329 | |
---|
330 | .. code:: c |
---|
331 | |
---|
332 | int getgroups( |
---|
333 | int gidsetsize, |
---|
334 | gid_t grouplist[] |
---|
335 | ); |
---|
336 | |
---|
337 | **STATUS CODES:** |
---|
338 | |
---|
339 | NA |
---|
340 | |
---|
341 | **DESCRIPTION:** |
---|
342 | |
---|
343 | This service is not implemented as RTEMS has no notion of |
---|
344 | supplemental groups. |
---|
345 | |
---|
346 | **NOTES:** |
---|
347 | |
---|
348 | If supported, this routine would only be allowed for |
---|
349 | the super-user. |
---|
350 | |
---|
351 | getlogin - Get User Name |
---|
352 | ------------------------ |
---|
353 | .. index:: getlogin |
---|
354 | .. index:: get user name |
---|
355 | |
---|
356 | **CALLING SEQUENCE:** |
---|
357 | |
---|
358 | .. code:: c |
---|
359 | |
---|
360 | char \*getlogin( void ); |
---|
361 | |
---|
362 | **STATUS CODES:** |
---|
363 | |
---|
364 | Returns a pointer to a string containing the name of the |
---|
365 | current user. |
---|
366 | |
---|
367 | **DESCRIPTION:** |
---|
368 | |
---|
369 | This routine returns the name of the current user. |
---|
370 | |
---|
371 | **NOTES:** |
---|
372 | |
---|
373 | This routine is not reentrant and subsequent calls to``getlogin()`` will overwrite the same buffer. |
---|
374 | |
---|
375 | getlogin_r - Reentrant Get User Name |
---|
376 | ------------------------------------ |
---|
377 | .. index:: getlogin_r |
---|
378 | .. index:: reentrant get user name |
---|
379 | .. index:: get user name, reentrant |
---|
380 | |
---|
381 | **CALLING SEQUENCE:** |
---|
382 | |
---|
383 | .. code:: c |
---|
384 | |
---|
385 | int getlogin_r( |
---|
386 | char \*name, |
---|
387 | size_t namesize |
---|
388 | ); |
---|
389 | |
---|
390 | **STATUS CODES:** |
---|
391 | |
---|
392 | *EINVAL* |
---|
393 | The arguments were invalid. |
---|
394 | |
---|
395 | **DESCRIPTION:** |
---|
396 | |
---|
397 | This is a reentrant version of the ``getlogin()`` service. The |
---|
398 | caller specified their own buffer, ``name``, as well as the |
---|
399 | length of this buffer, ``namesize``. |
---|
400 | |
---|
401 | **NOTES:** |
---|
402 | |
---|
403 | NONE |
---|
404 | |
---|
405 | getpgrp - Get Process Group ID |
---|
406 | ------------------------------ |
---|
407 | .. index:: getpgrp |
---|
408 | .. index:: get process group id |
---|
409 | |
---|
410 | **CALLING SEQUENCE:** |
---|
411 | |
---|
412 | .. code:: c |
---|
413 | |
---|
414 | pid_t getpgrp( void ); |
---|
415 | |
---|
416 | **STATUS CODES:** |
---|
417 | |
---|
418 | The procress group Id is returned. |
---|
419 | |
---|
420 | **DESCRIPTION:** |
---|
421 | |
---|
422 | This service returns the current progress group Id. |
---|
423 | |
---|
424 | **NOTES:** |
---|
425 | |
---|
426 | This routine is implemented in a somewhat meaningful |
---|
427 | way for RTEMS but is truly not functional. |
---|
428 | |
---|
429 | setsid - Create Session and Set Process Group ID |
---|
430 | ------------------------------------------------ |
---|
431 | .. index:: setsid |
---|
432 | .. index:: create session and set process group id |
---|
433 | |
---|
434 | **CALLING SEQUENCE:** |
---|
435 | |
---|
436 | .. code:: c |
---|
437 | |
---|
438 | pid_t setsid( void ); |
---|
439 | |
---|
440 | **STATUS CODES:** |
---|
441 | |
---|
442 | *EPERM* |
---|
443 | The application does not have permission to create a process group. |
---|
444 | |
---|
445 | **DESCRIPTION:** |
---|
446 | |
---|
447 | This routine always returns ``EPERM`` as RTEMS has no way |
---|
448 | to create new processes and thus no way to create a new process |
---|
449 | group. |
---|
450 | |
---|
451 | **NOTES:** |
---|
452 | |
---|
453 | NONE |
---|
454 | |
---|
455 | setpgid - Set Process Group ID for Job Control |
---|
456 | ---------------------------------------------- |
---|
457 | .. index:: setpgid |
---|
458 | .. index:: set process group id for job control |
---|
459 | |
---|
460 | **CALLING SEQUENCE:** |
---|
461 | |
---|
462 | .. code:: c |
---|
463 | |
---|
464 | int setpgid( |
---|
465 | pid_t pid, |
---|
466 | pid_t pgid |
---|
467 | ); |
---|
468 | |
---|
469 | **STATUS CODES:** |
---|
470 | |
---|
471 | *ENOSYS* |
---|
472 | The routine is not implemented. |
---|
473 | |
---|
474 | **DESCRIPTION:** |
---|
475 | |
---|
476 | This service is not implemented for RTEMS as process groups are not |
---|
477 | supported. |
---|
478 | |
---|
479 | **NOTES:** |
---|
480 | |
---|
481 | NONE |
---|
482 | |
---|
483 | uname - Get System Name |
---|
484 | ----------------------- |
---|
485 | .. index:: uname |
---|
486 | .. index:: get system name |
---|
487 | |
---|
488 | **CALLING SEQUENCE:** |
---|
489 | |
---|
490 | .. code:: c |
---|
491 | |
---|
492 | int uname( |
---|
493 | struct utsname \*name |
---|
494 | ); |
---|
495 | |
---|
496 | **STATUS CODES:** |
---|
497 | |
---|
498 | *EPERM* |
---|
499 | The provided structure pointer is invalid. |
---|
500 | |
---|
501 | **DESCRIPTION:** |
---|
502 | |
---|
503 | This service returns system information to the caller. It does this |
---|
504 | by filling in the ``struct utsname`` format structure for the |
---|
505 | caller. |
---|
506 | |
---|
507 | **NOTES:** |
---|
508 | |
---|
509 | The information provided includes the operating system (RTEMS in |
---|
510 | all configurations), the node number, the release as the RTEMS |
---|
511 | version, and the CPU family and model. The CPU model name |
---|
512 | will indicate the multilib executive variant being used. |
---|
513 | |
---|
514 | times - Get process times |
---|
515 | ------------------------- |
---|
516 | .. index:: times |
---|
517 | .. index:: get process times |
---|
518 | |
---|
519 | **CALLING SEQUENCE:** |
---|
520 | |
---|
521 | .. code:: c |
---|
522 | |
---|
523 | #include <sys/time.h> |
---|
524 | clock_t times( |
---|
525 | struct tms \*ptms |
---|
526 | ); |
---|
527 | |
---|
528 | **STATUS CODES:** |
---|
529 | |
---|
530 | This routine returns the number of clock ticks that have elapsed |
---|
531 | since the system was initialized (e.g. the application was |
---|
532 | started). |
---|
533 | |
---|
534 | **DESCRIPTION:** |
---|
535 | |
---|
536 | ``times`` stores the current process times in ``ptms``. The |
---|
537 | format of ``struct tms`` is as defined in``<sys/times.h>``. RTEMS fills in the field ``tms_utime`` |
---|
538 | with the number of ticks that the calling thread has executed |
---|
539 | and the field ``tms_stime`` with the number of clock ticks |
---|
540 | since system boot (also returned). All other fields in the``ptms`` are left zero. |
---|
541 | |
---|
542 | **NOTES:** |
---|
543 | |
---|
544 | RTEMS has no way to distinguish between user and system time |
---|
545 | so this routine returns the most meaningful information |
---|
546 | possible. |
---|
547 | |
---|
548 | getenv - Get Environment Variables |
---|
549 | ---------------------------------- |
---|
550 | .. index:: getenv |
---|
551 | .. index:: get environment variables |
---|
552 | |
---|
553 | **CALLING SEQUENCE:** |
---|
554 | |
---|
555 | .. code:: c |
---|
556 | |
---|
557 | char \*getenv( |
---|
558 | const char \*name |
---|
559 | ); |
---|
560 | |
---|
561 | **STATUS CODES:** |
---|
562 | |
---|
563 | *NULL* |
---|
564 | when no match |
---|
565 | |
---|
566 | *pointer to value* |
---|
567 | when successful |
---|
568 | |
---|
569 | **DESCRIPTION:** |
---|
570 | |
---|
571 | This service searches the set of environment variables for |
---|
572 | a string that matches the specified ``name``. If found, |
---|
573 | it returns the associated value. |
---|
574 | |
---|
575 | **NOTES:** |
---|
576 | |
---|
577 | The environment list consists of name value pairs that |
---|
578 | are of the form *name = value*. |
---|
579 | |
---|
580 | setenv - Set Environment Variables |
---|
581 | ---------------------------------- |
---|
582 | .. index:: setenv |
---|
583 | .. index:: set environment variables |
---|
584 | |
---|
585 | **CALLING SEQUENCE:** |
---|
586 | |
---|
587 | .. code:: c |
---|
588 | |
---|
589 | int setenv( |
---|
590 | const char \*name, |
---|
591 | const char \*value, |
---|
592 | int overwrite |
---|
593 | ); |
---|
594 | |
---|
595 | **STATUS CODES:** |
---|
596 | |
---|
597 | Returns 0 if successful and -1 otherwise. |
---|
598 | |
---|
599 | **DESCRIPTION:** |
---|
600 | |
---|
601 | This service adds the variable ``name`` to the environment with``value``. If ``name`` is not already exist, then it is |
---|
602 | created. If ``name`` exists and ``overwrite`` is zero, then |
---|
603 | the previous value is not overwritten. |
---|
604 | |
---|
605 | **NOTES:** |
---|
606 | |
---|
607 | NONE |
---|
608 | |
---|
609 | ctermid - Generate Terminal Pathname |
---|
610 | ------------------------------------ |
---|
611 | .. index:: ctermid |
---|
612 | .. index:: generate terminal pathname |
---|
613 | |
---|
614 | **CALLING SEQUENCE:** |
---|
615 | |
---|
616 | .. code:: c |
---|
617 | |
---|
618 | char \*ctermid( |
---|
619 | char \*s |
---|
620 | ); |
---|
621 | |
---|
622 | **STATUS CODES:** |
---|
623 | |
---|
624 | Returns a pointer to a string indicating the pathname for the controlling |
---|
625 | terminal. |
---|
626 | |
---|
627 | **DESCRIPTION:** |
---|
628 | |
---|
629 | This service returns the name of the terminal device associated with |
---|
630 | this process. If ``s`` is NULL, then a pointer to a static buffer |
---|
631 | is returned. Otherwise, ``s`` is assumed to have a buffer of |
---|
632 | sufficient size to contain the name of the controlling terminal. |
---|
633 | |
---|
634 | **NOTES:** |
---|
635 | |
---|
636 | By default on RTEMS systems, the controlling terminal is ``/dev/console``. |
---|
637 | Again this implementation is of limited meaning, but it provides |
---|
638 | true and useful results which should be sufficient to ease porting |
---|
639 | applications from a full POSIX implementation to the reduced |
---|
640 | profile supported by RTEMS. |
---|
641 | |
---|
642 | ttyname - Determine Terminal Device Name |
---|
643 | ---------------------------------------- |
---|
644 | .. index:: ttyname |
---|
645 | .. index:: determine terminal device name |
---|
646 | |
---|
647 | **CALLING SEQUENCE:** |
---|
648 | |
---|
649 | .. code:: c |
---|
650 | |
---|
651 | char \*ttyname( |
---|
652 | int fd |
---|
653 | ); |
---|
654 | |
---|
655 | **STATUS CODES:** |
---|
656 | |
---|
657 | Pointer to a string containing the terminal device name or |
---|
658 | NULL is returned on any error. |
---|
659 | |
---|
660 | **DESCRIPTION:** |
---|
661 | |
---|
662 | This service returns a pointer to the pathname of the terminal |
---|
663 | device that is open on the file descriptor ``fd``. If``fd`` is not a valid descriptor for a terminal device, |
---|
664 | then NULL is returned. |
---|
665 | |
---|
666 | **NOTES:** |
---|
667 | |
---|
668 | This routine uses a static buffer. |
---|
669 | |
---|
670 | ttyname_r - Reentrant Determine Terminal Device Name |
---|
671 | ---------------------------------------------------- |
---|
672 | .. index:: ttyname_r |
---|
673 | .. index:: reentrant determine terminal device name |
---|
674 | |
---|
675 | **CALLING SEQUENCE:** |
---|
676 | |
---|
677 | .. code:: c |
---|
678 | |
---|
679 | int ttyname_r( |
---|
680 | int fd, |
---|
681 | char \*name, |
---|
682 | int namesize |
---|
683 | ); |
---|
684 | |
---|
685 | **STATUS CODES:** |
---|
686 | |
---|
687 | This routine returns -1 and sets ``errno`` as follows: |
---|
688 | |
---|
689 | *EBADF* |
---|
690 | If not a valid descriptor for a terminal device. |
---|
691 | |
---|
692 | *EINVAL* |
---|
693 | If ``name`` is NULL or ``namesize`` are insufficient. |
---|
694 | |
---|
695 | **DESCRIPTION:** |
---|
696 | |
---|
697 | This service the pathname of the terminal device that is open |
---|
698 | on the file descriptor ``fd``. |
---|
699 | |
---|
700 | **NOTES:** |
---|
701 | |
---|
702 | NONE |
---|
703 | |
---|
704 | isatty - Determine if File Descriptor is Terminal |
---|
705 | ------------------------------------------------- |
---|
706 | .. index:: isatty |
---|
707 | .. index:: determine if file descriptor is terminal |
---|
708 | |
---|
709 | **CALLING SEQUENCE:** |
---|
710 | |
---|
711 | .. code:: c |
---|
712 | |
---|
713 | int isatty( |
---|
714 | int fd |
---|
715 | ); |
---|
716 | |
---|
717 | **STATUS CODES:** |
---|
718 | |
---|
719 | Returns 1 if ``fd`` is a terminal device and 0 otherwise. |
---|
720 | |
---|
721 | **DESCRIPTION:** |
---|
722 | |
---|
723 | This service returns 1 if ``fd`` is an open file descriptor |
---|
724 | connected to a terminal and 0 otherwise. |
---|
725 | |
---|
726 | **NOTES:** |
---|
727 | |
---|
728 | sysconf - Get Configurable System Variables |
---|
729 | ------------------------------------------- |
---|
730 | .. index:: sysconf |
---|
731 | .. index:: get configurable system variables |
---|
732 | |
---|
733 | **CALLING SEQUENCE:** |
---|
734 | |
---|
735 | .. code:: c |
---|
736 | |
---|
737 | long sysconf( |
---|
738 | int name |
---|
739 | ); |
---|
740 | |
---|
741 | **STATUS CODES:** |
---|
742 | |
---|
743 | The value returned is the actual value of the system resource. |
---|
744 | If the requested configuration name is a feature flag, then |
---|
745 | 1 is returned if the available and 0 if it is not. On any |
---|
746 | other error condition, -1 is returned. |
---|
747 | |
---|
748 | **DESCRIPTION:** |
---|
749 | |
---|
750 | This service is the mechanism by which an application determines |
---|
751 | values for system limits or options at runtime. |
---|
752 | |
---|
753 | **NOTES:** |
---|
754 | |
---|
755 | Much of the information that may be obtained via ``sysconf`` |
---|
756 | has equivalent macros in ``<unistd.h``. However, those |
---|
757 | macros reflect conservative limits which may have been altered |
---|
758 | by application configuration. |
---|
759 | |
---|
760 | .. COMMENT: COPYRIGHT (c) 1988-2002. |
---|
761 | |
---|
762 | .. COMMENT: On-Line Applications Research Corporation (OAR). |
---|
763 | |
---|
764 | .. COMMENT: All rights reserved. |
---|
765 | |
---|