| ... |
... |
@@ -53,12 +53,9 @@ |
|
53
|
53
|
(def-alien-type u-int32-t unsigned-int)
|
|
54
|
54
|
|
|
55
|
55
|
(def-alien-type ino-t
|
|
56
|
|
- #+netbsd u-int64-t
|
|
|
56
|
+ #+(or netbsd linux darwin) u-int64-t
|
|
57
|
57
|
#+alpha unsigned-int
|
|
58
|
|
- #-(or alpha netbsd) unsigned-long)
|
|
59
|
|
-
|
|
60
|
|
-#+linux
|
|
61
|
|
-(def-alien-type ino64-t u-int64-t)
|
|
|
58
|
+ #-(or alpha netbsd linux darwin) unsigned-long)
|
|
62
|
59
|
|
|
63
|
60
|
(def-alien-type size-t
|
|
64
|
61
|
#-(or linux alpha) long
|
| ... |
... |
@@ -72,14 +69,6 @@ |
|
72
|
69
|
#+(and bsd netbsd) int64-t
|
|
73
|
70
|
#+alpha unsigned-int)
|
|
74
|
71
|
|
|
75
|
|
-(def-alien-type dev-t
|
|
76
|
|
- #-(or alpha svr4 bsd linux) short
|
|
77
|
|
- #+(and linux (not amd64)) uquad-t
|
|
78
|
|
- #+(and linux amd64) u-int64-t
|
|
79
|
|
- #+netbsd u-int64-t
|
|
80
|
|
- #+alpha int
|
|
81
|
|
- #+(and (not linux) (not netbsd) (or bsd svr4)) unsigned-long)
|
|
82
|
|
-
|
|
83
|
72
|
#-BSD
|
|
84
|
73
|
(progn
|
|
85
|
74
|
(deftype file-offset () '(signed-byte 32))
|
| ... |
... |
@@ -131,13 +120,6 @@ |
|
131
|
120
|
`(multiple-value-bind (,word ,bit) (floor ,offset 32)
|
|
132
|
121
|
(logbitp ,bit (deref (slot ,fd-set 'fds-bits) ,word)))))
|
|
133
|
122
|
|
|
134
|
|
-(def-alien-type nlink-t
|
|
135
|
|
- #-(or svr4 netbsd linux) unsigned-short
|
|
136
|
|
- #+netbsd unsigned-long
|
|
137
|
|
- #+svr4 unsigned-long
|
|
138
|
|
- #+(and linux (not amd64)) unsigned-int
|
|
139
|
|
- #+(and linux amd64) u-int64-t)
|
|
140
|
|
-
|
|
141
|
123
|
(defconstant fd-setsize
|
|
142
|
124
|
#-(or hpux alpha linux FreeBSD) 256
|
|
143
|
125
|
#+hpux 2048 #+alpha 4096 #+(or linux FreeBSD) 1024)
|
| ... |
... |
@@ -1301,7 +1283,7 @@ |
|
1301
|
1283
|
#+glibc2.1
|
|
1302
|
1284
|
(d-ino ino-t) ; inode number of entry
|
|
1303
|
1285
|
#-glibc2.1
|
|
1304
|
|
- (d-ino ino64-t) ; inode number of entry
|
|
|
1286
|
+ (d-ino ino-t) ; inode number of entry
|
|
1305
|
1287
|
(d-off off-t) ; offset of next disk directory entry
|
|
1306
|
1288
|
(d-reclen unsigned-short) ; length of this record
|
|
1307
|
1289
|
(d_type unsigned-char)
|
| ... |
... |
@@ -1347,261 +1329,143 @@ |
|
1347
|
1329
|
(d-name (array char 256)))) ; name must be no longer than this
|
|
1348
|
1330
|
|
|
1349
|
1331
|
|
|
1350
|
|
-#+(and bsd (not netbsd))
|
|
1351
|
|
-(def-alien-type nil
|
|
1352
|
|
- (struct stat
|
|
1353
|
|
- (st-dev dev-t)
|
|
1354
|
|
- (st-ino ino-t)
|
|
1355
|
|
- (st-mode mode-t)
|
|
1356
|
|
- (st-nlink nlink-t)
|
|
1357
|
|
- (st-uid uid-t)
|
|
1358
|
|
- (st-gid gid-t)
|
|
1359
|
|
- (st-rdev dev-t)
|
|
1360
|
|
- (st-atime (struct timespec-t))
|
|
1361
|
|
- (st-mtime (struct timespec-t))
|
|
1362
|
|
- (st-ctime (struct timespec-t))
|
|
1363
|
|
- (st-size off-t)
|
|
1364
|
|
- (st-blocks off-t)
|
|
1365
|
|
- (st-blksize unsigned-long)
|
|
1366
|
|
- (st-flags unsigned-long)
|
|
1367
|
|
- (st-gen unsigned-long)
|
|
1368
|
|
- (st-lspare long)
|
|
1369
|
|
- (st-qspare (array long 4))))
|
|
1370
|
|
-
|
|
1371
|
|
-#+svr4
|
|
1372
|
|
-(def-alien-type nil
|
|
1373
|
|
- (struct stat
|
|
1374
|
|
- (st-dev dev-t)
|
|
1375
|
|
- (st-pad1 #-linux (array long 3) #+linux unsigned-short)
|
|
1376
|
|
- (st-ino ino-t)
|
|
1377
|
|
- (st-mode #-linux unsigned-long #+linux unsigned-short)
|
|
1378
|
|
- (st-nlink #-linux short #+linux unsigned-short)
|
|
1379
|
|
- (st-uid #-linux uid-t #+linux unsigned-short)
|
|
1380
|
|
- (st-gid #-linux gid-t #+linux unsigned-short)
|
|
1381
|
|
- (st-rdev dev-t)
|
|
1382
|
|
- (st-pad2 #-linux (array long 2) #+linux unsigned-short)
|
|
1383
|
|
- (st-size off-t)
|
|
1384
|
|
- #-linux (st-pad3 long)
|
|
1385
|
|
- #+linux (st-blksize unsigned-long)
|
|
1386
|
|
- #+linux (st-blocks unsigned-long)
|
|
1387
|
|
- #-linux (st-atime (struct timestruc-t))
|
|
1388
|
|
- #+linux (st-atime unsigned-long)
|
|
1389
|
|
- #+linux (unused-1 unsigned-long)
|
|
1390
|
|
- #-linux (st-mtime (struct timestruc-t))
|
|
1391
|
|
- #+linux (st-mtime unsigned-long)
|
|
1392
|
|
- #+linux (unused-2 unsigned-long)
|
|
1393
|
|
- #-linux (st-ctime (struct timestruc-t))
|
|
1394
|
|
- #+linux (st-ctime unsigned-long)
|
|
1395
|
|
- #+linux (unused-3 unsigned-long)
|
|
1396
|
|
- #+linux (unused-4 unsigned-long)
|
|
1397
|
|
- #+linux (unused-5 unsigned-long)
|
|
1398
|
|
- #-linux(st-blksize long)
|
|
1399
|
|
- #-linux (st-blocks long)
|
|
1400
|
|
- #-linux (st-fstype (array char 16))
|
|
1401
|
|
- #-linux (st-pad4 (array long 8))))
|
|
1402
|
|
-
|
|
1403
|
|
-#+linux
|
|
1404
|
|
-(def-alien-type nil
|
|
1405
|
|
- (struct stat
|
|
1406
|
|
- (st-dev dev-t)
|
|
1407
|
|
- #-(or alpha amd64) (st-pad1 unsigned-short)
|
|
1408
|
|
- (st-ino ino-t)
|
|
1409
|
|
- #+alpha (st-pad1 unsigned-int)
|
|
1410
|
|
- #-amd64 (st-mode mode-t)
|
|
1411
|
|
- (st-nlink nlink-t)
|
|
1412
|
|
- #+amd64 (st-mode mode-t)
|
|
1413
|
|
- (st-uid uid-t)
|
|
1414
|
|
- (st-gid gid-t)
|
|
1415
|
|
- (st-rdev dev-t)
|
|
1416
|
|
- #-alpha (st-pad2 unsigned-short)
|
|
1417
|
|
- (st-size off-t)
|
|
1418
|
|
- #-alpha (st-blksize unsigned-long)
|
|
1419
|
|
- #-alpha (st-blocks blkcnt-t)
|
|
1420
|
|
- (st-atime time-t)
|
|
1421
|
|
- #-alpha (unused-1 unsigned-long)
|
|
1422
|
|
- (st-mtime time-t)
|
|
1423
|
|
- #-alpha (unused-2 unsigned-long)
|
|
1424
|
|
- (st-ctime time-t)
|
|
1425
|
|
- #+alpha (st-blocks int)
|
|
1426
|
|
- #+alpha (st-pad2 unsigned-int)
|
|
1427
|
|
- #+alpha (st-blksize unsigned-int)
|
|
1428
|
|
- #+alpha (st-flags unsigned-int)
|
|
1429
|
|
- #+alpha (st-gen unsigned-int)
|
|
1430
|
|
- #+alpha (st-pad3 unsigned-int)
|
|
1431
|
|
- #+alpha (unused-1 unsigned-long)
|
|
1432
|
|
- #+alpha (unused-2 unsigned-long)
|
|
1433
|
|
- (unused-3 unsigned-long)
|
|
1434
|
|
- (unused-4 unsigned-long)
|
|
1435
|
|
- #-alpha (unused-5 unsigned-long)))
|
|
1436
|
|
-
|
|
1437
|
|
-;;; 64-bit stat for Solaris
|
|
1438
|
|
-#+solaris
|
|
1439
|
|
-(def-alien-type nil
|
|
1440
|
|
- (struct stat64
|
|
1441
|
|
- (st-dev dev-t)
|
|
1442
|
|
- (st-pad1 (array long 3)) ; Pad so ino is 64-bit aligned
|
|
1443
|
|
- (st-ino ino64-t)
|
|
1444
|
|
- (st-mode unsigned-long)
|
|
1445
|
|
- (st-nlink short)
|
|
1446
|
|
- (st-uid uid-t)
|
|
1447
|
|
- (st-gid gid-t)
|
|
1448
|
|
- (st-rdev dev-t)
|
|
1449
|
|
- (st-pad2 (array long 3)) ; Pad so size is 64-bit aligned
|
|
1450
|
|
- (st-size off64-t)
|
|
1451
|
|
- (st-atime (struct timestruc-t))
|
|
1452
|
|
- (st-mtime (struct timestruc-t))
|
|
1453
|
|
- (st-ctime (struct timestruc-t))
|
|
1454
|
|
- (st-blksize long)
|
|
1455
|
|
- (st-pad3 (array long 1)) ; Pad so blocks is 64-bit aligned
|
|
1456
|
|
- (st-blocks blkcnt64-t)
|
|
1457
|
|
- (st-fstype (array char 16))
|
|
1458
|
|
- (st-pad4 (array long 8))))
|
|
1459
|
|
-
|
|
1460
|
|
-#+netbsd
|
|
1461
|
|
-(def-alien-type nil
|
|
1462
|
|
- (struct stat
|
|
1463
|
|
- (st-dev dev-t)
|
|
1464
|
|
- (st-mode mode-t)
|
|
1465
|
|
- (st-ino ino-t)
|
|
1466
|
|
- (st-nlink nlink-t)
|
|
1467
|
|
- (st-uid uid-t)
|
|
1468
|
|
- (st-gid gid-t)
|
|
1469
|
|
- (st-rdev dev-t)
|
|
1470
|
|
- (st-atime (struct timespec-t))
|
|
1471
|
|
- (st-mtime (struct timespec-t))
|
|
1472
|
|
- (st-ctime (struct timespec-t))
|
|
1473
|
|
- (st-birthtime (struct timespec-t))
|
|
1474
|
|
- (st-size off-t)
|
|
1475
|
|
- (st-blocks off-t)
|
|
1476
|
|
- (st-blksize long)
|
|
1477
|
|
- (st-flags unsigned-long)
|
|
1478
|
|
- (st-gen unsigned-long)
|
|
1479
|
|
- (st-spare (array unsigned-long 2))))
|
|
1480
|
|
-
|
|
1481
|
|
-#-linux
|
|
1482
|
|
-(defmacro extract-stat-results (buf)
|
|
1483
|
|
- `(values T
|
|
1484
|
|
- (slot ,buf 'st-dev)
|
|
1485
|
|
- (slot ,buf 'st-ino)
|
|
1486
|
|
- (slot ,buf 'st-mode)
|
|
1487
|
|
- (slot ,buf 'st-nlink)
|
|
1488
|
|
- (slot ,buf 'st-uid)
|
|
1489
|
|
- (slot ,buf 'st-gid)
|
|
1490
|
|
- (slot ,buf 'st-rdev)
|
|
1491
|
|
- (slot ,buf 'st-size)
|
|
1492
|
|
- #-(or svr4 BSD) (slot ,buf 'st-atime)
|
|
1493
|
|
- #+svr4 (slot (slot ,buf 'st-atime) 'tv-sec)
|
|
1494
|
|
- #+BSD (slot (slot ,buf 'st-atime) 'ts-sec)
|
|
1495
|
|
- #-(or svr4 BSD)(slot ,buf 'st-mtime)
|
|
1496
|
|
- #+svr4 (slot (slot ,buf 'st-mtime) 'tv-sec)
|
|
1497
|
|
- #+BSD(slot (slot ,buf 'st-mtime) 'ts-sec)
|
|
1498
|
|
- #-(or svr4 BSD) (slot ,buf 'st-ctime)
|
|
1499
|
|
- #+svr4 (slot (slot ,buf 'st-ctime) 'tv-sec)
|
|
1500
|
|
- #+BSD(slot (slot ,buf 'st-ctime) 'ts-sec)
|
|
1501
|
|
- #+netbsd (slot (slot ,buf 'st-birthtime) 'ts-sec)
|
|
1502
|
|
- (slot ,buf 'st-blksize)
|
|
1503
|
|
- (slot ,buf 'st-blocks)))
|
|
1504
|
|
-
|
|
1505
|
|
-#+linux
|
|
1506
|
|
-(defmacro extract-stat-results (buf)
|
|
1507
|
|
- `(values T
|
|
1508
|
|
- #+(or alpha amd64)
|
|
1509
|
|
- (slot ,buf 'st-dev)
|
|
1510
|
|
- #-(or alpha amd64)
|
|
1511
|
|
- (+ (deref (slot ,buf 'st-dev) 0)
|
|
1512
|
|
- (* (+ +max-u-long+ 1)
|
|
1513
|
|
- (deref (slot ,buf 'st-dev) 1))) ;;; let's hope this works..
|
|
1514
|
|
- (slot ,buf 'st-ino)
|
|
1515
|
|
- (slot ,buf 'st-mode)
|
|
1516
|
|
- (slot ,buf 'st-nlink)
|
|
1517
|
|
- (slot ,buf 'st-uid)
|
|
1518
|
|
- (slot ,buf 'st-gid)
|
|
1519
|
|
- #+(or alpha amd64)
|
|
1520
|
|
- (slot ,buf 'st-rdev)
|
|
1521
|
|
- #-(or alpha amd64)
|
|
1522
|
|
- (+ (deref (slot ,buf 'st-rdev) 0)
|
|
1523
|
|
- (* (+ +max-u-long+ 1)
|
|
1524
|
|
- (deref (slot ,buf 'st-rdev) 1))) ;;; let's hope this works..
|
|
1525
|
|
- (slot ,buf 'st-size)
|
|
1526
|
|
- (slot ,buf 'st-atime)
|
|
1527
|
|
- (slot ,buf 'st-mtime)
|
|
1528
|
|
- (slot ,buf 'st-ctime)
|
|
1529
|
|
- (slot ,buf 'st-blksize)
|
|
1530
|
|
- (slot ,buf 'st-blocks)))
|
|
1531
|
|
-
|
|
1532
|
|
-#-solaris
|
|
1533
|
|
-(progn
|
|
1534
|
|
-(defun unix-stat (name)
|
|
1535
|
|
- _N"Unix-stat retrieves information about the specified
|
|
1536
|
|
- file returning them in the form of multiple values.
|
|
1537
|
|
- See the UNIX Programmer's Manual for a description
|
|
1538
|
|
- of the values returned. If the call fails, then NIL
|
|
1539
|
|
- and an error number is returned instead."
|
|
1540
|
|
- (declare (type unix-pathname name))
|
|
1541
|
|
- (when (string= name "")
|
|
1542
|
|
- (setf name "."))
|
|
1543
|
|
- (with-alien ((buf (struct stat)))
|
|
1544
|
|
- (syscall (#+linux "stat64" #+netbsd "__stat50" #-(or linux netbsd) "stat"
|
|
1545
|
|
- c-string (* (struct stat)))
|
|
1546
|
|
- (extract-stat-results buf)
|
|
1547
|
|
- (%name->file name) (addr buf))))
|
|
1548
|
|
-
|
|
1549
|
|
-(defun unix-lstat (name)
|
|
1550
|
|
- _N"Unix-lstat is similar to unix-stat except the specified
|
|
1551
|
|
- file must be a symbolic link."
|
|
1552
|
|
- (declare (type unix-pathname name))
|
|
1553
|
|
- (with-alien ((buf (struct stat)))
|
|
1554
|
|
- (syscall (#+linux "lstat64" #+netbsd "__lstat50" #-(or linux netbsd) "lstat"
|
|
1555
|
|
- c-string (* (struct stat)))
|
|
1556
|
|
- (extract-stat-results buf)
|
|
1557
|
|
- (%name->file name) (addr buf))))
|
|
1558
|
|
-
|
|
1559
|
|
-(defun unix-fstat (fd)
|
|
1560
|
|
- _N"Unix-fstat is similar to unix-stat except the file is specified
|
|
1561
|
|
- by the file descriptor fd."
|
|
1562
|
|
- (declare (type unix-fd fd))
|
|
1563
|
|
- (with-alien ((buf (struct stat)))
|
|
1564
|
|
- (syscall (#+linux "fstat64" #+netbsd "__fstat50" #-(or linux netbsd) "fstat"
|
|
1565
|
|
- int (* (struct stat)))
|
|
1566
|
|
- (extract-stat-results buf)
|
|
1567
|
|
- fd (addr buf))))
|
|
1568
|
|
-)
|
|
1569
|
|
-
|
|
1570
|
|
-;;; 64-bit versions of stat and friends
|
|
1571
|
|
-#+solaris
|
|
1572
|
|
-(progn
|
|
1573
|
|
-(defun unix-stat (name)
|
|
1574
|
|
- _N"Unix-stat retrieves information about the specified
|
|
1575
|
|
- file returning them in the form of multiple values.
|
|
1576
|
|
- See the UNIX Programmer's Manual for a description
|
|
1577
|
|
- of the values returned. If the call fails, then NIL
|
|
1578
|
|
- and an error number is returned instead."
|
|
1579
|
|
- (declare (type unix-pathname name))
|
|
1580
|
|
- (when (string= name "")
|
|
1581
|
|
- (setf name "."))
|
|
1582
|
|
- (with-alien ((buf (struct stat64)))
|
|
1583
|
|
- (syscall ("stat64" c-string (* (struct stat64)))
|
|
1584
|
|
- (extract-stat-results buf)
|
|
1585
|
|
- (%name->file name) (addr buf))))
|
|
1586
|
|
-
|
|
1587
|
|
-(defun unix-lstat (name)
|
|
1588
|
|
- _N"Unix-lstat is similar to unix-stat except the specified
|
|
1589
|
|
- file must be a symbolic link."
|
|
1590
|
|
- (declare (type unix-pathname name))
|
|
1591
|
|
- (with-alien ((buf (struct stat64)))
|
|
1592
|
|
- (syscall ("lstat64" c-string (* (struct stat64)))
|
|
1593
|
|
- (extract-stat-results buf)
|
|
1594
|
|
- (%name->file name) (addr buf))))
|
|
1595
|
|
-
|
|
1596
|
|
-(defun unix-fstat (fd)
|
|
1597
|
|
- _N"Unix-fstat is similar to unix-stat except the file is specified
|
|
1598
|
|
- by the file descriptor fd."
|
|
1599
|
|
- (declare (type unix-fd fd))
|
|
1600
|
|
- (with-alien ((buf (struct stat64)))
|
|
1601
|
|
- (syscall ("fstat64" int (* (struct stat64)))
|
|
1602
|
|
- (extract-stat-results buf)
|
|
1603
|
|
- fd (addr buf))))
|
|
1604
|
|
-)
|
|
|
1332
|
+;; unix-stat and friends
|
|
|
1333
|
+(macrolet
|
|
|
1334
|
+ ((call-stat (c-func-name first-arg-type first-arg)
|
|
|
1335
|
+ ;; Call the stat function named C-FUNC-NAME. The type of the
|
|
|
1336
|
+ ;; first arg is FIRST-ARG-TYPE and FIRST-ARG is the first arg
|
|
|
1337
|
+ ;; to the stat function. fstat is different from stat and
|
|
|
1338
|
+ ;; lstat since it takes an fd for the first arg instead of
|
|
|
1339
|
+ ;; string.
|
|
|
1340
|
+ `(with-alien ((dev c-call:long-long)
|
|
|
1341
|
+ (ino c-call:unsigned-long-long)
|
|
|
1342
|
+ (mode c-call:unsigned-int)
|
|
|
1343
|
+ (nlink c-call:unsigned-long-long)
|
|
|
1344
|
+ (uid c-call:unsigned-int)
|
|
|
1345
|
+ (gid c-call:unsigned-int)
|
|
|
1346
|
+ (rdev c-call:unsigned-long-long)
|
|
|
1347
|
+ (size c-call:long-long)
|
|
|
1348
|
+ (atime c-call:long-long)
|
|
|
1349
|
+ (mtime c-call:long-long)
|
|
|
1350
|
+ (ctime c-call:long-long)
|
|
|
1351
|
+ (blksize c-call:long)
|
|
|
1352
|
+ (blocks c-call:long-long))
|
|
|
1353
|
+ (let ((result
|
|
|
1354
|
+ (alien-funcall
|
|
|
1355
|
+ (extern-alien ,c-func-name
|
|
|
1356
|
+ (function int
|
|
|
1357
|
+ ,first-arg-type
|
|
|
1358
|
+ (* c-call:long-long)
|
|
|
1359
|
+ (* c-call:unsigned-long-long)
|
|
|
1360
|
+ (* c-call:unsigned-int)
|
|
|
1361
|
+ (* c-call:unsigned-long-long)
|
|
|
1362
|
+ (* c-call:unsigned-int)
|
|
|
1363
|
+ (* c-call:unsigned-int)
|
|
|
1364
|
+ (* c-call:unsigned-long-long)
|
|
|
1365
|
+ (* c-call:long-long)
|
|
|
1366
|
+ (* c-call:long-long)
|
|
|
1367
|
+ (* c-call:long-long)
|
|
|
1368
|
+ (* c-call:long-long)
|
|
|
1369
|
+ (* c-call:long)
|
|
|
1370
|
+ (* c-call:long-long)))
|
|
|
1371
|
+ ,first-arg
|
|
|
1372
|
+ (addr dev)
|
|
|
1373
|
+ (addr ino)
|
|
|
1374
|
+ (addr mode)
|
|
|
1375
|
+ (addr nlink)
|
|
|
1376
|
+ (addr uid)
|
|
|
1377
|
+ (addr gid)
|
|
|
1378
|
+ (addr rdev)
|
|
|
1379
|
+ (addr size)
|
|
|
1380
|
+ (addr atime)
|
|
|
1381
|
+ (addr mtime)
|
|
|
1382
|
+ (addr ctime)
|
|
|
1383
|
+ (addr blksize)
|
|
|
1384
|
+ (addr blocks))))
|
|
|
1385
|
+ (if (eql -1 result)
|
|
|
1386
|
+ (values nil (unix-errno))
|
|
|
1387
|
+ (values t
|
|
|
1388
|
+ dev
|
|
|
1389
|
+ ino
|
|
|
1390
|
+ mode
|
|
|
1391
|
+ nlink
|
|
|
1392
|
+ uid
|
|
|
1393
|
+ gid
|
|
|
1394
|
+ rdev
|
|
|
1395
|
+ size
|
|
|
1396
|
+ atime
|
|
|
1397
|
+ mtime
|
|
|
1398
|
+ ctime
|
|
|
1399
|
+ blksize
|
|
|
1400
|
+ blocks))))))
|
|
|
1401
|
+ (defun unix-stat (name)
|
|
|
1402
|
+ _N"Unix-stat retrieves information about the specified
|
|
|
1403
|
+ file returning them in the form of multiple values. If the call
|
|
|
1404
|
+ fails, then NIL and an error number is returned. If the call
|
|
|
1405
|
+ succeeds, then T is returned in addition to the following values
|
|
|
1406
|
+ from the stat struct st:
|
|
|
1407
|
+
|
|
|
1408
|
+ st_dev Device ID
|
|
|
1409
|
+ st_ino File serial number
|
|
|
1410
|
+ st_mode Mode of file
|
|
|
1411
|
+ st_nlink Number of hard links to the file
|
|
|
1412
|
+ st_uid User ID
|
|
|
1413
|
+ st_gid Group ID
|
|
|
1414
|
+ st_rdev Device ID (if file is character or block special)
|
|
|
1415
|
+ st_atime Last data access time, in sec
|
|
|
1416
|
+ st_mtime Last data modification time, in sec
|
|
|
1417
|
+ st_ctime Last file status change time, in sec
|
|
|
1418
|
+ st_blksize Preferred I/O block size
|
|
|
1419
|
+ st_blocks Number of blocks allocated. (Block size is implementation dependent.)
|
|
|
1420
|
+"
|
|
|
1421
|
+ (declare (type unix-pathname name))
|
|
|
1422
|
+ (when (string= name "")
|
|
|
1423
|
+ (setf name "."))
|
|
|
1424
|
+ (call-stat "os_stat" c-call:c-string (%name->file name)))
|
|
|
1425
|
+
|
|
|
1426
|
+ (defun unix-lstat (name)
|
|
|
1427
|
+ "Unix-lstat is similar to unix-stat except the specified
|
|
|
1428
|
+ file must be a symbolic link. If the call fails, then NIL and an
|
|
|
1429
|
+ error number is returned. If the call succeeds, then T is returned
|
|
|
1430
|
+ in addition to the following values from the stat struct st:
|
|
|
1431
|
+
|
|
|
1432
|
+ st_dev Device ID
|
|
|
1433
|
+ st_ino File serial number
|
|
|
1434
|
+ st_mode Mode of file
|
|
|
1435
|
+ st_nlink Number of hard links to the file
|
|
|
1436
|
+ st_uid User ID
|
|
|
1437
|
+ st_gid Group ID
|
|
|
1438
|
+ st_rdev Device ID (if file is character or block special)
|
|
|
1439
|
+ st_atime Last data access time, in sec
|
|
|
1440
|
+ st_mtime Last data modification time, in sec
|
|
|
1441
|
+ st_ctime Last file status change time, in sec
|
|
|
1442
|
+ st_blksize Preferred I/O block size
|
|
|
1443
|
+ st_blocks Number of blocks allocated. (Block size is implementation dependent.)
|
|
|
1444
|
+"
|
|
|
1445
|
+ (declare (type unix-pathname name))
|
|
|
1446
|
+ (call-stat "os_lstat" c-call:c-string (%name->file name)))
|
|
|
1447
|
+
|
|
|
1448
|
+ (defun unix-fstat (fd)
|
|
|
1449
|
+ _N"Unix-fstat is similar to unix-stat except the file is specified
|
|
|
1450
|
+ by the file descriptor fd. If the call fails, then NIL and an
|
|
|
1451
|
+ error number is returned. If the call succeeds, then T is returned
|
|
|
1452
|
+ in addition to the following values from the stat struct st:
|
|
|
1453
|
+
|
|
|
1454
|
+ st_dev Device ID
|
|
|
1455
|
+ st_ino File serial number
|
|
|
1456
|
+ st_mode Mode of file
|
|
|
1457
|
+ st_nlink Number of hard links to the file
|
|
|
1458
|
+ st_uid User ID
|
|
|
1459
|
+ st_gid Group ID
|
|
|
1460
|
+ st_rdev Device ID (if file is character or block special)
|
|
|
1461
|
+ st_atime Last data access time, in sec
|
|
|
1462
|
+ st_mtime Last data modification time, in sec
|
|
|
1463
|
+ st_ctime Last file status change time, in sec
|
|
|
1464
|
+ st_blksize Preferred I/O block size
|
|
|
1465
|
+ st_blocks Number of blocks allocated. (Block size is implementation dependent.)
|
|
|
1466
|
+"
|
|
|
1467
|
+ (declare (type unix-fd fd))
|
|
|
1468
|
+ (call-stat "os_fstat" int fd)))
|
|
1605
|
1469
|
|
|
1606
|
1470
|
(def-alien-type nil
|
|
1607
|
1471
|
(struct rusage
|