1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 /* LINTLIBRARY */
28 /* PROTOLIB1 */
29
30 #define __EXTENSIONS__
31
32 #include <aio.h>
33 #include <alloca.h>
34 #include <attr.h>
35 #include <atomic.h>
36 #include <ctype.h>
37 #include <deflt.h>
38 #include <dirent.h>
39 #include <dlfcn.h>
40 #include <door.h>
41 #include <err.h>
42 #include <sys/errno.h>
43 #include <euc.h>
44 #include <fcntl.h>
45 #include <float.h>
46 #include <fmtmsg.h>
47 #include <fnmatch.h>
48 #include <ftw.h>
49 #include <glob.h>
50 #include <getwidth.h>
51 #include <grp.h>
52 #include <iconv.h>
53 #include <langinfo.h>
54 #include <libgen.h>
55 #include <libw.h>
56 #include <locale.h>
57 #include <memory.h>
58 #include <mon.h>
59 #include <mqueue.h>
60 #include <nan.h>
61 #include <ndbm.h>
62 #include <limits.h>
63 #include <nl_types.h>
64 #include <poll.h>
65 #include <project.h>
66 #include <priv.h>
67 #include <pwd.h>
68 #include <rctl.h>
69 #include <regex.h>
70 #include <rpcsvc/ypclnt.h>
71 #include <sched.h>
72 #include <search.h>
73 #include <semaphore.h>
74 #include <setjmp.h>
75 #include <shadow.h>
76 #include <siginfo.h>
77 #include <signal.h>
78 #include <stdarg.h>
79 #include <ucred.h>
80 #include <sys/ucred.h>
81 #include <unistd.h>
82 #include <ulimit.h>
83 #include <utime.h>
84 #include <stddef.h>
85 #include <stdio.h>
86 #include <stdlib.h>
87 #include <string.h>
88 #include <stropts.h>
89 #include <synch.h>
90 #include <sys/acctctl.h>
91 #include <sys/acl.h>
92 #include <sys/asynch.h>
93 #include <sys/byteorder.h>
94 #include <sys/cladm.h>
95 #include <sys/corectl.h>
96 #include <sys/dl.h>
97 #include <sys/exacct.h>
98 #include <sys/fcntl.h>
99 #include <sys/file.h>
100 #include <sys/fs/namenode.h>
101 #include <sys/instance.h>
102 #include <sys/ipc.h>
103 #include <sys/lwp.h>
104 #include <sys/mkdev.h>
105 #include <sys/mman.h>
106 #include <sys/mnttab.h>
107 #include <sys/mount.h>
108 #include <sys/msg.h>
109 #include <sys/param.h>
110 #include <sys/priocntl.h>
111 #include <sys/procset.h>
112 #include <sys/processor.h>
113 #include <sys/pset.h>
114 #include <sys/rctl_impl.h>
115 #include <sys/sem.h>
116 #include <sys/shm.h>
117 #include <sys/sid.h>
118 #include <sys/signal.h>
119 #include <sys/stat.h>
120 #include <sys/statvfs.h>
121 #include <sys/strlog.h>
122 #include <sys/stropts.h>
123 #include <sys/syscall.h>
124 #include <sys/sysconfig.h>
125 #include <sys/syslog.h>
126 #include <sys/systeminfo.h>
127 #include <sys/task.h>
128 #include <sys/termio.h>
129 #include <sys/termios.h>
130 #include <sys/u8_textprep.h>
131 #include <sys/time.h>
132 #include <sys/timeb.h>
133 #include <sys/times.h>
134 #include <sys/types.h>
135 #include <sys/uadmin.h>
136 #include <sys/utsname.h>
137 #include <sys/vfstab.h>
138 #include <sys/sendfile.h>
139 #include <sys/zone.h>
140 #include <termio.h>
141 #include <time.h>
142 #include <tzfile.h>
143 #include <ucontext.h>
144 #include <utmpx.h>
145 #include <values.h>
146 #include <wait.h>
147 #include <wchar.h>
148 #include <wctype.h>
149 #include <widec.h>
150 #include <wordexp.h>
151 #include <thread.h>
152 #include <pthread.h>
153 #include <schedctl.h>
154 #include <zone.h>
155 #include <port.h>
156 #include <spawn.h>
157 #include <inttypes.h>
158 #include <getopt.h>
159 #include <stdio_ext.h>
160 #if defined(__i386)
161 #include <sys/sysi86.h>
162 #endif
163 #if defined(__amd64)
164 #include <stack_unwind.h>
165 #endif
166
167 /*
168 * This really comes from the crt*.s startup modules.
169 */
170 char **environ;
171
172 /*
173 * This is a GNU/Linux/BSD compatibility interface,
174 * not declared in any header file.
175 */
176 const char *__progname;
177
178 /*
179 * POSIX versions of standard libc routines; these aren't extracted
180 * from the headers above since we cannot #define _POSIX_C_SOURCE.
181 */
182 int __posix_readdir_r(DIR * _RESTRICT_KYWD, struct dirent * _RESTRICT_KYWD,
183 struct dirent ** _RESTRICT_KYWD);
184 int __posix_getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
185 int __posix_getgrnam_r(const char *, struct group *, char *, size_t,
186 struct group **);
187 int __posix_getpwuid_r(uid_t, struct passwd *, char *, size_t,
188 struct passwd **);
189 int __posix_getpwnam_r(const char *, struct passwd *, char *, size_t,
190 struct passwd **);
191 int __posix_sigwait(const sigset_t * _RESTRICT_KYWD, int * _RESTRICT_KYWD);
192 char *__posix_asctime_r(const struct tm *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
193 char *__posix_ctime_r(const time_t *, char *);
194 int __posix_ttyname_r(int, char *, size_t);
195 int __posix_getlogin_r(char *, int);
196
197 /*
198 * XPG4 versions of standard libc routines; these aren't extracted
199 * from the headers above since we cannot #define _XPG4_2.
200 */
201 int __xpg4_putmsg(int, const struct strbuf *, const struct strbuf *, int);
202 int __xpg4_putpmsg(int, const struct strbuf *, const struct strbuf *, int, int);
203
204 /*
205 * These aren't extracted from the headers above because:
206 * - We cannot #define _STRPTIME_DONTZERO
207 * - We cannot #define _XPG5
208 */
209 char *__strptime_dontzero(const char *, const char *, struct tm *);
210 long __sysconf_xpg5(int);
211 wchar_t *__wcstok_xpg5(wchar_t *_RESTRICT_KYWD,
212 const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD);
213 size_t __wcsftime_xpg5(wchar_t *_RESTRICT_KYWD, size_t,
214 const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD);
215 wint_t __fgetwc_xpg5(__FILE *);
216 wint_t __getwc_xpg5(__FILE *);
217 wint_t __getwchar_xpg5(void);
218 wint_t __fputwc_xpg5(wint_t, __FILE *);
219 wint_t __putwc_xpg5(wint_t, __FILE *);
220 wint_t __putwchar_xpg5(wint_t);
221 wchar_t *__fgetws_xpg5(wchar_t *_RESTRICT_KYWD, int, __FILE *_RESTRICT_KYWD);
222 int __fputws_xpg5(const wchar_t *_RESTRICT_KYWD, __FILE *_RESTRICT_KYWD);
223 wint_t __ungetwc_xpg5(wint_t, __FILE *);
224
225 /*
226 * /usr/src/lib/libc/port/gen routines
227 */
228
229 /* _ctype.c */
230
231 /* _loc_data.c */
232
233 /* _locale.c */
234
235 /* _set_tab.c */
236 int _set_tab(const char *loc, int cat);
237
238 /* _xftw.c */
239 int _xftw(int ver, const char *path, int (*fn)(), int depth);
240
241 /* a64l.c */
242 long a64l(const char *);
243
244 /* abort.c */
245 void abort(void);
246
247 /* abs.c */
248 int abs(int arg);
249 long labs(long int arg);
250
251 /* assert.c */
252 void _assert(const char *assertion, const char *filename, int line_num);
253 void __assert_c99(const char *assertion, const char *filename, int line_num,
254 const char *funcname);
255
256 /* atexit.c */
257 int atexit(void(*func)());
258 void _exithandle(void);
259
260 /* atof.c */
261 double atof(const char *p);
262
263 /* atoi.c */
264 int atoi(const char *p);
265
266 /* atol.c */
267 long atol(const char *p);
268
269 /* basename.c */
270 char *basename(char *s);
271
272 /* bcmp.c */
273 int bcmp(const void *s1, const void *s2, size_t len);
274
275 /* bcopy.c */
276 void bcopy(const void *s1, void *s2, size_t len);
277
278 /* bsearch.c */
279 void *bsearch(const void *ky, const void *bs, size_t nel,
280 size_t width, int (*compar)());
281
282 /* bzero.c */
283 void bzero(void *sp, size_t len);
284
285 /* calloc.c */
286 void *calloc(size_t num, size_t size);
287
288 /* catclose.c */
289 int catclose(nl_catd catd);
290
291 /* catgets.c */
292 char *catgets(nl_catd catd, int set_num, int msg_num, const char *s);
293
294 /* catopen.c */
295 nl_catd catopen(const char *name, int mode);
296
297 /* cfgetispeed.c */
298 speed_t cfgetispeed(const struct termios *termios_p);
299
300 /* cfgetospeed.c */
301 speed_t cfgetospeed(const struct termios *termios_p);
302
303 /* cfree.c */
304 void cfree(void *p, size_t num, size_t size);
305
306 /* cfsetispeed.c */
307 int cfsetispeed(struct termios *termios_p, speed_t speed);
308
309 /* cfsetospeed.c */
310 int cfsetospeed(struct termios *termios_p, speed_t speed);
311
312 /* cftime.c */
313 int cftime(char *buf, char *format, const time_t *t);
314 int ascftime(char *buf, const char *format, const struct tm *tm);
315
316 /* clock.c */
317 clock_t clock(void);
318
319 /* closedir.c */
320 int closedir(DIR *dirp);
321
322 /* confstr.c */
323 size_t confstr(int name, char *buf, size_t length);
324
325 /* crypt.c */
326 void setkey(const char *key);
327 void encrypt(char *block, int fake);
328 char *crypt(const char *key, const char *salt);
329
330 /* csetlen.c */
331 int csetlen(int cset);
332 int csetcol(int cset);
333
334 /* ctime.c */
335 char *ctime(const time_t *t);
336 char *ctime_r(const time_t *, char *buf, int);
337 char *asctime(const struct tm *t);
338 char *asctime_r(const struct tm *, char *, int);
339
340 /* ctypefcns.c */
341 int isalpha(int c);
342 int isupper(int c);
343 int islower(int c);
344 int isdigit(int c);
345 int isxdigit(int c);
346 int isalnum(int c);
347 int isspace(int c);
348 int ispunct(int c);
349 int isprint(int c);
350 int isgraph(int c);
351 int iscntrl(int c);
352 int isascii(int c);
353 int _toupper(int c);
354 int _tolower(int c);
355 int toascii(int c);
356
357 /* daemon.c */
358 int daemon(int nochdir, int noclose);
359
360 /* directio.c */
361 int directio(int filedes, int advice);
362
363 /* dirname.c */
364 char *dirname(char *s);
365
366 /* div.c */
367 div_t div(int numer, int denom);
368 ldiv_t ldiv(long int numer, long int denom);
369
370 /* drand48.c */
371 double drand48(void);
372 double erand48(unsigned short *xsubi);
373 long krand48(unsigned short *xsubi, unsigned int m);
374 long lrand48(void);
375 long mrand48(void);
376 void srand48(long seedval);
377 unsigned short *seed48(unsigned short seed16v[3]);
378 void lcong48(unsigned short param[7]);
379 long nrand48(unsigned short *xsubi);
380 long jrand48(unsigned short *xsubi);
381
382 /* dup2.c */
383 int dup2(int fildes, int fildes2);
384
385 /* ecvt.c */
386 char *ecvt(double value, int ndigit, int *_RESTRICT_KYWD decpt,
387 int *_RESTRICT_KYWDsign);
388 char *fcvt(double value, int ndigit, int *_RESTRICT_KYWD decpt,
389 int *_RESTRICT_KYWD sign);
390
391 /* err.c */
392 void _errfp(FILE *, int, const char *, ...);
393 void _verrfp(FILE *, int, const char *, va_list);
394 void _errxfp(FILE *, int, const char *, ...);
395 void _verrxfp(FILE *, int, const char *, va_list);
396 void _warnfp(FILE *, const char *, ...);
397 void _vwarnfp(FILE *, const char *, va_list);
398 void _warnxfp(FILE *, const char *, ...);
399 void _vwarnxfp(FILE *, const char *, va_list);
400
401 /* errlst.c */
402
403 /* euclen.c */
404 int euccol(const unsigned char *s);
405 int euclen(const unsigned char *s);
406 int eucscol(const unsigned char *s);
407
408 /* execvp.c */
409 /* VARARGS1 */
410 int execlp(const char *, const char *, ...);
411 int execvp(const char *name, char *const *argv);
412
413 /* fattach.c */
414 int fattach(int fildes, const char *path);
415
416 /* fdetach.c */
417 int fdetach(const char *path);
418
419 /* ffs.c */
420 int ffs(int field);
421
422 /* fmtmsg.c */
423 int addseverity(int value, const char *string);
424 int fmtmsg(long class, const char *label, int severity, const char *text,
425 const char *action, const char *tag);
426
427 /* ftime.c */
428 int ftime(struct timeb *tp);
429
430 /* ftok.c */
431 key_t ftok(const char *path, int id);
432
433 /* gcvt.c */
434 char *gcvt(double number, int ndigit, char *buf);
435
436 /* getcwd.c */
437 char *getcwd(char *str, size_t size);
438
439 /* getdate.c */
440 struct tm *getdate(const char *expression);
441 #ifdef getdate_err
442 #undef getdate_err
443 #endif
444 int getdate_err;
445
446 /* getdate_data.c */
447
448 /* getdate_gd.c */
449
450 /* getdtblsize.c */
451 int getdtablesize(void);
452
453 /* getenv.c */
454 char *getenv(const char *name);
455
456 /* getexecname.c */
457 const char *getexecname(void);
458
459 /* getgrnam.c */
460 struct group *getgrnam(const char *name);
461 struct group *getgrgid(gid_t gid);
462 struct group *fgetgrent_r(FILE *, struct group *, char *, int);
463 struct group *getgrent_r(struct group *, char *, int);
464 struct group *getgrgid_r(gid_t, struct group *, char *, int);
465 struct group *getgrnam_r(const char *, struct group *, char *, int);
466
467 /* gethostid.c */
468 long gethostid(void);
469
470 /* gethz.c */
471 int gethz(void);
472
473 /* getisax.c */
474 uint_t getisax(uint32_t *, uint_t);
475
476 /* getlogin.c */
477 char *getlogin(void);
478 char *getlogin_r(char *, int);
479
480 /* getmntent.c */
481 int getmntany(FILE *fd, struct mnttab *mgetp, struct mnttab *mrefp);
482 int getmntent(FILE *fd, struct mnttab *mp);
483
484 /* getnetgrent.c */
485 int setnetgrent(const char *grp);
486 int endnetgrent(void);
487 int getnetgrent(char **machinep, char **namep, char **domainp);
488
489 /* getopt.c */
490 int getopt(int argc, char *const *argv, const char *opts);
491
492 /* getopt_long.c */
493 int getopt_clip(int argc, char *const *argv, const char *optstring,
494 const struct option *long_options, int *long_index);
495 int getopt_long(int argc, char *const *argv, const char *optstring,
496 const struct option *long_options, int *long_index);
497 int getopt_long_only(int argc, char *const *argv, const char *optstring,
498 const struct option *long_options, int *long_index);
499
500 /* getpagesize.c */
501 int getpagesize(void);
502
503 /* getpw.c */
504 int getpw(uid_t uid, char *buf);
505
506 /* getpwnam.c */
507 struct passwd *getpwnam(const char *name);
508 struct passwd *getpwuid(uid_t uid);
509 struct passwd *fgetpwent_r(FILE *, struct passwd *, char *, int);
510 struct passwd *getpwent_r(struct passwd *, char *, int);
511 struct passwd *getpwnam_r(const char *, struct passwd *, char *, int);
512 struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int);
513
514 /* getrusage.c */
515 int getrusage(int who, struct rusage *rusage);
516
517 /* gettimeofday.c */
518 int gettimeofday(struct timeval *_RESTRICT_KYWD tp, void *_RESTRICT_KYWD);
519
520 /* getspent.c */
521 void setspent(void);
522 void endspent(void);
523 struct spwd *getspent(void);
524 struct spwd *getspent_r(struct spwd *, char *, int);
525 struct spwd *fgetspent(FILE *f);
526 struct spwd *fgetspent_r(FILE *, struct spwd *, char *, int);
527 struct spwd *getspnam(const char *name);
528 struct spwd *getspnam_r(const char *, struct spwd *, char *, int);
529 int putspent(const struct spwd *p, FILE *f);
530
531 /* getspent_r.c */
532 int str2spwd(const char *, int, void *, char *, int);
533
534 /* getsubopt.c */
535 int getsubopt(char **optionsp, char *const *tokens, char **valuep);
536
537 /* gettxt.c */
538 char *gettxt(const char *msg_id, const char *dflt_str);
539
540 /* getusershell.c */
541 char *getusershell(void);
542 void endusershell(void);
543 void setusershell(void);
544
545 /* getut.c */
546 struct utmp *getutent(void);
547 struct utmp *getutid(const struct utmp *entry);
548 struct utmp *getutline(const struct utmp *entry);
549 struct utmp *pututline(const struct utmp *entry);
550 void setutent(void);
551 void endutent(void);
552 int utmpname(const char *newfile);
553 void updwtmp(const char *file, struct utmp *ut);
554 void getutmp(const struct utmpx *utx, struct utmp *ut);
555 void getutmpx(const struct utmp *ut, struct utmpx *utx);
556 struct utmp *makeut(struct utmp *utmp);
557
558 /* getutx.c */
559 struct utmpx *getutxent(void);
560 struct utmpx *getutxid(const struct utmpx *entry);
561 struct utmpx *getutxline(const struct utmpx *entry);
562 struct utmpx *pututxline(const struct utmpx *entry);
563 void setutxent(void);
564 void endutxent(void);
565 int utmpxname(const char *newfile);
566 void updwtmpx(const char *filex, struct utmpx *utx);
567 struct utmpx *makeutx(const struct utmpx *utmp);
568 struct utmpx *modutx(const struct utmpx *utp);
569
570 /* getvfsent.c */
571 int getvfsspec(FILE *fd, struct vfstab *vp, char *special);
572 int getvfsfile(FILE *fd, struct vfstab *vp, char *mountp);
573 int getvfsany(FILE *fd, struct vfstab *vgetp, struct vfstab *vrefp);
574 int getvfsent(FILE *fd, struct vfstab *vp);
575
576 /* getwd.c */
577 char *getwd(char *pathname);
578
579 /* getwidth.c */
580 void getwidth(eucwidth_t *eucstruct);
581
582 /* hsearch.c */
583 int hcreate(size_t size);
584 void hdestroy(void);
585 ENTRY *hsearch(ENTRY item, ACTION action);
586
587 /* iconv.c */
588 size_t iconv(iconv_t cd, const char **_RESTRICT_KYWD inbuf,
589 size_t *_RESTRICT_KYWD inbytesleft, char **_RESTRICT_KYWD outbuf,
590 size_t *_RESTRICT_KYWD outbytesleft);
591 int iconv_close(iconv_t cd);
592 iconv_t iconv_open(const char *tocode, const char *fromcode);
593
594 /* imaxabs.c */
595 intmax_t imaxabs(intmax_t j);
596
597 /* imaxdiv.c */
598 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
599
600 /* index.c */
601 char *index(const char *sp, int c);
602
603 /* initgroups.c */
604 int initgroups(const char *uname, gid_t agroup);
605
606 /* innetgr.c */
607 int innetgr(const char *group, const char *machine, const char *name,
608 const char *domain);
609
610 /* insque.c */
611 void insque(void *elem, void *pred);
612 void remque(void *elem);
613
614 /* isaexec.c */
615 int isaexec(const char *, char *const *, char *const *);
616
617 /* isastream.c */
618 int isastream(int fd);
619
620 /* isatty.c */
621 int isatty(int f);
622
623 /* killpg.c */
624 int killpg(pid_t pgrp, int sig);
625
626 /* l64a.c */
627 char *l64a(long lg);
628
629 /* lckpwdf.c */
630 int lckpwdf(void);
631 int ulckpwdf(void);
632
633 /* lfind.c */
634 void * lfind(const void *ky, const void *bs, size_t *nelp,
635 size_t width, int (*compar)());
636
637 /* localeconv.c */
638 struct lconv *localeconv(void);
639
640 /* lsearch.c */
641 void * lsearch(const void *ky, void *bs, size_t *nelp,
642 size_t width, int (*compar)());
643
644 /* madvise.c */
645 int madvise(caddr_t addr, size_t len, int advice);
646
647 /* malloc.c */
648 void *malloc(size_t size);
649 void *realloc(void *old, size_t size);
650 void free(void *old);
651
652 /* mbstowcs.c */
653 size_t mbstowcs(wchar_t *_RESTRICT_KYWD pwcs, const char *_RESTRICT_KYWD s,
654 size_t n);
655
656 /* mbtowc.c */
657 int mbtowc(wchar_t *_RESTRICT_KYWD wchar, const char *_RESTRICT_KYWD s,
658 size_t n);
659 int mblen(const char *s, size_t n);
660
661 /* memalign.c */
662 void *memalign(size_t align, size_t nbytes);
663
664 /* memccpy.c */
665 void *memccpy(void *_RESTRICT_KYWDs, const void *_RESTRICT_KYWD s0, int c,
666 size_t n);
667
668 /* memchr.c */
669 void *memchr(const void *sptr, int c1, size_t n);
670
671 /* memcmp.c */
672 int memcmp(const void *s1, const void *s2, size_t n);
673
674 /* memcpy.c */
675 void *memcpy(void *_RESTRICT_KYWD s, const void *_RESTRICT_KYWD s0, size_t n);
676
677 /* memmove.c */
678 void *memmove(void *s, const void *s0, size_t n);
679
680 /* memset.c */
681 void *memset(void *sp1, int c, size_t n);
682
683 /* mkdev.c */
684 dev_t __makedev(const int version, const major_t majdev,
685 const minor_t mindev);
686 major_t __major(const int version, const dev_t devnum);
687 minor_t __minor(const int version, const dev_t devnum);
688
689 /* mkfifo.c */
690 int mkfifo(const char *path, mode_t mode);
691
692 /* mktemp.c */
693 char *mktemp(char *as);
694
695 /* mlock.c */
696 int mlock(caddr_t addr, size_t len);
697
698 /* mlockall.c */
699 int mlockall(int flags);
700
701 /* mon.c */
702 void monitor(int (*alowpc)(), int (*ahighpc)(), WORD *buffer,
703 size_t bufsize, size_t nfunc);
704
705 /* msync.c */
706 int msync(caddr_t addr, size_t len, int flags);
707
708 /* munlock.c */
709 int munlock(caddr_t addr, size_t len);
710
711 /* munlockall.c */
712 int munlockall(void);
713
714 /* ndbm.c */
715 void dbm_setdefwrite(DBM *db);
716 int dbm_flush(DBM *db);
717 int dbm_flushpag(DBM *db);
718 DBM *dbm_open(const char *file, int flags, mode_t mode);
719 void dbm_close(DBM *db);
720 int dbm_close_status(DBM *db);
721 datum dbm_fetch(DBM *db, datum key);
722 int dbm_delete(DBM *db, datum key);
723 int dbm_store(DBM *db, datum key, datum dat, int replace);
724 datum dbm_firstkey(DBM *db);
725 datum dbm_nextkey(DBM *db);
726 datum dbm_do_nextkey(DBM *db, datum inkey);
727
728 /* new_list.c */
729
730 /* nftw.c */
731 int nftw(const char *path, int (*fn)(), int depth, int flags);
732
733 /* nl_langinfo.c */
734 char *nl_langinfo(nl_item item);
735
736 /* opendir.c */
737 DIR *opendir(const char *filename);
738
739 /* opt_data.c */
740
741 /* perror.c */
742 void perror(const char *s);
743
744 /* psiginfo.c */
745 void psiginfo(siginfo_t *sip, char *s);
746
747 /* psignal.c */
748 void psignal(int sig, const char *s);
749
750 /* pt.c */
751 char *ptsname(int fd);
752 int unlockpt(int fd);
753 int grantpt(int fd);
754
755 /* putenv.c */
756 int putenv(char *change);
757 int setenv(const char *envname, const char *envval, int overwrite);
758 int unsetenv(const char *name);
759
760 /* putpwent.c */
761 int putpwent(const struct passwd *p, FILE *f);
762
763 /* qsort.c */
764 void qsort(void *base, size_t n, size_t size, int (*compar)());
765
766 /* raise.c */
767 int raise(int sig);
768
769 /* rand.c */
770 void srand(unsigned x);
771 int rand(void);
772 int rand_r(unsigned int *);
773
774 /* random.c */
775 void srandom(unsigned x);
776 char *initstate(unsigned seed, char *arg_state, size_t n);
777 char *setstate(const char *arg_state);
778 long random(void);
779
780 /* rctlops.c */
781 int rctl_walk(int (*callback)(const char *, void *), void *walk_data);
782 hrtime_t rctlblk_get_firing_time(rctlblk_t *rblk);
783 uint_t rctlblk_get_global_action(rctlblk_t *rblk);
784 uint_t rctlblk_get_global_flags(rctlblk_t *rblk);
785 uint_t rctlblk_get_local_action(rctlblk_t *rblk, int *signalp);
786 uint_t rctlblk_get_local_flags(rctlblk_t *rblk);
787 id_t rctlblk_get_recipient_pid(rctlblk_t *rblk);
788 rctl_priv_t rctlblk_get_privilege(rctlblk_t *rblk);
789 rctl_qty_t rctlblk_get_value(rctlblk_t *rblk);
790 void rctlblk_set_local_action(rctlblk_t *rblk, uint_t action, int signal);
791 void rctlblk_set_local_flags(rctlblk_t *rblk, uint_t flags);
792 void rctlblk_set_privilege(rctlblk_t *rblk, rctl_priv_t priv);
793 void rctlblk_set_value(rctlblk_t *rblk, rctl_qty_t val);
794 size_t rctlblk_size(void);
795
796 /* readdir.c */
797 struct dirent *readdir(DIR *dirp);
798
799 /* realpath.c */
800 char *realpath(const char *_RESTRICT_KYWD raw, char *_RESTRICT_KYWD canon);
801
802 /* regexpr.c */
803 char *re_comp(const char *sp);
804 int re_exec(const char *p1);
805
806 /* rindex.c */
807 char *rindex(const char *sp, int c);
808
809 /* rename.c */
810 int remove(const char *filename);
811 int rename(const char *old, const char *new);
812
813 /* rewinddir.c */
814 #undef rewinddir
815 void rewinddir(DIR *dirp);
816
817 /* scandir.c */
818 int alphasort(const struct dirent **, const struct dirent **);
819 int scandir(const char *dirname, struct dirent *(*namelist[]),
820 int (*select)(const struct dirent *),
821 int (*dcomp)(const struct dirent **, const struct dirent **));
822
823 /* scrwidth.c */
824 int scrwidth(wchar_t c);
825
826 /* seekdir.c */
827 void seekdir(DIR *dirp, long loc);
828
829 /* select.c */
830 int pselect(int nfds,
831 fd_set *_RESTRICT_KYWD readfds,
832 fd_set *_RESTRICT_KYWD writefds,
833 fd_set *_RESTRICT_KYWD errorfds,
834 const struct timespec *_RESTRICT_KYWD timeout,
835 const sigset_t *_RESTRICT_KYWD sigmask);
836 int select(int nfds,
837 fd_set *_RESTRICT_KYWD readfds,
838 fd_set *_RESTRICT_KYWD writefds,
839 fd_set *_RESTRICT_KYWD errorfds,
840 struct timeval *_RESTRICT_KYWD timeout);
841
842 /* setlocale.c */
843 char *setlocale(int cat, const char *loc);
844
845 /* setpriority.c */
846 int getpriority(int which, id_t who);
847 int setpriority(int which, id_t who, int prio);
848
849 /* settimeofday.c */
850 int settimeofday(struct timeval *tp, void *);
851
852 /* sigflag.c */
853 int sigflag(int sig, int flag, int on);
854
855 /* siglist.c */
856
857 /* sigsend.c */
858 int sigsend(idtype_t idtype, id_t id, int sig);
859
860 /* sigsetops.c */
861 int sigfillset(sigset_t *set);
862 int sigemptyset(sigset_t *set);
863 int sigaddset(sigset_t *set, int sig);
864 int sigdelset(sigset_t *set, int sig);
865 int sigismember(const sigset_t *set, int sig);
866
867 /* scalls.c */
868 unsigned sleep(unsigned sleep_tm);
869
870 /* ssignal.c */
871 int (*ssignal(int sig, int (*fn)())) ();
872 int gsignal(int sig);
873
874 /* str2id.c */
875
876 /* str2sig.c */
877 int str2sig(const char *s, int *sigp);
878 int sig2str(int i, char *s);
879
880 /* strcat.c */
881 char *strcat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
882
883 /* strchr.c */
884 char *strchr(const char *sp, int c);
885
886 /* strcmp.c */
887 int strcmp(const char *s1, const char *s2);
888
889 /* strcpy.c */
890 char *strcpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
891
892 /* strcspn.c */
893 size_t strcspn(const char *string, const char *charset);
894
895 /* strdup.c */
896 char *strdup(const char *s1);
897
898 /* strerror.c */
899 char *strerror(int errnum);
900 int strerror_r(int errnum, char *strerrbuf, size_t buflen);
901
902 /* strftime.c */
903 size_t strftime(char *_RESTRICT_KYWD s, size_t maxsize,
904 const char *_RESTRICT_KYWD format,
905 const struct tm *_RESTRICT_KYWD tm);
906
907 /* strlen.c */
908 size_t strlen(const char *s);
909
910 /* strncat.c */
911 char *strncat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
912
913 /* strncmp.c */
914 int strncmp(const char *s1, const char *s2, size_t n);
915
916 /* strncpy.c */
917 char *strncpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
918
919 /* strpbrk.c */
920 char *strpbrk(const char *string, const char *brkset);
921
922 /* strrchr.c */
923 char *strrchr(const char *sp, int c);
924
925 /* strsep.c */
926 char *strsep(char **stringp, const char *delim);
927
928 /* strspn.c */
929 size_t strspn(const char *string, const char *charset);
930
931 /* strstr.c */
932 char *strstr(const char *as1, const char *as2);
933
934 /* strtod.c */
935 double strtod(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
936 float strtof(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
937 long double strtold(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
938
939 /* strtoimax.c */
940 intmax_t strtoimax(const char *_RESTRICT_KYWD nptr,
941 char **_RESTRICT_KYWD endptr, int base);
942
943 /* strtok.c */
944 char *strtok(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD sepset);
945 char *strtok_r(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
946 char **_RESTRICT_KYWD);
947
948 /* strtol.c */
949 long strtol(const char *_RESTRICT_KYWD str, char **_RESTRICT_KYWD nptr,
950 int base);
951
952 /* strtoul.c */
953 unsigned long strtoul(const char *_RESTRICT_KYWD str,
954 char **_RESTRICT_KYWD nptr, int base);
955
956 /* strtoumax.c */
957 uintmax_t strtoumax(const char *_RESTRICT_KYWD nptr,
958 char **_RESTRICT_KYWD endptr, int base);
959
960 /* strxfrm.c */
961 size_t strxfrm(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2,
962 size_t n);
963 int strcoll(const char *s1, const char *s2);
964
965 /* swab.c */
966 void swab(const char *_RESTRICT_KYWD from, char *_RESTRICT_KYWD to, ssize_t n);
967
968 /* swapctl.c */
969 int swapctl(int cmd, void *arg);
970
971 /* sysconf.c */
972 long sysconf(int name);
973
974 /* syslog.c */
975 /* VARARGS2 */
976 void syslog(int pri, const char *fmt, ...);
977 void vsyslog(int pri, const char *fmt, va_list ap);
978 void openlog(const char *ident, int logstat, int logfac);
979 void closelog(void);
980 int setlogmask(int pmask);
981
982 /* tcdrain.c */
983 int tcdrain(int fildes);
984
985 /* tcflow.c */
986 int tcflow(int fildes, int action);
987
988 /* tcflush.c */
989 int tcflush(int fildes, int queue_selector);
990
991 /* tcgetattr.c */
992 int tcgetattr(int fildes, struct termios *termios_p);
993
994 /* tcgetpgrp.c */
995 pid_t tcgetpgrp(int fd);
996
997 /* tcgetsid.c */
998 pid_t tcgetsid(int fd);
999
1000 /* tcsendbreak.c */
1001 int tcsendbreak(int fildes, int duration);
1002
1003 /* tcsetattr.c */
1004 int tcsetattr(int fildes, int optional_actions,
1005 const struct termios *termios_p);
1006
1007 /* tcsetpgrp.c */
1008 int tcsetpgrp(int fd, pid_t pgrp);
1009
1010 /* tell.c */
1011 long tell(int f);
1012
1013 /* telldir.c */
1014 long telldir(DIR *dirp);
1015
1016 /* tfind.c */
1017 void *tfind(const void *ky, void *const *rtp, int (*compar)());
1018
1019 /* time_comm.c */
1020 struct tm *localtime(const time_t *timep);
1021 struct tm *localtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1022 struct tm *gmtime(const time_t *clock);
1023 struct tm *gmtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1024 double difftime(time_t time1, time_t time0);
1025 time_t mktime(struct tm *timeptr);
1026 void _ltzset(time_t tim);
1027 void tzset(void);
1028
1029 /* time_data.c */
1030
1031 /* time_gdata.c */
1032
1033 /* tolower.c */
1034 int tolower(int c);
1035
1036 /* toupper.c */
1037 int toupper(int c);
1038
1039 /* truncate.c */
1040 int ftruncate(int fildes, off_t len);
1041 int truncate(const char *path, off_t len);
1042
1043 /* tsearch.c */
1044 void *tsearch(const void *ky, void **rtp, int (*compar)());
1045 void *tdelete(const void *ky, void **rtp, int (*compar)());
1046 void twalk(const void *rt, void (*action)());
1047
1048 /* ttyname.c */
1049 char *ttyname(int f);
1050 char *_ttyname_dev(dev_t rdev, char *buffer, size_t buflen);
1051 char *ttyname_r(int, char *, int);
1052
1053 /* ttyslot.c */
1054 int ttyslot(void);
1055
1056 /* ualarm.c */
1057 unsigned ualarm(unsigned usecs, unsigned reload);
1058
1059 /* ulimit.c */
1060 /* VARARGS1 */
1061 long ulimit(int cmd, ...);
1062
1063 /* scalls.c */
1064 int usleep(unsigned n);
1065
1066 /* valloc.c */
1067 void *valloc(size_t size);
1068
1069 /* waitpid.c */
1070 pid_t wait(int *stat_loc);
1071 pid_t waitpid(pid_t pid, int *stat_loc, int options);
1072 pid_t wait3(int *status, int options, struct rusage *rp);
1073 pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
1074
1075 /* wcstombs.c */
1076 size_t wcstombs(char *_RESTRICT_KYWD s, const wchar_t *_RESTRICT_KYWD pwcs,
1077 size_t n);
1078
1079 /* wctomb.c */
1080 int wctomb(char *s, wchar_t wchar);
1081
1082 /* wdata.c */
1083
1084 /* wisprint.c */
1085 int wisprint(wchar_t c);
1086
1087 /* xgetwidth.c */
1088 void _xgetwidth(void);
1089
1090 /*
1091 * /usr/src/lib/libc/port/intl routines
1092 */
1093
1094 /* gettext.c */
1095 char *bindtextdomain(const char *domain, const char *binding);
1096 char *dcgettext(const char *domain, const char *msg_id, const int category);
1097 char *dgettext(const char *domain, const char *msg_id);
1098 char *gettext(const char *msg_id);
1099 char *textdomain(const char *domain);
1100
1101 /*
1102 * /usr/src/lib/libc/port/print routines
1103 */
1104
1105 /* fprintf.c */
1106 /* VARARGS2 */
1107 int fprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format, ...);
1108
1109 /* printf.c */
1110 /* VARARGS1 */
1111 int printf(const char *_RESTRICT_KYWD format, ...);
1112
1113 /* snprintf.c */
1114 /* VARARGS2 */
1115 int snprintf(char *_RESTRICT_KYWD string, size_t n,
1116 const char *_RESTRICT_KYWD format, ...);
1117
1118 /* sprintf.c */
1119 /* VARARGS2 */
1120 int sprintf(char *_RESTRICT_KYWD string,
1121 const char *_RESTRICT_KYWD format, ...);
1122
1123 /* vfprintf.c */
1124 /* VARARGS2 */
1125 int vfprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format,
1126 va_list);
1127
1128 /* vprintf.c */
1129 /* VARARGS1 */
1130 int vprintf(const char *_RESTRICT_KYWD format, va_list);
1131
1132 /* vsnprintf.c */
1133 /* VARARGS2 */
1134 int vsnprintf(char *_RESTRICT_KYWD string, size_t n,
1135 const char *_RESTRICT_KYWD format, va_list);
1136
1137 /* vsprintf.c */
1138 /* VARARGS2 */
1139 int vsprintf(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD format,
1140 va_list);
1141
1142 /*
1143 * /usr/src/lib/libc/port/regex routines
1144 */
1145
1146 /* glob.c */
1147 extern int glob(const char *restrict pattern, int flags,
1148 int(*errfunc)(const char *epath, int eerrno), glob_t *restrict pglob);
1149 extern void globfree(glob_t *pglob);
1150
1151 /* regex.c */
1152 char *regex(const char *regexp, const char *stringp, ...);
1153 #ifdef __loc1
1154 #undef __loc1
1155 #endif
1156 char *__loc1;
1157
1158 /* regcmp.c */
1159 char *regcmp(const char *regexp, ...);
1160 #ifdef __i_size
1161 #undef __i_size
1162 #endif
1163 int __i_size;
1164
1165 /*
1166 * /usr/src/lib/libc/port/stdio routines
1167 */
1168
1169 /* _filbuf.c */
1170 int _filbuf(FILE *iop);
1171
1172 /* _flsbuf.c */
1173 int _flsbuf(int ch, FILE *iop);
1174
1175 /* _wrtchk.c */
1176 int _wrtchk(FILE *iop);
1177
1178 /* clearerr.c */
1179 void clearerr(FILE *iop);
1180
1181 /* ctermid.c */
1182 char *ctermid(char *s);
1183 char *ctermid_r(char *s);
1184
1185 /* cuserid.c */
1186 char *cuserid(char *s);
1187
1188 /* data.c */
1189
1190 /* doscan.c */
1191 int _doscan(FILE *iop, const char *fmt, va_list va_alist);
1192
1193 /* fdopen.c */
1194 FILE *fdopen(int fd, const char *type);
1195
1196 /* feof.c */
1197 int feof(FILE *iop);
1198
1199 /* ferror.c */
1200 int ferror(FILE *iop);
1201
1202 /* fgetc.c */
1203 int fgetc(FILE *iop);
1204
1205 /* fgets.c */
1206 char *fgets(char *_RESTRICT_KYWD buf, int size, FILE *_RESTRICT_KYWD iop);
1207
1208 /* fileno.c */
1209 int _fileno(FILE *iop);
1210
1211 /* flush.c */
1212 void _cleanup(void);
1213 FILE *_findiop(void);
1214 typedef unsigned char Uchar;
1215 void _setbufend(FILE *iop, Uchar *end);
1216 Uchar *_realbufend(FILE *iop);
1217 void _bufsync(FILE *iop, Uchar *bufend);
1218 int _xflsbuf(FILE *iop);
1219 int fflush(FILE *iop);
1220 int fclose(FILE *iop);
1221
1222 /* fopen.c */
1223 FILE *fopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type);
1224 FILE *freopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type,
1225 FILE *_RESTRICT_KYWD iop);
1226
1227 /* fpos.c */
1228 int fgetpos(FILE *_RESTRICT_KYWD stream, fpos_t *_RESTRICT_KYWD pos);
1229 int fsetpos(FILE *stream, const fpos_t *pos);
1230
1231 /* fputc.c */
1232 int fputc(int ch, FILE *iop);
1233
1234 /* fputs.c */
1235 int fputs(const char *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1236
1237 /* fread.c */
1238 size_t fread(void *_RESTRICT_KYWD ptr, size_t size, size_t count,
1239 FILE *_RESTRICT_KYWD iop);
1240
1241 /* fseek.c */
1242 int fseek(FILE *iop, long offset, int ptrname);
1243
1244 /* ftell.c */
1245 long ftell(FILE *iop);
1246
1247 /* fwrite.c */
1248 size_t fwrite(const void *_RESTRICT_KYWD ptr1, size_t size, size_t count,
1249 FILE *_RESTRICT_KYWD iop);
1250
1251 /* getc.c */
1252 int getc(FILE *iop);
1253
1254 /* getchar.c */
1255 int getchar(void);
1256
1257 /* getpass.c */
1258 char *getpass(const char *prompt);
1259
1260 /* getpass.c */
1261 char *getpassphrase(const char *prompt);
1262
1263 /* gets.c */
1264 char *gets(char *buf);
1265
1266 /* getw.c */
1267 int getw(FILE *stream);
1268
1269 /* popen.c */
1270 FILE *popen(const char *cmd, const char *mode);
1271 int pclose(FILE *ptr);
1272
1273 /* putc.c */
1274 int putc(int ch, FILE *iop);
1275
1276 /* putchar.c */
1277 int putchar(int ch);
1278
1279 /* puts.c */
1280 int puts(const char *ptr);
1281
1282 /* putw.c */
1283 int putw(int w, FILE *stream);
1284
1285 /* rewind.c */
1286 void rewind(FILE *iop);
1287
1288 /* scanf.c */
1289 /* VARARGS1 */
1290 int scanf(const char *_RESTRICT_KYWD fmt, ...);
1291
1292 /* VARARGS2 */
1293 int fscanf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD fmt, ...);
1294
1295 /* VARARGS2 */
1296 int sscanf(const char *_RESTRICT_KYWD str, const char *_RESTRICT_KYWD fmt, ...);
1297
1298 /* setbuf.c */
1299 void setbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf);
1300
1301 /* setvbuf.c */
1302 int setvbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf, int type,
1303 size_t size);
1304
1305 /* system.c */
1306 int system(const char *s);
1307
1308 /* tempnam.c */
1309 char *tempnam(const char *dir, const char *pfx);
1310
1311 /* tmpfile.c */
1312 FILE *tmpfile(void);
1313
1314 /* tmpnam.c */
1315 char *tmpnam(char *s);
1316 char *tmpnam_r(char *);
1317
1318 /* ungetc.c */
1319 int ungetc(int c, FILE *iop);
1320
1321 /*
1322 * /usr/src/lib/libc/port/sys routines
1323 */
1324
1325 /* exacctsys.c */
1326 size_t getacct(idtype_t idtype, id_t id, void *buf, size_t bufsize);
1327 int putacct(idtype_t idtype, id_t id, void *buf, size_t bufsize, int flags);
1328 int wracct(idtype_t idtype, id_t id, int flags);
1329
1330 /* execl.c */
1331 /* VARARGS1 */
1332 int execl(const char *name, const char *, ...);
1333
1334 /* execle.c */
1335 int execle(const char *, const char *file, ...);
1336
1337 /* execv.c */
1338 int execv(const char *file, char *const *argv);
1339
1340 /* lockf.c */
1341 int lockf(int fildes, int function, off_t size);
1342
1343 /* meminfosys.c */
1344 int meminfo(const uint64_t *inaddr, int addr_count, const uint_t *info_req,
1345 int info_count, uint64_t *outdata, uint_t *validity);
1346
1347 /* msgsys.c */
1348 int msgget(key_t key, int msgflg);
1349 int msgctl(int msqid, int cmd, struct msqid_ds *buf);
1350 ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
1351 int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
1352
1353 /* nfssys.c */
1354 /*
1355 int exportfs(char *dir, struct export *ep);
1356 int nfs_getfh(char *path, fhandle_t *fhp);
1357 int nfssvc(int fd);
1358 */
1359
1360 /* psetsys.c */
1361 int pset_create(psetid_t *npset);
1362 int pset_destroy(psetid_t pset);
1363 int pset_assign(psetid_t pset, processorid_t cpu, psetid_t *opset);
1364 int pset_assign_forced(psetid_t pset, processorid_t cpu, psetid_t *opset);
1365 int pset_info(psetid_t pset, int *type, u_int *numcpus, processorid_t *cpulist);
1366 int pset_bind(psetid_t pset, idtype_t idtype, id_t id, psetid_t *opset);
1367 int pset_bind_lwp(psetid_t pset, id_t id, pid_t, psetid_t *opset);
1368
1369
1370 /* rctlsys.c */
1371 int getrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1372 int flags);
1373 int setrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1374 int flags);
1375 /* (private functions) */
1376 int setprojrctl(const char *name, rctlblk_t *new_rblk, size_t size, int flags);
1377 int rctlctl(const char *, rctlblk_t *, int);
1378 size_t rctllist(char *, size_t);
1379
1380
1381 /* semsys.c */
1382 int semctl(int semid, int semnum, int cmd, ...);
1383 int semget(key_t key, int nsems, int semflg);
1384 int semop(int semid, struct sembuf *sops, size_t nsops);
1385
1386 /* shmsys.c */
1387 void *shmat(int shmid, const void *shmaddr, int shmflg);
1388 int shmctl(int shmid, int cmd, struct shmid_ds *buf);
1389 #if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)
1390 int shmdt(const void *);
1391 #else
1392 int shmdt(char *);
1393 #endif /* defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4) */
1394 int shmget(key_t key, size_t size, int shmflg);
1395
1396 /* tasksys.c */
1397 taskid_t settaskid(projid_t project, uint_t flags);
1398 taskid_t gettaskid(void);
1399 projid_t getprojid(void);
1400
1401 /*
1402 * /usr/src/lib/libc/port/widec routines
1403 */
1404
1405 /* fgetws.c */
1406 wchar_t *fgetws(wchar_t *_RESTRICT_KYWD ptr, int size,
1407 FILE *_RESTRICT_KYWD iop);
1408
1409 /* fputwc.c */
1410 wint_t fputwc(wint_t wc, FILE *iop);
1411 wint_t putwc(wint_t wc, FILE *iop);
1412
1413 /* fputws.c */
1414 int fputws(const wchar_t *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1415
1416 /* getwchar.c */
1417 wint_t getwchar(void);
1418
1419 /* getwidth.c */
1420 void getwidth(eucwidth_t *eucstruct);
1421
1422 /* getws.c */
1423 wchar_t *getws(wchar_t *ptr);
1424
1425 /* iswctype.c */
1426 int iswctype(wint_t wc, wctype_t charclass);
1427 int iswalpha(wint_t c);
1428 int iswupper(wint_t c);
1429 int iswlower(wint_t c);
1430 int iswdigit(wint_t c);
1431 int iswxdigit(wint_t c);
1432 int iswalnum(wint_t c);
1433 int iswspace(wint_t c);
1434 int iswpunct(wint_t c);
1435 int iswprint(wint_t c);
1436 int iswgraph(wint_t c);
1437 int iswcntrl(wint_t c);
1438 int isphonogram(wint_t c);
1439 int isideogram(wint_t c);
1440 int isenglish(wint_t c);
1441 int isnumber(wint_t c);
1442 int isspecial(wint_t c);
1443
1444 /* libwcollate.c */
1445
1446 /* putwchar.c */
1447 wint_t putwchar(wint_t c);
1448
1449 /* putws.c */
1450 int putws(const wchar_t *ptr);
1451
1452 /* scrwidth.c */
1453
1454 /* strtows.c */
1455 wchar_t *strtows(wchar_t *s1, char *s2);
1456 char *wstostr(char *s1, wchar_t *s2);
1457
1458 /* trwctype.c */
1459 wint_t towupper(wint_t c);
1460 wint_t towlower(wint_t c);
1461
1462 /* ungetwc.c */
1463 wint_t ungetwc(wint_t wc, FILE *iop);
1464
1465 /* wcollate.c */
1466 size_t wcsxfrm(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1467 size_t n);
1468 int wcscoll(const wchar_t *s1, const wchar_t *s2);
1469
1470 /* wcsftime.c */
1471 #if !defined(__amd64) /* XX64 - fix me */
1472 size_t wcsftime(wchar_t *wcs, size_t maxsize,
1473 const char *format, const struct tm *timeptr);
1474 #endif /* __amd64 */
1475
1476 /* wcstring.c */
1477 wint_t fgetwc(FILE *iop);
1478 wint_t getwc(FILE *iop);
1479 int wcwidth(wchar_t wc);
1480 int wcswidth(const wchar_t *pwcs, size_t n);
1481
1482 /* wcswcs.c */
1483 wchar_t *wcswcs(const wchar_t *ws1, const wchar_t *ws2);
1484
1485 /* wcsxfrm.c - empty file! */
1486
1487 /* wcsxfrm.xpg4.c */
1488
1489 /* wisprint.c */
1490 int wisprint(wchar_t c);
1491
1492 /* wscasecmp.c */
1493 int wscasecmp(const wchar_t *s1, const wchar_t *s2);
1494
1495 /* wscat.c */
1496 wchar_t *wcscat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1497 wchar_t *wscat(wchar_t *s1, const wchar_t *s2);
1498
1499 /* wschr.c */
1500 wchar_t *wcschr(const wchar_t *sp, wchar_t c);
1501 wchar_t *wschr(const wchar_t *sp, wchar_t c);
1502
1503 /* wscmp.c */
1504 int wcscmp(const wchar_t *s1, const wchar_t *s2);
1505 int wscmp(const wchar_t *s1, const wchar_t *s2);
1506
1507 /* wscol.c */
1508 int wscol(const wchar_t *s1);
1509
1510 /* wscpy.c */
1511 wchar_t *wcscpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1512 wchar_t *wscpy(wchar_t *s1, const wchar_t *s2);
1513
1514 /* wscspn.c */
1515 size_t wcscspn(const wchar_t *string, const wchar_t *charset);
1516 size_t wscspn(const wchar_t *string, const wchar_t *charset);
1517
1518 /* wsdup.c */
1519 wchar_t *wsdup(const wchar_t *s1);
1520
1521 /* wslen.c */
1522 size_t wcslen(const wchar_t *s);
1523 size_t wslen(const wchar_t *s);
1524
1525 /* wsncasecmp.c */
1526 int wsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1527
1528 /* wsncat.c */
1529 wchar_t *wcsncat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1530 size_t n);
1531 wchar_t *wsncat(wchar_t *s1, const wchar_t *s2, size_t n);
1532
1533 /* wsncmp.c */
1534 int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1535 int wsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1536
1537 /* wsncpy.c */
1538 wchar_t *wcsncpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1539 size_t n);
1540 wchar_t *wsncpy(wchar_t *s1, const wchar_t *s2, size_t n);
1541
1542 /* wspbrk.c */
1543 wchar_t *wcspbrk(const wchar_t *string, const wchar_t *brkset);
1544 wchar_t *wspbrk(const wchar_t *string, const wchar_t *brkset);
1545
1546 /* wsprintf.c */
1547 int wsprintf(wchar_t *wstring, const char *format, ...);
1548
1549 /* wsrchr.c */
1550 wchar_t *wcsrchr(const wchar_t *sp, wchar_t c);
1551 wchar_t *wsrchr(const wchar_t *sp, wchar_t c);
1552
1553 /* wsscanf.c */
1554 int wsscanf(wchar_t *s, const char *format, ...);
1555
1556 /* wssize.c */
1557
1558 /* wsspn.c */
1559 size_t wcsspn(const wchar_t *string, const wchar_t *charset);
1560 size_t wsspn(const wchar_t *string, const wchar_t *charset);
1561
1562 /* wstod.c */
1563 double wcstod(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1564 float wcstof(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1565 long double wcstold(const wchar_t *_RESTRICT_KYWD cp,
1566 wchar_t **_RESTRICT_KYWD ptr);
1567 double wstod(const wchar_t *cp, wchar_t **ptr);
1568
1569 /* wstok.c */
1570 #if !defined(__amd64) /* XX64 - fix me */
1571 wchar_t *wcstok(wchar_t *string, const wchar_t *sepset);
1572 wchar_t *wstok(wchar_t *string, const wchar_t *sepset);
1573 #endif /* __amd64 */
1574
1575 /* wcstol.c */
1576 long wcstol(const wchar_t *_RESTRICT_KYWD str, wchar_t **_RESTRICT_KYWD ptr,
1577 int base);
1578 long long wcstoll(const wchar_t *_RESTRICT_KYWD str,
1579 wchar_t **_RESTRICT_KYWD ptr, int base);
1580
1581 /* wcstoul.c */
1582 unsigned long wcstoul(const wchar_t *_RESTRICT_KYWD str,
1583 wchar_t **_RESTRICT_KYWD ptr, int base);
1584 unsigned long long wcstoull(const wchar_t *_RESTRICT_KYWD str,
1585 wchar_t **_RESTRICT_KYWD ptr, int base);
1586
1587 /* wcstoimax.c */
1588 intmax_t wcstoimax(const wchar_t *_RESTRICT_KYWD nptr,
1589 wchar_t **_RESTRICT_KYWD endptr, int base);
1590 uintmax_t wcstoumax(const wchar_t *_RESTRICT_KYWD nptr,
1591 wchar_t **_RESTRICT_KYWD endptr, int base);
1592
1593 /* wstol.c */
1594 long wstol(const wchar_t *str, wchar_t **ptr, int base);
1595
1596 /* wstoll.c */
1597 long long wstoll(const wchar_t *str, wchar_t **ptr, int base);
1598 long long watoll(const wchar_t *p);
1599
1600 /* wsxfrm.c */
1601 size_t wsxfrm(wchar_t *s1, const wchar_t *s2, size_t n);
1602 int wscoll(const wchar_t *s1, const wchar_t *s2);
1603
1604 /*
1605 * /usr/src/lib/libc/port/gen/event_port.c
1606 */
1607 int port_dispatch(int port, int flags, int source, int events, uintptr_t object,
1608 void *user);
1609
1610 /*
1611 * /usr/src/lib/libc/$MACH/gen routines
1612 */
1613
1614 /* alloca.s */
1615
1616 void *__builtin_alloca(size_t);
1617
1618 /*
1619 * modctl(int arg, ...) and utssys(...) are not available from a header
1620 * file, but our utilities which make use of it should be able to be
1621 * lint clean.
1622 */
1623 int modctl(int arg, ...);
1624 int utssys(void *buf, int arg, int type, void *outbp);
1625
1626
1627 typedef float single;
1628 typedef unsigned extended[3];
1629 typedef long double quadruple;
1630 typedef unsigned fp_exception_field_type;
1631
1632 typedef char decimal_string[512];
1633
1634 enum fp_class_type {
1635 fp_zero = 0,
1636 fp_subnormal = 1,
1637 fp_normal = 2,
1638 fp_infinity = 3,
1639 fp_quiet = 4,
1640 fp_signaling = 5
1641 };
1642
1643 enum fp_direction_type {
1644 fp_nearest = 0,
1645 fp_tozero = 1,
1646 fp_positive = 2,
1647 fp_negative = 3
1648 };
1649
1650 typedef struct {
1651 enum fp_class_type fpclass;
1652 int sign;
1653 int exponent;
1654 decimal_string ds;
1655 int more;
1656 int ndigits;
1657 } decimal_record;
1658
1659 enum decimal_form {
1660 fixed_form,
1661 floating_form
1662 };
1663
1664 typedef struct {
1665 enum fp_direction_type rd;
1666 enum decimal_form df;
1667 int ndigits;
1668 } decimal_mode;
1669
1670 enum decimal_string_form {
1671 invalid_form,
1672 whitespace_form,
1673 fixed_int_form,
1674 fixed_intdot_form,
1675 fixed_dotfrac_form,
1676 fixed_intdotfrac_form,
1677 floating_int_form,
1678 floating_intdot_form,
1679 floating_dotfrac_form,
1680 floating_intdotfrac_form,
1681 inf_form,
1682 infinity_form,
1683 nan_form,
1684 nanstring_form
1685 };
1686
1687 typedef int sigfpe_code_type;
1688
1689 typedef void (*sigfpe_handler_type)();
1690
1691 extern sigfpe_handler_type sigfpe(sigfpe_code_type, sigfpe_handler_type);
1692
1693 extern void single_to_decimal(single *, decimal_mode *, decimal_record *,
1694 fp_exception_field_type *);
1695
1696 extern void double_to_decimal(double *, decimal_mode *, decimal_record *,
1697 fp_exception_field_type *);
1698 extern void extended_to_decimal(extended *, decimal_mode *,
1699 decimal_record *, fp_exception_field_type *);
1700 extern void quadruple_to_decimal(quadruple *, decimal_mode *,
1701 decimal_record *, fp_exception_field_type *);
1702 extern void decimal_to_single(single *, decimal_mode *, decimal_record *,
1703 fp_exception_field_type *);
1704 extern void decimal_to_double(double *, decimal_mode *, decimal_record *,
1705 fp_exception_field_type *);
1706 extern void decimal_to_extended(extended *, decimal_mode *,
1707 decimal_record *, fp_exception_field_type *);
1708 extern void decimal_to_quadruple(quadruple *, decimal_mode *,
1709 decimal_record *, fp_exception_field_type *);
1710 extern void string_to_decimal(char **, int, int, decimal_record *,
1711 enum decimal_string_form *, char **);
1712 extern void func_to_decimal(char **, int, int, decimal_record *,
1713 enum decimal_string_form *, char **,
1714 int (*)(void), int *, int (*)(int));
1715 extern void file_to_decimal(char **, int, int, decimal_record *,
1716 enum decimal_string_form *, char **,
1717 FILE *, int *);
1718 extern char *seconvert(single *, int, int *, int *, char *);
1719 extern char *sfconvert(single *, int, int *, int *, char *);
1720 extern char *sgconvert(single *, int, int, char *);
1721 extern char *econvert(double, int, int *, int *, char *);
1722 extern char *fconvert(double, int, int *, int *, char *);
1723 extern char *gconvert(double, int, int, char *);
1724 extern char *qeconvert(quadruple *, int, int *, int *, char *);
1725 extern char *qfconvert(quadruple *, int, int *, int *, char *);
1726 extern char *qgconvert(quadruple *, int, int, char *);
1727
1728 extern void __assert(const char *, const char *, int);
1729
1730 extern int setjmp(jmp_buf);
1731 extern void longjmp(jmp_buf, int);
1732 extern int sigsetjmp(sigjmp_buf, int);
1733 extern void siglongjmp(sigjmp_buf, int);
1734
1735 int uname(struct utsname *);
1736 int _uname(struct utsname *);
1737
1738 int errno;
1739 int *___errno()
1740 { return (&errno); }
1741
1742 extern int getloadavg(double [], int);
1743
1744 extern long pcsample(uintptr_t [], long);
1745
1746 int fstat(int, struct stat *);
1747 int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1748 int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1749 int mknod(const char *, mode_t, dev_t);
1750
1751 extern int __init_daemon_priv(int, uid_t uid, gid_t gid, ...);
1752 extern void __fini_daemon_priv(const char *, ...);
1753 extern int __init_suid_priv(int, ...);
1754 extern int __priv_bracket(priv_op_t);
1755 extern void __priv_relinquish(void);
1756 extern const char * __priv_getsetbynum(const void *, int);
1757 extern char * __priv_set_to_str(void *, const priv_set_t *, char, int);
1758
1759 /* private interface to get the groups list for a certain user */
1760 int _getgroupsbymember(const char *, gid_t[], int, int);
1761
1762 /* private interface for use only by java */
1763 volatile sc_shared_t *volatile *_thr_schedctl(void);
1764
1765 /* private interface to unmount all autofs mounts */
1766 int _autofssys(enum autofssys_op, void *);
1767
1768 /* label.c */
1769 extern int is_system_labeled(void);
1770
1771 extern int uconv_u16tou32(const uint16_t *, size_t *, uint32_t *, size_t *,
1772 int);
1773 extern int uconv_u16tou8(const uint16_t *, size_t *, uchar_t *, size_t *, int);
1774 extern int uconv_u32tou16(const uint32_t *, size_t *, uint16_t *, size_t *,
1775 int);
1776 extern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int);
1777 extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int);
1778 extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int);
1779 extern int u8_validate(char *, size_t, char **, int, int *);
1780 extern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *);
1781 extern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t,
1782 int *);
1783
1784 /* private locale interfaces */
1785 wint_t __nextwctype(wint_t, wctype_t);
1786 int __iswrune(wint_t);