WikiPendium

(beta)

Fcntl()

WikiPendium :: RecentChanges :: RecentlyCommented :: UserSettings :: You are 216.73.216.191
Ceci est une version archivée de Fcntl() à 2005-07-09 17:26:51.

Fcntl()

(File control)

LONG Fcntl( handle, arg, cmd )

WORD handle;
LONG arg;
WORD cmd;

Fcntl() executes a given operation on a file.

Opcode

260 (0x104)

Availability

All MiNT versions.

Parameters

handle is the handle of file opened by Fopen()?.
arg is either a long value or a pointer to a structure needed by the command, or NULL if unused.
cmd is the command to perform.

Binding

	move.w	cmd,-(sp)
	move.l	arg,-(sp)
	move.w	handle,-(sp)
	move.w	#$104,-(sp)
	trap	#1
	lea	10(sp),sp


Return Value

The LONG value contains 0 if the operation was successful, or a negative error code.

Commands and arguments


File specific commands
cmd (name) cmd (value) arg Operation
F_DUPFD 0x0000 Minimum value for returned handle Duplicate the file handle. The return value will be between arg and 32.
F_GETFD 0x0001 NULL (arg is ignored) Return the inheritance flag for the file. 1 means that child processes started with Pexec() will inherit this file handle, otherwise 0 is returned.
F_SETFD 0x0002 0: don't inherit,
1: inherit
Set the inheritance flag for the file.
F_GETFL 0x0003 NULL (arg is ignored) Return the file descriptor flags for the specified file. These are the same flags passed to Fopen()?.
F_SETFL 0x0004 Flags to be specified for the file decriptor Set the file decriptor flags for the specified file to arg. Only user-modifyable bits are considered and all others should be 0. It is not possible to change a file's read/write mode or sharing modes with this call. Attempts to do this will fail without returning an error code.
F_GETLK 0x0005 Points to a FLOCK structure Test for the presence of a lock on the specified file. If a prior lock exists which would prevent the specified lock from being applied, the interfering lock is copied into the structure with the process ID of the locking process. Otherwise, Fcntl() returns F_UNLCK (3).
F_SETLK 0x0006 Points to a FLOCK structure Set or remove an advisory lock on the specified file.
Setting l_type to F_RDLOCK (0) or F_WRLCK (1) will cause a lock to be set. Setting l_type to F_UNLCK (3) wil attempt to remove the specified lock. When locking and unlocking FIFO's, l_whence, l_start, and l_len should be 0. The command returns 0 if successful or a negative GEMDOS error code otherwise.
F_SETLKW 0x0007 Points to a FLOCK structure The calling procedure is the same as above, however, if other processes already have a conflicting lock set, it will suspend the calling process until the lock is freed.
FSTAT 0x4600 Points to a XATTR structure which is filled in with the file's extended attributes Get the extended attributes for a file. If successful, the function returns 0, otherwise a negative GEMDOS error code is returned.
FIONREAD 0x4601 Points to a LONG where the estimated number will be put Return (in the LONG pointed to by arg) an estimate of the number of bytes available for reading from the specified file without causing the process to block (while waiting for more input).
FIONWRITE 0x4602 Points to a LONG where the estimated number will be put Return (in the LONG pointed to by arg) an estimate of the number of bytes that may be written to the specified file without causing the process to block.
FUTIME 0x4603
FTRONCATE 0x4604
FIOEXCEPT 0x4605

Shared memory specific commands
cmd (name) cmd (value) arg Operation
SHMGETBLK 0x4d00 NULL (for future compatibility) Returns the address of the memory block associated to the file.
Note: Different processes may reveive different addresses for a shared block.
SHMSETBLK 0x4d01 Address of an allocated memory block to be associated with the file Associate a block of memory with the file. The file must have been created in u:\shm\ before this call.

Process specific commands
cmd (name) cmd (value) arg Operation
PPROCADDR 0x5001 Return the address of the specified processes' control structure (opened as a file) in arg (StabyloRmv: return value in the LONG pointed by arg would be more consistent). See the discussion of MiNT processes for information about this structure (StabyloRmv: couldn't find this structure in the specified section).
PBASEADDR 0x5002
PCTXTSIZE 0x5003
PSETFLAGS 0x5004
PGETFLAGS 0x5005
PTRACEGFLAGS 0x5006
PTRACESFLAGS 0x5007
PTRACEGO 0x5008
PTRACEFLOW 0x5009
PTRACESTEP 0x500a
PTRACE11 0x500b
PLOADINFO 0x500c
PFSTAT 0x500d

Socket specific commands
cmd (name) cmd (value) arg Operation
SIOCGLOWAT 0x5301
SIOCSLOWAT 0x5302
SIOCGHIWAT 0x5303
SIOCSHIWAT 0x5304
SIOCSPGRP 0x5305
SIOCGPGRP 0x5306
SIOCATMARK 0x5307
SIOCGIFCONF 0x530c
SIOCGIFFLAGS 0x530d
SIOCSIFFLAGS 0x530e
SIOCGIFADDR 0x530f
SIOCSIFADDR 0x5310
SIOCGIFDSTADDR 0x5311
SIOCSIFDSTADDR 0x5312
SIOCGIFBRDADDR 0x5313
SIOCSIFBRDADDR 0x5314
SIOCGIFNETMASK 0x5315
SIOCSIFNETMASK 0x5316
SIOCGIFMETRIC 0x5317
SIOCSIFMETRIC 0x5318
SIOCGIFMTU 0x531b
SIOCSIFMTU 0x531c
SIOCADDRT 0x531e
SIOCDELRT 0x531f
SIOCDARP 0x5328
SIOCGARP 0x5329
SIOCSARP 0x532a

CD-ROM specific commands
cmd (name) cmd (value) arg Operation
CDROMREADOFFSET 0x4300 Points to a LONG to store result Get block number of first sector in last session of a multisession CD
CDROMPAUSE 0x4301 NULL Pause audio CD operation
CDROMRESUME 0x4302 NULL Resume audio CD operation
CDROMPLAYMSF 0x4303 Points to a cdrom_msf_t structure Play audio CD
CDROMPLAYTRKIND 0x4304 Points to a cdrom_ti_t structure Play audio CD
CDROMREADTOCHDR 0x4305 Points to a cdrom_tochdr_t structure Read header of table of contents (TOC) of CD
CDROMREADTOCENTRY 0x4306 Points to a cdrom_tocentry_t structure Read table of contents (TOC) entry of CD
CDROMSTOP 0x4307 NULL Stop CD-ROM drive motor
CDROMSTART 0x4308 NULL Start CD-ROM drive motor
CDROMEJECT 0x4309 NULL Eject CD
CDROMVOLCTRL 0x430a Points to a cdrom_volctrl_t structure Set volume level
CDROMSUBCHNL 0x430b Points to a cdrom_subchnl_t structure Read sub-channel information
CDROMREADMODE2 0x430c Points to a cdrom_read_t structure Read mode 2 sectors (Mode 2 sectors are 2336 bytes long).
CDROMREADMODE1 0x430d Points to a cdrom_read_t structure Read mode 1 sectors (Mode 1 sectors are 2048 bytes long).
CDROMPREVENTREMOVAL 0x430e NULL Lock CD-ROM drive tray
CDROMALLOWTREMOVAL 0x430f NULL Unlock CD-ROM drive tray
CDROMAUDIOCTRL 0x4310 Points to a cdrom_audioctrl_t structure Control audio settings
CDROMREADDA 0x4311 Points to a cdrom_read_t structure Read audio CD sectors (Audio CD sectors are 2352 bytes long).
CDROMGETMCN 0x4313 Points to a cdrom_mcn_t structure Read media catalog number
CDROMGETTISRC 0x4314 Points to a cdrom_tisrc_t structure Read track international standard recording code

Terminal specific commands
cmd (name) cmd (value) arg Operation
TIOCGETP 0x5400 Points to an sgttyb structure Get terminal parameters from the TTY? device with the specified file handle.
TIOCSETN 0x5401 Points to an sgttyb structure Set the terminal parameters of the TTY? device specified. You should first get the terminal control parameters, modify what you wish to change, and then set them with this call.
TIOCGETC 0x5402 Points to a tchars structure Get the terminal control characters of the TTY? device specified.
TIOCSETC 0x5403 Points to a tchars structure Set the terminal control characters of the TTY? device specified. Setting any structure element to 0 disables that feature.
TIOCGLTC 0x5404 Points to a ltchars structure Get the extended terminal control characters from the TTY? device specified.
TIOCSLTC 0x5405 Points to a ltchars structure Set the extended terminal control characters for the TTY? device specified. The control characters are set from the ltchars structure pointed to by arg.
TIOCGPGRP 0x5406 Points to a LONG Return (in the LONG pointed to by arg) the process group ID for the TTY? specified.
TIOCSPGRP 0x5407 Points to a LONG Set (from the LONG pointed to by arg) the process group ID of the TTY? specified.
TIOCFLUSH 0x5408
TIOCSTOP 0x5409 NULL (arg is ignored) Stop terminal output (as if the user had pressed Ctrl-S).
TIOCSTART 0x540a NULL (arg is ignored) Restart output to the terminal (as if the user had pressed Ctrl-Q) if it had been previously stopped with Ctrl-S or a TIOCSTOP command.
TIOCGWINSZ 0x540b
TIOCSWINSZ 0x540c
TIOCGXKEY 0x540d
TIOCSXKEY 0x540e
TIOCIBAUD 0x5412
TIOCOBAUD 0x5413
TIOCCBRK 0x5414
TIOCSBRK 0x5415
TIOCGFLAGS 0x5416
TIOCSFLAGS 0x5417
TIOCOUTQ 0x5418
TIOCSETP 0x5419
TIOCHPCL 0x541a
TIOCCAR 0x541b
TIOCNCAR 0x541c
TIOCWONLINE 0x541d
TIOCSFLAGSB 0x541e
TIOCGSTATE 0x541f
TIOCGSTATEB 0x5420
TIOCGVMIN 0x5421
TIOCSVMIN 0x5422
TIOCGHUPCL 0x5462
TIOCSHUPCL 0x5463
TIOCGSOFTCAR 0x5464
TIOCSSOFTCAR 0x5465
TIOCBUFFER 0x5480
TIOCCTLMAP 0x5481
TIOCCTLGET 0x5482
TIOCCTLSET 0x5483
TIOCCTLSFAST 0x5484
TIOCCTLSSLOW 0x5485
TIONOTSEND 0x5486
TIOCERROR 0x5487
TIOCLBIS 0x54f6
TIOCLBIC 0x54f7
TIOCMGET 0x54f8
TIOCCDTR 0x54f9
TIOCSDTR 0x54fa
TIOCNOTTY 0x54fb
TIOCGETD 0x54fc
TIOCSETD 0x54fd
TIOCLGET 0x54fe
TIOCLSET 0x54ff

See Also

Flock()?, Fopen()?, Fxattr()?, Pgetpgrp()?, Psetpgrp()?

Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]