|
|
| |
LIBSTAND(3) |
FreeBSD Library Functions Manual |
LIBSTAND(3) |
libstand —
???????ɥ????????¹??ѥ??ݡ??ȥ饤?֥???
libstand
?ϡ????????ɥ??????ץꥱ?????????Υ??ݡ??ȴؿ????ȡ?
ɸ?? BSD
?ץ??????ߥ???ǽ???ϵ??Ķ????????Ƥ??ޤ???
???Υ??????????Ǥ??????δؿ???????ʬ?????Ƥ??ޤ???
?????????Τ????????ʤ??????ϡ??????δؿ??Υ?????????
3 ??
?ޥ˥奢???ڡ????γ????Ľ??Ȥ??Ʋ???????
- void *
malloc (size_t size)
-
size
?ǻ??ꤷ???礭???Υ?????????Ŭ?ʥ??르?ꥺ???ǥҡ????ΰ褫??????
???Ƥޤ???
- void
free (void *ptr)
-
ptr
?˳??????Ƥ??줿???֥??????Ȥ????????ޤ???
- void
setheap (void *start,
void *limit)
-
?ҡ????ΰ????????????ޤ??????δؿ??ϡ?
alloc ()
???ǽ??˸ƤӽФ????˼¹Ԥ??ʤ????Фʤ??ޤ?????
start ?? limit
?δ֤??ΰ褬?ҡ????ΰ??˻??Ѥ????ޤ???
???????ۤ??Ƴ??????Ƥ褦?Ȥ????? panic
?Ȥʤ??ޤ???
- char *
sbrk (int junk)
-
sbrk (0)
????????Ϳ???ޤ??????ʤ????ҡ????ΰ??κǹ??̥??ɥ쥹?Υݥ???
?֤??ޤ????????????ͤϡ??ƥ??Ȼ??˥ҡ??פμ»??Ѿ?????Ƚ?Ǥ????Τ?
???ѤǤ??ޤ??????? junk
??̵?뤵???ޤ???
????Ū?ʥ????륵?ݡ??ȴĶ???Ʊ?͡??ե??åȤ??ѿ??????????Τ?????
?췲?δؿ????????äƤ??ޤ??????ʳ?ĥ?Ȥ??ơ??եå??ؿ????????????????
?????Υ??ݡ??Ȥ??????ޤ???
- char *
getenv (const char *name)
- int
setenv (const char *name,
char *value, int overwrite)
- int
putenv (const char
*string)
- int
unsetenv (const char
*name)
-
???????δؿ??ϡ?ɸ???饤?֥???????????ư???ޤ???
- struct env_var *
env_getenv (const char
*name)
-
???δĶ????Ǥ??ѿ??????????٤ƤΥǡ?????¤???֤??ޤ???
- int
env_setenv (const char *name,
int flags, char *value,
ev_sethook_t sethook, ev_unsethook_t
unsethook)
-
name
?Ȥ????Ķ??ѿ??ο????????ޤ??ϴ?¸?Ķ??ѿ??????????Ԥ??ޤ???
?????ѿ????????????????ϡ????? sethook
?????? unsethook
?????ꤹ?뤳?Ȥ??Ǥ??ޤ???
EV_NOHOOK
?ե饰?????ꤵ???Ƥ??ʤ????С??ѿ??????褦?Ȥ????Ȥ????ȡ?
?եå??????꤬ɬ????ư?????ޤ????̾????
value
?γ?ǧ???Ԥʤ????ºݤ??ͤ???¸???뤿????
EV_NOHOOK ?ѿ????Ĥ??ơ?????
env_setenv ()
?ƤӽФ????Ԥ????ꤷ?ޤ??????٤Ƥ??ѿ??????????ݤ??뤿???ˡ??????Ѥߴؿ?
env_noset ()
?????ꤹ?뤳?Ȥ??Ǥ??ޤ???
?????????եå??ϡ??ѿ??????????????Ԥ??????Ȥ??˵?ư?????ޤ???
?????ͤ? 0
?ΤȤ????ѿ????????????????Ƥ??ޤ????????Ѥߴؿ?
env_nounset
?ϡ??ѿ????????????????????Τ˻??Ѥ??ޤ???
- int
getopt (int argc,
char * const *argv, cont char
*optstring)
- long
strtol (const char *nptr,
char **endptr, int base)
- void
srandom (unsigned long
seed)
- unsigned long
random (void)
- char *
strerror (int error)
-
libstand
?ǥ??ݡ??Ȥ????Ƥ??? errno
?Υ??֥??å??ͤ??б?????
???顼???å????????֤??ޤ???
assert (expression)
-
<assert.h>
?Ԥ?ɬ?פǤ???
- int
setjmp (jmp_buf env)
- void
longjmp (jmp_buf env,
int val)
-
?????Ǥ??륷???ʥ????֤??ʤ????ᡢ???줾??
_setjmp () ??????
_lonjmp ()
?Ȥ????????????Ƥ??ޤ???
<setjmp.h>
?Ԥ?ɬ?פǤ???
- void
gets (char *buf)
-
?????饯?????뤫??
buf
???ɤ߹??ߤޤ???ɸ??Ū?????ջ??ब?ܴؿ???
?Ф???Ŭ?Ѥ????ޤ???
- void
ngets (char *buf,
size_t size)
-
size -1
?ޤ??Ϥ????ʲ???ʸ?????뤫??
buf
???ɤ߹??ߤޤ???????ʸ???Ϻ??????졢
?Хåե??Ͼ??˥̥뤬??üʸ???ˤʤ??ޤ???
size ?? 1
?ʲ??ξ??硢?ؿ??? gets ()
??Ʊ??ư???ޤ???
- int
fgetstr (char *buf,
int size, int fd)
-
???Ԥ? size
ʸ???ʲ????ϰϤ? buf
???ɤ߹??ߤޤ????????Υ????饯?????ڤ??ΤƤ??졢
?Хåե??Ͼ??˥̥뤬??ü?Ȥʤ??ޤ???
???ェλ?ΤȤ??? buf
????ʸ???????֤????ɤ߹??ߥ??顼?ΤȤ???
-1 ???֤??ޤ???
- int
printf (const char *fmt,
...)
- void
vprintf (const char *fmt,
va_list ap)
- int
sprintf (char *buf,
const char *fmt, ...)
- void
vsprintf (char *buf,
const char *fmt, va_list
ap)
-
*printf ?ؿ??ϡ?ɸ??
printf ()
?ե??ߥ??Υ??֥??åȵ?ǽ?Ȥ????Ĥ??γ?ĥ??ǽ???????Ƥ??ޤ???
c,d,n,o,p,s,u,x
??ɸ???Ѵ??????ݡ??Ȥ????Ƥ??ޤ???
+,-,#,*,0, field width,precision,l
?ν????Ҥ????ݡ??Ȥ????Ƥ??ޤ???
???顼?쥸???????ǥ????ɤ??뤿????
b ?Ѵ????????äƤ??ޤ???
?Ȥ????ϰʲ????̤??Ǥ???
printf( “reg=%b\n”, regval,
“<base><arg>*” );
⟨base⟩
?ϡ????業???饯???ν??Ϥ?ɽ?????Ƥ??ޤ????㤨??
\10 ?? 10 ?ʿ?????\20 ?? 16 ?ʿ?????̣???ޤ?????
⟨arg⟩
?ϡ?ʸ?????ǡ??ǽ??ΰ?ʸ???ϰ????Υӥåȿ?(?Ϥ1)?ǡ?
?ӥåȤ????ꤵ???Ƥ??????硢?????ʹߤ?ʸ????(32ʸ??̤??)??ɽ???оݤ?
?ƥ????ȤǤ????Ĥޤꡢ
printf( “reg=%b\n” 3
“\10\2BITTWO\1BITONE\n” );
?ˤ???????ɽ???????ޤ???
reg=3<BITTWO,BITONE>
D ?Ѵ??ϡ?16
?ʿ??????פε?ǽ???????Ƥ??ޤ???
???Ȥ??С??ʲ???
printf( “%6D”, ptr,
“:” ); gives “XX:XX:XX:XX:XX:XX”
printf( “%*D”, len, ptr,
“ ” ); gives “XX XX XX ...”
- int
isupper (int c)
- int
islower (int c)
- int
isspace (int c)
- int
isdigit (int c)
- int
isxdigit (int c)
- int
isascii (int c)
- int
isalpha (int c)
- int
toupper (int c)
- int
tolower (int c)
- int
open (const char *path,
int flags)
-
open(2)
??ư???˻??Ƥ??ޤ????????????ե???????????ǽ?????ݡ???
?????Ƥ??ʤ????ᡢ?⡼?ɥѥ?????????פǤ???????
flags ?ˤϡ?O_RDONLY, O_WRONLY, O_RDWR
?Τɤ줫???????Ǥ??ޤ???
(???Ȥ??????߽????ߤݡ??Ȥ????ե????륷???ƥब̵???Ȥ??Ƥ?)
- int
close (int fd)
- void
closeall (void)
-
???٤Ƥ? open
?????Ƥ????ե????????Ĥ??ޤ???
- ssize_t
read (int fd,
void *buf, size_t len)
- ssize_t
write (int fd,
void *buf, size_t len)
-
(???߽??ߤݡ??Ȥ??Ƥ????ե????륷???ƥ??Ϥ????ޤ???)
- off_t
lseek (int fd,
off_t offset, int whence)
-
?ɤ߹??ߤκ????˼?ưŪ?˲??व?????ե??????ϡ????ߤΰ??֤?????????
seek ???뤳?ȤϤǤ??ޤ?????
- int
stat (const char *path,
struct stat *sb)
- int
fstat (int fd,
struct stat *sb)
-
?ؿ? stat () ??????
fstat () ?ϡ? sb
??¤?ΤΥե??????? : st_mode,
st_nlink,st_uid,st_gid,st_size
?ؤν??ߤ????ޤ???
tftp
?ե????륷???ƥ??Ǥϡ????δؿ??θƤӽФ???
??̣?Τ????ͤˤʤ??ޤ??ޤ?
cd9660
?ե????륷???ƥ??ϡ??ե??????? uid/gid
?????? 0 ?Ǥ????? ???𤷤????ޤ???
libstand
?ϴ?ñ???????ڡ????????????礭?ʥ??ޥ??ɤν??Ϥ??ɤߤ䤹?????ޤ???
- void
pager_open ()
-
?ڡ????????????????????ν??ϹԤ?ɽ?????֤???Ƭ?Ǥ??뤳?Ȥ??Τ餻?ޤ???
?Ķ??ѿ? LINES
?ϡ????٤?ɽ????ǽ?ʹԿ??????????ݤ˻??Ȥ????ޤ???
- void
pager_close (void)
-
?ڡ????????Ĥ??ޤ?
- int
pager_output (char *lines)
-
lines
?ǻ??ꤵ?줿???̥??ǽ?λ?????Хåե??ιԤ??ڡ??????????????ޤ???
????ʸ?????????뤳?Ȥǡ????Ϥ??????Կ??????ޤ??ޤ???
(?ޤ??֤??ϴޤߤޤ???)
???٤ƤιԤ????Ϥ??????ȡ?
pager_output () ?? 0
???֤??ޤ???????ɽ???????ߤ????桼???????潪λ??
?????Ȥ??? 0
?ʳ????ͤ??֤??ޤ???
- int
pager_file (char *fname)
-
?ե????? fname
????????ɽ?????ޤ??????顼?ΤȤ???
-1 ???֤???EOF ?ΤȤ??? 0
?桼?????ɤ߹??ߤ????潪λ??????????
1 ???֤??ޤ???
- void
twiddle (void)
-
Ϣ³?ƤӽФ??ξ??硢?桼??????ǧ?Ǥ????褦?ˡ?
ʸ???? |,/,-,\
?θ??˥Хå????ڡ??????դ??ƽ??Ϥ??ޤ???
?????å????ҡ??ס??????롢?ǥХ????ϡ?
libstand
?Ǥ褯?Ȥ???????????Ǥ???
?????å??ϡ? libstand
?ؿ?????ư?????????˹??ۤ???ɬ?פ??????ޤ???
?????å????ϡ??ؿ????Ȥ????Ƥ????ե????륷???ƥࡢ?????ӡ????ǾܽҤ???
???ݡ??ȥ쥤???ؿ??ˤ??ä??Ѳ????ޤ???
?ҡ??פϡ? alloc ()
?ؿ??? open ()
?ؿ??θƤӽФ??????ˡ?
setheap ()
?ƤӽФ????Ԥʤäƹ??ۤ??ʤ????Фʤ??ޤ??ҡ??פλ???ˡ?ϡ????饤?????Ȥ?
ư????Ʊ?͡?Ʊ???? open
?????ե??????ο??ˤ??ä??Ѳ????ޤ?????ư????????
???ȡ??ե??????? open ?????٤? 64K
?ʾ??Υǡ????????????Ƥ????ޤ???
?????륢???????ϡ????Ҥδؿ?
getchar (), putchar (),
ischar ()
?ˤ??äƹԤ????ޤ???
?ǥХ????????????? devopen ()
?ˤ??äƽ????????졢
devopen ()
???֤??ǥХ????????å???¤?Τδؿ?
dv_strategy (), dv_ioctl (),
dv_close ()
?ˤ??äƼ¹Ԥ????ޤ???
?桼???ϼ??Υ??ݡ??ȴؿ????Ѱդ???ɬ?פ??????ޤ???
- int
getchar (void)
-
?????뤫?顢?ؿ?
gets (), ngets ()
???ڡ??????ؿ??ˤ??äƻȤ?????ʸ?????֤??ޤ???
- int
ischar (void)
-
?????뤫???????Ԥ??ξ??֤ΤȤ???0
?Ǥʤ??ͤ??֤??ޤ???
- void
putchar (int)
-
???????ˡ? gets (),
ngets (), *printf (),
panic (), twiddle ()
??????
¾??¿???ΥǥХå????????????Ѥδؿ??????Ѥ???ʸ?????Ф??ޤ???
- int
devopen (struct open_file *of,
const char *name, char
**file)
-
name
?Ȥ???̾???Υե??????Ѥ?Ŭ???ʥǥХ????????ǥХ????Ȥ??ʤ?
?ե??????λĤ?????ʬ??
name ???ؤ??ݥ?????
file ???֤??ޤ???
of ?ι?¤?Υե???????
f_dev
?ϡ????ェλ???????硢open
?????ǥХ????? devsw
??¤?Τ??ؤ??褦?˥??åȤ????ޤ???
?ǥХ??????̻Ҥϡ????˥ѥ?????????Ƭ??????
ɬ?פ??????ޤ??????????ʳ??ϼ?ͳ?˥ե????ޥåȤ????Ƥ??ޤ???
open () ?? ?ǥХ?????Ϣ?? I/O
?ǻ??Ѥ????ޤ???
- int
devclose (struct open_file
*of)
- of
?˳??????Ƥ??줿?ǥХ??????Ĥ??ޤ???
?ǥХ????ɥ饤?м??Ȥϥ????????????Τ????ˤ??Ǥ˸ƤӽФ????Ԥ????Ƥ??ꡢ
???θƤӽФ??ϡ?
devopen ()
?ˤ??????????Ƥ??????????????Ǥ???
- void
panic (const char *msg,
...)
-
??̿Ū?Dz?????ǽ?ʥ??顼???֤????Τ??ޤ???????
msg ... ?ϡ?
printf ()
?Τ??Τ?Ʊ?ͤǤ???
?????ե????륷???ƥ??Ǥϡ? struct
fs_ops *file_system[]
?ι?¤?Τ??????桼??
?????????ݡ??ȤǤ????????Ϲ?¤??
struct fs_ops
?ؤΥݥ??ǽ??????????ޤ???
?ʲ??Υե????륷???ƥ??ϥ??ɥ餬
libstand ??
?????äƤ??ޤ??????桼???ϼ?ʬ???̤Υե????륷???ƥ???
???뤳?Ȥ??Ǥ??ޤ???
- ufs_fsops
- BSD ?? UFS
- ext2fs_fsops
- Linux ?? ext2fs ?ե????륷???ƥ?
- tftp_fsops
- TFTP ??ͳ?Υե????륢??????
- nfs_fsops
- NFS ??ͳ?Υե????륢??????
- cd9660_fsops
- ISO 9660 (CD-ROM) ?ե????륷???ƥ?
- zipfs_fsops
- ?ե??????ݡ??Ȥ??Ƥ????ե????륷???ƥ???
gzip
???줿?ե??????ݡ??Ȥ??륹???å?
???줿?ե????륷???ƥ??ǡ?zipfs
?ե????륷???ƥ????Ȥ????Ȥ????ȡ?
libstand
?ϥե?????̾?θ??? .gz
???ղä????????̤Υե????륷???ƥ??????Ѥ??ƥե??????ΰ??֤??????ޤ???
???Υե????륷???ƥ??Ρ?????
file_system[]
?Ǥ????֤ˤ??äơ? non-gzipped
?ե??????Ȥ??Ƥ??? gzipped
?ե????뤬 open ?????뤫?ɤ??????????????ޤ???
gzip ???줿?ե????????????? seek
???뤳?Ȥ??????Ǥ???gzip
???줿?ե??????ؤ? stat () ??????
fstat ()
?ϡ?Ĺ?????????????𤷤ޤ???
- bzipfs_fsops
- zipfs_fsops ??Ʊ?ͤǤ?????
bzip2
?ǰ??̤??줿?ե??????????Ѥ??ޤ???
??¤?? struct fs_ops
?Υݥ??????????ϥ̥??ǽ?λ???ʤ????Фʤ??ޤ?????
?ǥХ????ϡ??̥??ǽ?λ?????ǥХ????????å???¤?ΤΥݥ??????????Ǥ??롢
struct devsw *devsw[]
??ͳ?Υ??ݡ??ȥ????ɤˤ??äƥ??????ݡ??Ȥ????ޤ???
?ܺ٤ʥ????????ѥǡ??????ʤ??Τ??Կ??ڤǤ???
libstand
??¿???Υ??????????Ѥ??Ƥ??ޤ??????ʤ?????
- NetBSD ??????
libsa
- FreeBSD 3.0 ??????
libc ??
libkern
- Matthew Dillon
⟨dillon@backplane.com⟩ ??????
zalloc
?ƹ????? FreeBSD 3.0
?ؤΥݡ??ȡ??Ķ??ѿ??ط??δؿ??????Υޥ˥奢???ڡ?????
Mike Smith ⟨msmith@FreeBSD.org⟩
?????????ޤ?????
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |