1Intro(2)                         System Calls                         Intro(2)
2
3
4

NAME

6       Intro, intro - introduction to system calls and error numbers
7

SYNOPSIS

9       #include <errno.h>
10
11

DESCRIPTION

13       A  system call is a C library function that requests a service from the
14       system, such as getting the time of day. This request is  performed  in
15       the  kernel.  The  library  interface  executes a trap into the kernel,
16       which actually executes the system call code.
17
18
19       Most system calls return one or more error conditions. An error  condi‐
20       tion  is  indicated  by  an  otherwise impossible return value. This is
21       almost always −1 or the null pointer; the individual descriptions spec‐
22       ify the details. An error number is also made available in the external
23       variable errno, which is not cleared on successful calls, so it  should
24       be tested only after an error has been indicated.
25
26
27       In the case of multithreaded applications, the -mt option must be spec‐
28       ified on the command line at compilation time  (see  threads(5)).  When
29       the  -mt  option  is specified, errno becomes a macro that enables each
30       thread to have its own errno. This errno macro can be  used  on  either
31       side of the assignment as though it were a variable.
32
33
34       An error value listed as "will fail" describes a condition whose detec‐
35       tion and reporting is mandatory for an implementation that conforms  to
36       the  Single  UNIX  Specification (SUS). An application can rely on this
37       condition being detected and reported. An error value  listed  as  "may
38       fail"  describes a condition whose detection and reporting is  optional
39       for an implementation that conforms to the SUS. An  application  should
40       not  rely  this  condition  being detected and reported. An application
41       that relies on such behavior cannot be assured to  be  portable  across
42       conforming implementations. If more than one error occurs in processing
43       a function call, any one of the possible errors might may be  returned,
44       as the order of detection is undefined. See standards(5) for additional
45       information regarding the Single UNIX Specification.
46
47
48       Each system call description attempts to list all possible  error  num‐
49       bers.  The  following is a complete list of the error numbers and their
50       names as defined in <errno.h>.
51
52       1 EPERM                Lacking appropriate privileges
53
54                              Typically this error  indicates  an  attempt  to
55                              modify  a  file  in some way forbidden except to
56                              its  owner  or   an   appropriately   privileged
57                              process.   It  is  also returned for attempts by
58                              ordinary users  to  perform  operations  allowed
59                              only to processes with certain privileges.
60
61                              The  manual pages for individual functions docu‐
62                              ment which privileges are needed to override the
63                              restriction.
64
65
66       2 ENOENT               No such file or directory
67
68                              A  file  name  is  specified and the file should
69                              exist but doesn't, or one of the directories  in
70                              a path name does not exist.
71
72
73       3 ESRCH                No such process, LWP, or thread
74
75                              No  process can be found in the system that cor‐
76                              responds  to  the  specified  PID,  LWPID_t,  or
77                              thread_t.
78
79
80       4 EINTR                Interrupted system call
81
82                              An  asynchronous  signal  (such  as interrupt or
83                              quit), which the  user  has  elected  to  catch,
84                              occurred  during  a  system service function. If
85                              execution is resumed after processing  the  sig‐
86                              nal,  it will appear as if the interrupted func‐
87                              tion call returned this error condition.
88
89                              In a multithreaded  application,  EINTR  may  be
90                              returned  whenever  another  thread or LWP calls
91                              fork(2).
92
93
94       5 EIO                  I/O error
95
96                              Some physical I/O error has occurred. This error
97                              may  in some cases occur on a call following the
98                              one to which it actually applies.
99
100
101       6 ENXIO                No such device or address
102
103                              I/O on a special  file  refers  to  a  subdevice
104                              which does not exist, or exists beyond the limit
105                              of the device. It may also occur when, for exam‐
106                              ple, a tape drive is not on-line or no disk pack
107                              is loaded on a drive.
108
109
110       7 E2BIG                Arg list too long
111
112                              An argument list longer than  ARG_MAX  bytes  is
113                              presented  to  a  member  of  the exec family of
114                              functions (see exec(2)). The argument list limit
115                              is the sum of the size of the argument list plus
116                              the size of  the  environment's  exported  shell
117                              variables.
118
119
120       8 ENOEXEC              Exec format error
121
122                              A  request  is  made  to  execute  a file which,
123                              although it  has  the  appropriate  permissions,
124                              does   not   start  with  a  valid  format  (see
125                              a.out(4)).
126
127
128       9 EBADF                Bad file number
129
130                              Either a file descriptor refers to no open file,
131                              or  a  read(2) (respectively,  write(2)) request
132                              is made to a file that is open only for  writing
133                              (respectively, reading).
134
135
136       10 ECHILD              No child processes
137
138                              A  wait(3C)  function  call  was  executed  by a
139                              process that had  no  existing  or  unwaited-for
140                              child processes.
141
142
143       11 EAGAIN              No more processes, or no more LWPs
144
145                              For example, the fork(2) function failed because
146                              the system's process table is full or  the  user
147                              is  not allowed to create any more processes, or
148                              a call failed because of insufficient memory  or
149                              swap space.
150
151
152       12 ENOMEM              Not enough space
153
154                              During   execution   of  brk()  or  sbrk()  (see
155                              brk(2)), or one of the exec family of functions,
156                              a program asks for more space than the system is
157                              able to supply. This is not a  temporary  condi‐
158                              tion; the maximum size is a system parameter. On
159                              some architectures, the error may also occur  if
160                              the  arrangement  of  text, data, and stack seg‐
161                              ments requires too many segmentation  registers,
162                              or  if there is not enough swap space during the
163                              fork(2) function.
164
165
166       13 EACCES              Permission denied
167
168                              An attempt was made to access a file  in  a  way
169                              forbidden by the protection system.
170
171                              The  manual pages for individual functions docu‐
172                              ment which privileges are needed to override the
173                              protection system.
174
175
176       14 EFAULT              Bad address
177
178                              The  system  encountered  a  hardware  fault  in
179                              attempting to use an argument of a routine.  For
180                              example, errno potentially may be set to  EFAULT
181                              any time a routine that takes a pointer argument
182                              is  passed an invalid address, if the system can
183                              detect the condition. Because systems will  dif‐
184                              fer  in  their  ability to reliably detect a bad
185                              address, on some implementations passing  a  bad
186                              address  to  a  routine will result in undefined
187                              behavior.
188
189
190       15 ENOTBLK             Block device required
191
192                              A non-block device or file was mentioned where a
193                              block  device  was  required  (for example, in a
194                              call to the mount(2) function).
195
196
197       16 EBUSY               Device busy
198
199                              An attempt was made to mount a device  that  was
200                              already  mounted  or  an  attempt  was  made  to
201                              unmount a device on which  there  is  an  active
202                              file  (open  file, current directory, mounted-on
203                              file, active text segment). It will  also  occur
204                              if  an attempt is made to enable accounting when
205                              it is already enabled. The device or resource is
206                              currently  unavailable.    EBUSY is also used by
207                              mutexes, semaphores,  condition  variables,  and
208                              r/w  locks,  to  indicate  that  a lock is held,
209                              and by the processor control function  P_ONLINE.
210
211
212       17 EEXIST              File exists
213
214                              An existing file was mentioned in an inappropri‐
215                              ate  context  (for  example, call to the link(2)
216                              function).
217
218
219       18 EXDEV               Cross-device link
220
221                              A hard link to a  file  on  another  device  was
222                              attempted.
223
224
225       19 ENODEV              No such device
226
227                              An  attempt  was  made to apply an inappropriate
228                              operation to  a  device  (for  example,  read  a
229                              write-only device).
230
231
232       20 ENOTDIR             Not a directory
233
234                              A  non-directory was specified where a directory
235                              is required (for example, in a path prefix or as
236                              an argument to the chdir(2) function).
237
238
239       21 EISDIR              Is a directory
240
241                              An attempt was made to write on a directory.
242
243
244       22 EINVAL              Invalid argument
245
246                              An  invalid argument was specified (for example,
247                              unmounting a non-mounted device), mentioning  an
248                              undefined  signal in a call to the signal(3C) or
249                              kill(2) function, or  an  unsupported  operation
250                              related to extended attributes was attempted.
251
252
253       23 ENFILE              File table overflow
254
255                              The   system   file  table  is  full  (that  is,
256                              SYS_OPEN files are open, and temporarily no more
257                              files can be opened).
258
259
260       24 EMFILE              Too many open files
261
262                              No  process  may  have  more than  OPEN_MAX file
263                              descriptors open at a time.
264
265
266       25 ENOTTY              Inappropriate ioctl for device
267
268                              A call was made to the ioctl(2) function  speci‐
269                              fying  a  file  that  is not a special character
270                              device.
271
272
273       26 ETXTBSY             Text file busy (obsolete)
274
275                              An attempt was made to execute a  pure-procedure
276                              program that is currently open for writing. Also
277                              an attempt to open for writing or  to  remove  a
278                              pure-procedure  program  that is being executed.
279                              (This message is obsolete.)
280
281
282       27 EFBIG               File too large
283
284                              The size of the file exceeded the  limit  speci‐
285                              fied  by  resource  RLIMIT_FSIZEn; the file size
286                              exceeds the maximum supported by the  file  sys‐
287                              tem; or the file size exceeds the offset maximum
288                              of the file descriptor.  See the File Descriptor
289                              subsection of the DEFINITIONS section below.
290
291
292       28 ENOSPC              No space left on device
293
294                              While  writing  an  ordinary  file or creating a
295                              directory entry, there is no free space left  on
296                              the  device.  In the fcntl(2) function, the set‐
297                              ting or removing of record locks on a file  can‐
298                              not  be  accomplished  because there are no more
299                              record entries left on the system.
300
301
302       29 ESPIPE              Illegal seek
303
304                              A call to the  lseek(2) function was issued to a
305                              pipe.
306
307
308       30 EROFS               Read-only file system
309
310                              An  attempt  to  modify  a file or directory was
311                              made on a device mounted read-only.
312
313
314       31 EMLINK              Too many links
315
316                              An attempt to make more than the maximum  number
317                              of links,  LINK_MAX, to a file.
318
319
320       32 EPIPE               Broken pipe
321
322                              A  write on a pipe for which there is no process
323                              to read the data. This condition normally gener‐
324                              ates a signal; the error is returned if the sig‐
325                              nal is ignored.
326
327
328       33 EDOM                Math argument out of domain of function
329
330                              The argument of a function in the  math  package
331                              (3M) is out of the domain of the function.
332
333
334       34 ERANGE              Math result not representable
335
336                              The value of a function in the math package (3M)
337                              is not representable within machine precision.
338
339
340       35 ENOMSG              No message of desired type
341
342                              An attempt was made to receive a  message  of  a
343                              type  that  does not exist on the specified mes‐
344                              sage queue (see msgrcv(2)).
345
346
347       36 EIDRM               Identifier removed
348
349                              This error is returned to processes that  resume
350                              execution  due  to  the removal of an identifier
351                              from  the  file   system's   name   space   (see
352                              msgctl(2), semctl(2), and shmctl(2)).
353
354
355       37 ECHRNG              Channel number out of range
356
357
358       38 EL2NSYNC            Level 2 not synchronized
359
360
361       39 EL3HLT              Level 3 halted
362
363
364       40 EL3RST              Level 3 reset
365
366
367       41 ELNRNG              Link number out of range
368
369
370       42 EUNATCH             Protocol driver not attached
371
372
373       43 ENOCSI              No CSI structure available
374
375
376       44 EL2HLT              Level 2 halted
377
378
379       45 EDEADLK             Deadlock condition
380
381                              A  deadlock  situation was detected and avoided.
382                              This error pertains to file and record  locking,
383                              and  also applies to mutexes, semaphores, condi‐
384                              tion variables, and r/w locks.
385
386
387       46 ENOLCK              No record locks available
388
389                              There are no more locks  available.  The  system
390                              lock table is full (see fcntl(2)).
391
392
393       47 ECANCELED           Operation canceled
394
395                              The  associated  asynchronous operation was can‐
396                              celed before completion.
397
398
399       48 ENOTSUP             Not supported
400
401                              This version of the system does not support this
402                              feature.  Future versions of the system may pro‐
403                              vide support.
404
405
406       49 EDQUOT              Disc quota exceeded
407
408                              A write(2) to an ordinary file, the creation  of
409                              a directory or symbolic link, or the creation of
410                              a directory  entry  failed  because  the  user's
411                              quota of disk blocks was exhausted, or the allo‐
412                              cation of an inode  for  a  newly  created  file
413                              failed  because  the  user's quota of inodes was
414                              exhausted.
415
416
417       58-59                  Reserved
418
419
420       60 ENOSTR              Device not a stream
421
422                              A putmsg(2) or getmsg(2) call was attempted on a
423                              file descriptor that is not a STREAMS device.
424
425
426       61 ENODATA             No data available
427
428
429       62 ETIME               Timer expired
430
431                              The  timer  set  for a STREAMS ioctl(2) call has
432                              expired. The cause of this error is  device-spe‐
433                              cific  and  could  indicate either a hardware or
434                              software failure, or  perhaps  a  timeout  value
435                              that  is  too  short for the specific operation.
436                              The status of the ioctl() operation is  indeter‐
437                              minate.  This  is  also  returned in the case of
438                              _lwp_cond_timedwait(2) or cond_timedwait(3C).
439
440
441       63 ENOSR               Out of stream resources
442
443                              During  a   STREAMS  open(2)  call,  either   no
444                              STREAMS  queues  or  no STREAMS head data struc‐
445                              tures were available. This is a temporary condi‐
446                              tion; one may recover from it if other processes
447                              release resources.
448
449
450       65 ENOPKG              Package not installed
451
452                              This error occurs when users attempt  to  use  a
453                              call   from   a   package  which  has  not  been
454                              installed.
455
456
457       71 EPROTO              Protocol error
458
459                              Some protocol error  occurred.   This  error  is
460                              device-specific, but is generally not related to
461                              a hardware failure.
462
463
464       77 EBADMSG             Not a data message
465
466                              During  a  read(2),   getmsg(2),   or   ioctl(2)
467                              I_RECVFD call to a STREAMS device, something has
468                              come to the head of the queue that  can  not  be
469                              processed.  That something depends on the call:
470
471                              read():      control  information or passed file
472                                           descriptor.
473
474
475                              getmsg():    passed file descriptor.
476
477
478                              ioctl():     control or data information.
479
480
481
482       78 ENAMETOOLONG        File name too long
483
484                              The  length  of  the   path   argument   exceeds
485                              PATH_MAX,  or  the  length  of  a path component
486                              exceeds NAME_MAX  while  _POSIX_NO_TRUNC  is  in
487                              effect; see limits.h(3HEAD).
488
489
490       79 EOVERFLOW           Value too large for defined data type.
491
492
493       80 ENOTUNIQ            Name not unique on network
494
495                              Given log name not unique.
496
497
498       81 EBADFD              File descriptor in bad state
499
500                              Either  a file descriptor refers to no open file
501                              or a read request was made to  a  file  that  is
502                              open only for writing.
503
504
505       82 EREMCHG             Remote address changed
506
507
508       83 ELIBACC             Cannot access a needed share library
509
510                              Trying  to  exec an a.out that requires a static
511                              shared library and  the  static  shared  library
512                              does not exist or the user does not have permis‐
513                              sion to use it.
514
515
516       84 ELIBBAD             Accessing a corrupted shared library
517
518                              Trying to exec an a.out that requires  a  static
519                              shared  library (to be linked in) and exec could
520                              not load the static shared library.  The  static
521                              shared library is probably corrupted.
522
523
524       85 ELIBSCN             .lib section in a.out corrupted
525
526                              Trying  to  exec an a.out that requires a static
527                              shared library (to be linked in) and  there  was
528                              erroneous data in the .lib section of the a.out.
529                              The .lib section tells exec what  static  shared
530                              libraries are needed. The a.out is probably cor‐
531                              rupted.
532
533
534       86 ELIBMAX             Attempting to link in more shared libraries than
535                              system limit
536
537                              Trying  to  exec  an  a.out  that  requires more
538                              static shared libraries than is allowed  on  the
539                              current  configuration of the system. See System
540                              Administration Guide: IP Services
541
542
543       87 ELIBEXEC            Cannot exec a shared library directly
544
545                              Attempting to exec a shared library directly.
546
547
548       88 EILSEQ              Error 88
549
550                              Illegal byte sequence. Handle  multiple  charac‐
551                              ters as a single character.
552
553
554       89 ENOSYS              Operation not applicable
555
556
557       90 ELOOP               Number of symbolic links encountered during path
558                              name traversal exceeds MAXSYMLINKS
559
560
561       91 ESTART              Restartable system call
562
563                              Interrupted system call should be restarted.
564
565
566       92 ESTRPIPE            If pipe/FIFO, don't sleep in stream head
567
568                              Streams pipe error (not externally visible).
569
570
571       93 ENOTEMPTY           Directory not empty
572
573
574       94 EUSERS              Too many users
575
576
577       95 ENOTSOCK            Socket operation on non-socket
578
579
580       96 EDESTADDRREQ        Destination address required
581
582                              A required address was omitted from an operation
583                              on  a  transport  endpoint.  Destination address
584                              required.
585
586
587       97 EMGSIZE             Message too long
588
589                              A message  sent  on  a  transport  provider  was
590                              larger  than the internal message buffer or some
591                              other network limit.
592
593
594       98 EPROTOTYPE          Protocol wrong type for socket
595
596                              A protocol was specified that does  not  support
597                              the semantics of the socket type requested.
598
599
600       99 ENOPROTOOPT         Protocol not available
601
602                              A bad option or level was specified when getting
603                              or setting options for a protocol.
604
605
606       120 EPROTONOSUPPORT    Protocol not supported
607
608                              The protocol has not been  configured  into  the
609                              system or no implementation for it exists.
610
611
612       121 ESOCKTNOSUPPORT    Socket type not supported
613
614                              The  support  for  the  socket type has not been
615                              configured into the system or no  implementation
616                              for it exists.
617
618
619       122 EOPNOTSUPP         Operation not supported on transport endpoint
620
621                              For  example, trying to accept a connection on a
622                              datagram transport endpoint.
623
624
625       123 EPFNOSUPPORT       Protocol family not supported
626
627                              The protocol family has not been configured into
628                              the  system  or no implementation for it exists.
629                              Used for the Internet protocols.
630
631
632       124 EAFNOSUPPORT       Address family not supported by protocol family
633
634                              An address incompatible with the requested  pro‐
635                              tocol was used.
636
637
638       125 EADDRINUSE         Address already in use
639
640                              User attempted to use an address already in use,
641                              and the protocol does not allow this.
642
643
644       126 EADDRNOTAVAIL      Cannot assign requested address
645
646                              Results from an attempt to  create  a  transport
647                              endpoint  with  an  address  not  on the current
648                              machine.
649
650
651       127 ENETDOWN           Network is down
652
653                              Operation encountered a dead network.
654
655
656       128 ENETUNREACH        Network is unreachable
657
658                              Operation was attempted to an  unreachable  net‐
659                              work.
660
661
662       129 ENETRESET          Network dropped connection because of reset
663
664                              The  host  you  were  connected  to  crashed and
665                              rebooted.
666
667
668       130 ECONNABORTED       Software caused connection abort
669
670                              A connection abort was caused internal  to  your
671                              host machine.
672
673
674       131 ECONNRESET         Connection reset by peer
675
676                              A connection was forcibly closed by a peer. This
677                              normally results from a loss of  the  connection
678                              on the remote host due to a timeout or a reboot.
679
680
681       132 ENOBUFS            No buffer space available
682
683                              An operation on a transport endpoint or pipe was
684                              not performed because the system  lacked  suffi‐
685                              cient buffer space or because a queue was full.
686
687
688       133 EISCONN            Transport endpoint is already connected
689
690                              A  connect  request  was made on an already con‐
691                              nected transport endpoint; or, a sendto(3SOCKET)
692                              or   sendmsg(3SOCKET)  request  on  a  connected
693                              transport endpoint specified a destination  when
694                              already connected.
695
696
697       134 ENOTCONN           Transport endpoint is not connected
698
699                              A request to send or receive data was disallowed
700                              because the transport endpoint is not  connected
701                              and  (when  sending  a  datagram) no address was
702                              supplied.
703
704
705       143 ESHUTDOWN          Cannot send after transport endpoint shutdown
706
707                              A request to send data  was  disallowed  because
708                              the  transport  endpoint  has  already been shut
709                              down.
710
711
712       144 ETOOMANYREFS       Too many references: cannot splice
713
714
715       145 ETIMEDOUT          Connection timed out
716
717                              A  connect(3SOCKET)  or   send(3SOCKET)  request
718                              failed because the connected party did not prop‐
719                              erly respond  after  a  period  of  time;  or  a
720                              write(2)  or  fsync(3C) request failed because a
721                              file is on an  NFS file system mounted with  the
722                              soft option.
723
724
725       146 ECONNREFUSED       Connection refused
726
727                              No  connection  could be made because the target
728                              machine  actively  refused  it.   This   usually
729                              results from trying to connect to a service that
730                              is inactive on the remote host.
731
732
733       147 EHOSTDOWN          Host is down
734
735                              A transport provider  operation  failed  because
736                              the destination host was down.
737
738
739       148 EHOSTUNREACH       No route to host
740
741                              A  transport provider operation was attempted to
742                              an unreachable host.
743
744
745       149 EALREADY           Operation already in progress
746
747                              An operation was  attempted  on  a  non-blocking
748                              object   that   already   had  an  operation  in
749                              progress.
750
751
752       150 EINPROGRESS        Operation now in progress
753
754                              An operation that takes a long time to  complete
755                              (such  as  a  connect()) was attempted on a non-
756                              blocking object.
757
758
759       151 ESTALE             Stale NFS file handle
760
761

DEFINITIONS

763   Background Process Group
764       Any process group that is not the foreground process group  of  a  ses‐
765       sion that has established a connection with a controlling terminal.
766
767   Controlling Process
768       A  session leader that established a connection to a controlling termi‐
769       nal.
770
771   Controlling Terminal
772       A terminal that is associated with a session.  Each session  may  have,
773       at  most, one controlling terminal associated with it and a controlling
774       terminal may be  associated  with  only  one  session.   Certain  input
775       sequences  from  the  controlling  terminal cause signals to be sent to
776       process groups in the session associated with the controlling terminal;
777       see termio(7I).
778
779   Directory
780       Directories organize files into a hierarchical system where directories
781       are the nodes in the hierarchy. A directory is a file that catalogs the
782       list  of  files,  including  directories  (sub-directories),  that  are
783       directly beneath it in the hierarchy. Entries in a directory  file  are
784       called  links.  A link associates a file identifier with a filename. By
785       convention, a directory contains at least two links,  .  (dot)  and  ..
786       (dot-dot).  The  link  called  dot refers to the directory itself while
787       dot-dot refers to its parent directory. The root  directory,  which  is
788       the top-most node of the hierarchy, has itself as its parent directory.
789       The pathname of the root directory is / and the parent directory of the
790       root directory is /.
791
792   Downstream
793       In a stream, the direction from stream head to driver.
794
795   Driver
796       In a stream, the driver provides the interface between peripheral hard‐
797       ware and the stream. A driver can also be a pseudo-driver,  such  as  a
798       multiplexor or log driver (see log(7D)), which is not associated with a
799       hardware device.
800
801   Effective User ID and Effective Group ID
802       An active process has an effective user ID and an  effective  group  ID
803       that  are  used  to  determine file access permissions (see below). The
804       effective user ID and effective group ID are  equal  to  the  process's
805       real user ID and real group ID, respectively, unless the process or one
806       of its ancestors evolved from a file that had the  set-user-ID  bit  or
807       set-group-ID bit set  (see exec(2)).
808
809   File Access Permissions
810       Read, write, and execute/search permissions for a file are granted to a
811       process if one or more of the following are true:
812
813           o      The effective user ID of the process matches the user ID  of
814                  the  owner of the file and the appropriate access bit of the
815                  "owner" portion (0700) of the file mode is set.
816
817           o      The effective user  ID of the process  does  not  match  the
818                  user  ID  of the owner of the file, but either the effective
819                  group ID or one of  the  supplementary  group   IDs  of  the
820                  process  match the group  ID of the file and the appropriate
821                  access bit of the "group" portion (0070) of the file mode is
822                  set.
823
824           o      The effective user ID of the process does not match the user
825                  ID of the owner of the file, and neither the effective group
826                  ID  nor  any  of  the supplementary group IDs of the process
827                  match the group ID of the file, but the  appropriate  access
828                  bit of the "other" portion (0007) of the file mode is set.
829
830           o      The  read,  write,  or  execute  mode bit is not set but the
831                  process has the discretionary file access override privilege
832                  for the corresponding mode bit: {PRIV_FILE_DAC_READ} for the
833                  read  bit   {PRIV_FILE_DAC_WRITE}   for   the   write   bit,
834                  {PRIV_FILE_DAC_SEARCH}  for  the execute bit on directories,
835                  and {PRIV_FILE_DAC_EXECUTE} for the executable bit on  plain
836                  files.
837
838
839       Otherwise, the corresponding permissions are denied.
840
841   File Descriptor
842       A file descriptor is a small integer used to perform I/O on a file. The
843       value of a file descriptor is from 0 to (NOFILES−1). A process may have
844       no  more  than   NOFILES  file descriptors  open simultaneously. A file
845       descriptor is returned by calls such as open(2) or  pipe(2).  The  file
846       descriptor  is  used as an argument by calls such as read(2), write(2),
847       ioctl(2), and close(2).
848
849
850       Each file descriptor has a corresponding offset  maximum.  For  regular
851       files that were opened without setting the O_LARGEFILE flag, the offset
852       maximum is 2 Gbyte − 1 byte (2^31 −1 bytes).  For  regular  files  that
853       were  opened  with the O_LARGEFILE flag set, the offset maximum is 2^63
854       −1 bytes.
855
856   File Name
857       Names consisting of 1 to  NAME_MAX characters may be used  to  name  an
858       ordinary file, special file or directory.
859
860
861       These  characters  may be selected from the set of all character values
862       excluding \0 (null) and the ASCII code for / (slash).
863
864
865       Note that it is generally unwise to use *, ?, [, or ] as part  of  file
866       names  because  of  the special meaning attached to these characters by
867       the shell (see sh(1), csh(1), and ksh(1)). Although permitted, the  use
868       of unprintable characters in file names should be avoided.
869
870
871       A  file  name  is  sometimes  referred to as a pathname component.  The
872       interpretation of a pathname component is dependent on  the  values  of
873       NAME_MAX  and   _POSIX_NO_TRUNC associated with the path prefix of that
874       component.  If any pathname  component  is  longer  than  NAME_MAX  and
875       _POSIX_NO_TRUNC is in effect for the path prefix of that component (see
876       fpathconf(2) and limits.h(3HEAD)), it shall be considered an error con‐
877       dition in  that implementation. Otherwise, the implementation shall use
878       the first NAME_MAX bytes of the pathname component.
879
880   Foreground Process Group
881       Each session that has established a connection with a controlling  ter‐
882       minal  will  distinguish  one process group of the session as the fore‐
883       ground process group of the controlling terminal.  This group has  cer‐
884       tain privileges when accessing its controlling terminal that are denied
885       to background process groups.
886
887   {IOV_MAX}
888       Maximum number of entries in a struct iovec array.
889
890   {LIMIT}
891       The braces notation, {LIMIT}, is used to denote a magnitude  limitation
892       imposed  by  the  implementation.  This  indicates a value which may be
893       defined by a header file (without the braces), or the actual value  may
894       be  obtained  at  runtime  by a call to the configuration inquiry path‐
895       conf(2) with the name argument  _PC_LIMIT.
896
897   Masks
898       The file mode creation mask of the process used during any create func‐
899       tion  calls  to turn off permission bits in the mode argument supplied.
900       Bit positions that are set in umask(cmask) are cleared in the  mode  of
901       the created file.
902
903   Message
904       In a stream, one or more blocks of data or information, with associated
905       STREAMS control structures. Messages can be of several  defined  types,
906       which  identify  the  message  contents. Messages are the only means of
907       transferring data and communicating within a stream.
908
909   Message Queue
910       In a stream, a linked list of messages awaiting processing by a  module
911       or driver.
912
913   Message Queue Identifier
914       A message queue identifier (msqid) is a unique positive integer created
915       by a msgget(2) call. Each msqid has a message queue and a  data  struc‐
916       ture  associated with it. The data structure is referred to as msqid_ds
917       and contains the following members:
918
919         struct     ipc_perm msg_perm;
920         struct     msg *msg_first;
921         struct     msg *msg_last;
922         ulong_t    msg_cbytes;
923         ulong_t    msg_qnum;
924         ulong_t    msg_qbytes;
925         pid_t      msg_lspid;
926         pid_t      msg_lrpid;
927         time_t     msg_stime;
928         time_t     msg_rtime;
929         time_t     msg_ctime;
930
931
932
933       The following are descriptions of the msqid_ds structure members:
934
935
936       The msg_perm member is an ipc_perm structure that specifies the message
937       operation permission (see below). This structure includes the following
938       members:
939
940         uid_t    cuid;   /* creator user id */
941         gid_t    cgid;   /* creator group id */
942         uid_t    uid;    /* user id */
943         gid_t    gid;    /* group id */
944         mode_t   mode;   /* r/w permission */
945         ulong_t  seq;    /* slot usage sequence # */
946         key_t    key;    /* key */
947
948
949
950       The *msg_first member is a pointer to the first message on the queue.
951
952
953       The *msg_last member is a pointer to the last message on the queue.
954
955
956       The msg_cbytes member is the current number of bytes on the queue.
957
958
959       The msg_qnum member is the number of messages currently on the queue.
960
961
962       The msg_qbytes member is the maximum number of  bytes  allowed  on  the
963       queue.
964
965
966       The  msg_lspid  member  is the process ID of the last process that per‐
967       formed a msgsnd() operation.
968
969
970       The msg_lrpid member is the process id of the last  process  that  per‐
971       formed a msgrcv() operation.
972
973
974       The msg_stime member is the time of the last msgsnd() operation.
975
976
977       The msg_rtime member is the time of the last msgrcv() operation.
978
979
980       The  msg_ctime  member  is the time of the last msgctl() operation that
981       changed a member of the above structure.
982
983   Message Operation Permissions
984       In the msgctl(2), msgget(2), msgrcv(2), and msgsnd(2) function descrip‐
985       tions,  the  permission  required for an operation is given as {token},
986       where token is the type of permission needed, interpreted as follows:
987
988         00400   READ by user
989         00200   WRITE by user
990         00040   READ by group
991         00020   WRITE by group
992         00004   READ by others
993         00002   WRITE by others
994
995
996
997       Read and write permissions for a msqid are granted to a process if  one
998       or more of the following are true:
999
1000           o      The {PRIV_IPC_DAC_READ} or {PRIV_IPC_DAC_WRITE} privilege is
1001                  present in the effective set.
1002
1003           o      The effective user ID of the process  matches  msg_perm.cuid
1004                  or  msg_perm.uid in the data structure associated with msqid
1005                  and the appropriate bit of  the  "user"  portion  (0600)  of
1006                  msg_perm.mode is set.
1007
1008           o      Any  group  ID  in  the  process  credentials  from  the set
1009                  (cr_gid, cr_groups) matches  msg_perm.cgid  or  msg_perm.gid
1010                  and  the  appropriate  bit  of  the "group" portion (060) of
1011                  msg_perm.mode is set.
1012
1013           o      The  appropriate  bit  of  the  "other"  portion  (006)   of
1014                  msg_perm.mode is set."
1015
1016
1017       Otherwise, the corresponding permissions are denied.
1018
1019   Module
1020       A module is an entity containing processing routines for input and out‐
1021       put data. It always exists in the  middle  of  a  stream,  between  the
1022       stream's  head and a driver. A module is the STREAMS counterpart to the
1023       commands in a shell pipeline except that a module contains  a  pair  of
1024       functions   which   allow  independent  bidirectional  (downstream  and
1025       upstream) data flow and processing.
1026
1027   Multiplexor
1028       A multiplexor is a driver that allows streams associated  with  several
1029       user  processes  to be connected to a single driver, or several drivers
1030       to be connected to a single user process. STREAMS does  not  provide  a
1031       general  multiplexing  driver, but does provide the facilities for con‐
1032       structing  them  and  for  connecting  multiplexed  configurations   of
1033       streams.
1034
1035   Offset Maximum
1036       An  offset  maximum  is an attribute of an open file description repre‐
1037       senting the largest value that can be used as a file offset.
1038
1039   Orphaned Process Group
1040       A process group in which the parent of every member  in  the  group  is
1041       either  itself a member of the group, or is not a member of the process
1042       group's session.
1043
1044   Path Name
1045       A path name is a null-terminated  character  string  starting  with  an
1046       optional  slash (/), followed by zero or more directory names separated
1047       by slashes, optionally followed by a file name.
1048
1049
1050       If a path name begins with a slash, the path search begins at the  root
1051       directory. Otherwise, the search begins from the current working direc‐
1052       tory.
1053
1054
1055       A slash by itself names the root directory.
1056
1057
1058       Unless specifically stated otherwise, the null path name is treated  as
1059       if it named a non-existent file.
1060
1061   Privileged User
1062       Solaris  software  implements  a  set  of privileges that provide fine-
1063       grained control over the actions of processes. The possession of  of  a
1064       certain  privilege  allows  a  process  to  perform  a  specific set of
1065       restricted operations. Prior to the Solaris 10 release, a process  run‐
1066       ning  with  uid 0 was granted all privileges. See privileges(5) for the
1067       semantics and the degree of backward compatibility awarded to processes
1068       with an effective uid of 0.
1069
1070   Process ID
1071       Each  process  in the system is uniquely identified during its lifetime
1072       by a positive integer called a process  ID.  A  process  ID  cannot  be
1073       reused  by  the  system until the process lifetime, process group life‐
1074       time, and session lifetime ends for any process ID, process  group  ID,
1075       and  session  ID  equal  to that process ID. There are threads within a
1076       process with thread IDs thread_t and LWPID_t.  These  threads  are  not
1077       visible to the outside process.
1078
1079   Parent Process ID
1080       A  new  process is created by a currently active process (see fork(2)).
1081       The parent process ID of a process is the process ID of its creator.
1082
1083   Privilege
1084       Having appropriate privilege means having the  capability  to  override
1085       system restrictions.
1086
1087   Process Group
1088       Each process in the system is a member of a process group that is iden‐
1089       tified by a process group ID.  Any process that is not a process  group
1090       leader  may  create  a  new  process  group  and become its leader. Any
1091       process that is not  a  process  group  leader  may  join  an  existing
1092       process  group  that  shares  the same session as the process.  A newly
1093       created process joins the process group of its parent.
1094
1095   Process Group Leader
1096       A process group leader is a process whose process ID is the same as its
1097       process group ID.
1098
1099   Process Group ID
1100       Each active process is a member of a process group and is identified by
1101       a positive integer called the process group ID. This ID is the  process
1102       ID  of the group leader. This grouping permits the signaling of related
1103       processes (see kill(2)).
1104
1105   Process Lifetime
1106       A process lifetime begins when the process is forked and ends after  it
1107       exits,  when  its  termination  has  been  acknowledged  by  its parent
1108       process. See wait(3C).
1109
1110   Process Group Lifetime
1111       A process group lifetime begins when the process group  is  created  by
1112       its  process  group  leader,  and  ends  when  the lifetime of the last
1113       process in the group ends or when the last process in the group  leaves
1114       the group.
1115
1116   Processor Set ID
1117       The  processors  in a system may be divided into subsets, known as pro‐
1118       cessor sets. A process bound to one of these sets will run only on pro‐
1119       cessors  in  that  set, and the processors in the set will normally run
1120       only processes that have been bound to the set. Each  active  processor
1121       set is identified by a positive integer. See pset_create(2).
1122
1123   Read Queue
1124       In  a  stream,  the message queue in a module or driver containing mes‐
1125       sages moving upstream.
1126
1127   Real User ID and Real Group ID
1128       Each user allowed on the system is  identified by a positive integer (0
1129       to  MAXUID) called a real user ID.
1130
1131
1132       Each  user  is  also  a member of a group. The group is identified by a
1133       positive integer called the real group ID.
1134
1135
1136       An active process has a real user ID and real group ID that are set  to
1137       the real user ID and real group ID, respectively, of the user responsi‐
1138       ble for the creation of the process.
1139
1140   Root Directory and Current Working Directory
1141       Each process has associated with it a concept of a root directory and a
1142       current  working  directory  for  the  purpose  of  resolving path name
1143       searches. The root directory of a process need not be the  root  direc‐
1144       tory of the root file system.
1145
1146   Saved Resource Limits
1147       Saved  resource  limits is an attribute of a process that provides some
1148       flexibility in the handling  of  unrepresentable  resource  limits,  as
1149       described in the exec family of functions and setrlimit(2).
1150
1151   Saved User ID and Saved Group ID
1152       The  saved  user ID and saved group ID are the values of the  effective
1153       user ID and effective group ID just after an exec of a file  whose  set
1154       user or set group file mode bit has been set (see exec(2)).
1155
1156   Semaphore Identifier
1157       A semaphore identifier (semid) is a unique positive  integer created by
1158       a semget(2) call. Each semid has a set of semaphores and a data  struc‐
1159       ture  associated with it. The data structure is referred to as semid_ds
1160       and contains the following members:
1161
1162         struct ipc_perm   sem_perm;    /* operation permission struct */
1163         struct sem        *sem_base;   /* ptr to first semaphore in set */
1164         ushort_t          sem_nsems;   /* number of sems in set */
1165         time_t            sem_otime;   /* last operation time */
1166         time_t            sem_ctime;   /* last change time */
1167                                        /* Times measured in secs since */
1168                                        /* 00:00:00 GMT, Jan. 1, 1970 */
1169
1170
1171
1172       The following are descriptions of the semid_ds structure members:
1173
1174
1175       The sem_perm member is an ipc_perm structure that specifies  the  sema‐
1176       phore  operation  permission  (see  below). This structure includes the
1177       following members:
1178
1179         uid_t     uid;    /* user id */
1180         gid_t     gid;    /* group id */
1181         uid_t     cuid;   /* creator user id */
1182         gid_t     cgid;   /* creator group id */
1183         mode_t    mode;   /* r/a permission */
1184         ulong_t   seq;    /* slot usage sequence number */
1185         key_t     key;    /* key */
1186
1187
1188
1189       The sem_nsems member is equal to the number of semaphores in  the  set.
1190       Each  semaphore  in  the  set  is  referenced  by a nonnegative integer
1191       referred to as a sem_num. sem_num values run sequentially from 0 to the
1192       value of sem_nsems minus 1.
1193
1194
1195       The sem_otime member is the time of the last semop(2) operation.
1196
1197
1198       The  sem_ctime  member is the time of the last semctl(2) operation that
1199       changed a member of the above structure.
1200
1201
1202       A semaphore is a data structure called sem that contains the  following
1203       members:
1204
1205         ushort_t   semval;    /* semaphore value */
1206         pid_t      sempid;    /* pid of last operation  */
1207         ushort_t   semncnt;   /* # awaiting semval > cval */
1208         ushort_t   semzcnt;   /* # awaiting semval = 0 */
1209
1210
1211
1212       The following are descriptions of the sem structure members:
1213
1214
1215       The semval member is a non-negative integer that is the actual value of
1216       the semaphore.
1217
1218
1219       The sempid member is equal to the process ID of the last  process  that
1220       performed a semaphore operation on this semaphore.
1221
1222
1223       The  semncnt member is a count of the number of processes that are cur‐
1224       rently suspended awaiting this semaphore's  semval  to  become  greater
1225       than its current value.
1226
1227
1228       The  semzcnt member is a count of the number of processes that are cur‐
1229       rently suspended awaiting this semaphore's semval to become 0.
1230
1231   Semaphore Operation Permissions
1232       In the semop(2) and semctl(2)  function  descriptions,  the  permission
1233       required  for an operation is given as {token}, where token is the type
1234       of permission needed interpreted as follows:
1235
1236         00400       READ by user
1237         00200   ALTER by user
1238         00040   READ by group
1239         00020   ALTER by group
1240         00004   READ by others
1241         00002   ALTER by others
1242
1243
1244
1245       Read and alter permissions for a semid are granted to a process if  one
1246       or more of the following are true:
1247
1248           o      The {PRIV_IPC_DAC_READ} or {PRIV_IPC_DAC_WRITE} privilege is
1249                  present in the effective set.
1250
1251           o      The effective user ID of the process  matches  sem_perm.cuid
1252                  or  sem_perm.uid in the data structure associated with semid
1253                  and the appropriate bit of  the  "user"  portion  (0600)  of
1254                  sem_perm.mode is set.
1255
1256           o      The  effective group ID of the process matches sem_perm.cgid
1257                  or sem_perm.gid and the appropriate bit of the "group"  por‐
1258                  tion (060) of sem_perm.mode is set.
1259
1260           o      The   appropriate   bit  of  the  "other"  portion  (06)  of
1261                  sem_perm.mode is set.
1262
1263
1264       Otherwise, the corresponding permissions are denied.
1265
1266   Session
1267       A session is a group of processes identified by a common  ID  called  a
1268       session   ID,  capable  of establishing a connection with a controlling
1269       terminal.   Any process that is not a process group leader may create a
1270       new session  and process group, becoming the session leader of the ses‐
1271       sion and process group leader of the process group.   A  newly  created
1272       process joins the session of its creator.
1273
1274   Session ID
1275       Each  session  in the system is uniquely identified during its lifetime
1276       by  a positive integer called a session ID, the process ID of its  ses‐
1277       sion leader.
1278
1279   Session Leader
1280       A  session  leader  is  a  process  whose session ID is the same as its
1281       process and process group ID.
1282
1283   Session Lifetime
1284       A session lifetime begins when the session is created  by  its  session
1285       leader, and ends when the lifetime of the last process that is a member
1286       of the session ends, or when the last process that is a member  in  the
1287       session leaves the session.
1288
1289   Shared Memory Identifier
1290       A shared memory identifier (shmid) is a unique positive integer created
1291       by a shmget(2) call. Each shmid has a segment of memory (referred to as
1292       a shared memory segment) and a data structure associated with it. (Note
1293       that these shared memory segments must be  explicitly  removed  by  the
1294       user  after  the last reference to them is removed.) The data structure
1295       is referred to as shmid_ds and contains the following members:
1296
1297         struct ipc_perm   shm_perm;     /* operation permission struct */
1298         size_t            shm_segsz;    /* size of segment */
1299         struct anon_map   *shm_amp;     /* ptr to region structure */
1300         char              pad[4];       /* for swap compatibility */
1301         pid_t             shm_lpid;     /* pid of last operation */
1302         pid_t             shm_cpid;     /* creator pid */
1303         shmatt_t          shm_nattch;   /* number of current attaches */
1304         ulong_t           shm_cnattch;  /* used only for shminfo */
1305         time_t            shm_atime;    /* last attach time */
1306         time_t            shm_dtime;    /* last detach time */
1307         time_t            shm_ctime;    /* last change time */
1308                                         /* Times measured in secs since */
1309                                         /* 00:00:00 GMT, Jan. 1, 1970 */
1310
1311
1312
1313       The following are descriptions of the shmid_ds structure members:
1314
1315
1316       The shm_perm member is an ipc_perm structure that specifies the  shared
1317       memory  operation  permission  (see below). This structure includes the
1318       following members:
1319
1320         uid_t     cuid;   /* creator user id */
1321         gid_t     cgid;   /* creator group id */
1322         uid_t     uid;    /* user id */
1323         gid_t     gid;    /* group id */
1324         mode_t    mode;   /* r/w permission */
1325         ulong_t   seq;    /* slot usage sequence # */
1326         key_t     key;    /* key */
1327
1328
1329
1330       The shm_segsz member specifies the size of the shared memory segment in
1331       bytes.
1332
1333
1334       The  shm_cpid  member is the process ID of the process that created the
1335       shared memory identifier.
1336
1337
1338       The shm_lpid member is the process ID of the  last  process  that  per‐
1339       formed a shmat() or shmdt() operation (see shmop(2)).
1340
1341
1342       The  shm_nattch  member  is the number of processes that currently have
1343       this segment attached.
1344
1345
1346       The shm_atime member is the time of the  last  shmat()  operation  (see
1347       shmop(2)).
1348
1349
1350       The  shm_dtime  member  is  the time of the last shmdt() operation (see
1351       shmop(2)).
1352
1353
1354       The shm_ctime member is the time of the last shmctl(2)  operation  that
1355       changed one of the members of the above structure.
1356
1357   Shared Memory Operation Permissions
1358       In the shmctl(2), shmat(), and shmdt() (see shmop(2)) function descrip‐
1359       tions, the permission required for an operation is  given  as  {token},
1360       where token is the type of permission needed interpreted as follows:
1361
1362         00400   READ by user
1363         00200   WRITE by user
1364         00040   READ by group
1365         00020   WRITE by group
1366         00004   READ by others
1367         00002   WRITE by others
1368
1369
1370
1371       Read  and write permissions for a shmid are granted to a process if one
1372       or more of the following are true:
1373
1374           o      The {PRIV_IPC_DAC_READ} or {PRIV_IPC_DAC_WRITE} privilege is
1375                  present in the effective set.
1376
1377           o      The  effective  user ID of the process matches shm_perm.cuid
1378                  or shm_perm.uid in the data structure associated with  shmid
1379                  and  the  appropriate  bit  of  the "user" portion (0600) of
1380                  shm_perm.mode is set.
1381
1382           o      The effective group ID of the process matches  shm_perm.cgid
1383                  or  shm_perm.gid and the appropriate bit of the "group" por‐
1384                  tion (060) of shm_perm.mode is set.
1385
1386           o      The  appropriate  bit  of  the  "other"  portion   (06)   of
1387                  shm_perm.mode is set.
1388
1389
1390       Otherwise, the corresponding permissions are denied.
1391
1392   Special Processes
1393       The  process  with ID 0 and the process with ID 1 are special processes
1394       referred to as proc0 and proc1;  see  kill(2).  proc0  is  the  process
1395       scheduler.  proc1  is  the  initialization process (init); proc1 is the
1396       ancestor of every other process in the system and is  used  to  control
1397       the process structure.
1398
1399   STREAMS
1400       A set of kernel mechanisms that support the development of network ser‐
1401       vices and data communication drivers. It  defines  interface  standards
1402       for character input/output within the kernel and between the kernel and
1403       user level processes. The STREAMS mechanism is composed of utility rou‐
1404       tines, kernel facilities and a set of data structures.
1405
1406   Stream
1407       A  stream  is a full-duplex data path within the kernel  between a user
1408       process and driver routines. The primary components are a stream  head,
1409       a  driver, and zero or more modules between the stream head and driver.
1410       A stream is analogous to a shell pipeline, except that  data  flow  and
1411       processing are bidirectional.
1412
1413   Stream Head
1414       In a stream, the stream head is the end of the stream that provides the
1415       interface between the stream and a user process.  The  principal  func‐
1416       tions  of  the  stream head are processing STREAMS-related system calls
1417       and passing data and information between a user process and the stream.
1418
1419   Upstream
1420       In a stream, the direction from driver to stream head.
1421
1422   Write Queue
1423       In a stream, the message queue in a module or  driver  containing  mes‐
1424       sages moving downstream.
1425

ACKNOWLEDGMENTS

1427       Sun  Microsystems, Inc. gratefully acknowledges The Open Group for per‐
1428       mission to reproduce portions of its copyrighted documentation.  Origi‐
1429       nal  documentation  from  The  Open  Group  can  be  obtained online at
1430       http://www.opengroup.org/bookstore/.
1431
1432
1433       The Institute of Electrical and  Electronics  Engineers  and  The  Open
1434       Group, have given us permission to reprint portions of their documenta‐
1435       tion.
1436
1437
1438       In the following statement, the phrase ``this text'' refers to portions
1439       of the system documentation.
1440
1441
1442       Portions  of  this text are reprinted and reproduced in electronic form
1443       in the SunOS Reference Manual, from  IEEE  Std  1003.1,  2004  Edition,
1444       Standard for Information Technology -- Portable Operating System Inter‐
1445       face (POSIX), The Open Group Base Specifications Issue 6, Copyright (C)
1446       2001-2004 by the Institute of Electrical and Electronics Engineers, Inc
1447       and The Open Group.  In the event of any discrepancy between these ver‐
1448       sions  and  the original IEEE and The Open Group Standard, the original
1449       IEEE and The Open Group Standard is the referee document.  The original
1450       Standard     can     be    obtained    online    at    http://www.open
1451       group.org/unix/online.html.
1452
1453
1454       This notice shall appear on any product containing this material.
1455

SEE ALSO

1457       standards(5), threads(5)
1458
1459
1460
1461SunOS 5.11                        17 Nov 2008                         Intro(2)
Impressum